Ok, in that case, you need to use a function node to merge all the binary data into one record.
The function node should look as follow:
const results = { json: {}, binary: {} }
for (const [index, item] of items.entries()) {
for (const [keyIndex, key] of Object.keys(item.binary).entries()) {
results.binary[`data_${index}_${keyIndex}`] = item.binary[key]
}
}
return [results];
You can also check the example workflow below:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
330,
300
]
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "list",
"limit": 2,
"queryFilters": {
"mimeType": [
{
"mimeType": "custom",
"customMimeType": "application/pdf"
}
],
"name": []
},
"options": {
"fields": [
"*"
]
}
},
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 1,
"position": [
640,
300
],
"credentials": {
"googleDriveOAuth2Api": "asasasas"
}
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "download",
"fileId": "={{$node[\"Google Drive\"].json[\"id\"]}}"
},
"name": "Google Drive1",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 1,
"position": [
910,
300
],
"credentials": {
"googleDriveOAuth2Api": "asasasas"
}
},
{
"parameters": {
"functionCode": "const results = { json: {}, binary: {} }\n\nfor (const [index, item] of items.entries()) {\n for (const [keyIndex, key] of Object.keys(item.binary).entries()) {\n results.binary[`data_${index}_${keyIndex}`] = item.binary[key]\n }\n}\n\nreturn [results];"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1140,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Google Drive": {
"main": [
[
{
"node": "Google Drive1",
"type": "main",
"index": 0
}
]
]
},
"Google Drive1": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
}
}
}