Unzip node -> write to disk, how do i deal with multiple files in the ZIP archive?

I have a workflow where i unzip archives and want to write them to disk, the problem is:
the unzip has one binary coming in (zip archive from drive) and in this case creating 2 binary files out with the prefix “file”, file0 & file1 that i can view and download.

Now in the next step i want to write the two binary files to drive but having a hard time to figure out how to use the proper expression to get a dynamic flow of several files. If i use the identifier file0 in the expression i need to create some kind of loop i suspect?
the schema dont contain any binary datapoint to drag in the write node, i also tried {{ $(‘unzip_jobfile’).params[“binaryPropertyName”] }} to no avail. i tried to ask the AI in docker but it just tell me to use a loop but there must be a way to catch all binary outputs from zip extract with an expression?

{
  "errorMessage": "The item has no binary field '' [item 0]",
  "errorDescription": "Check that the parameter where you specified the input binary field name is correct, and that it matches a field in the binary input",
  "errorDetails": {},
  "n8nDetails": {
    "nodeName": "write_unzipped_files_to_dir",
    "nodeType": "n8n-nodes-base.readWriteFile",
    "nodeVersion": 1,
    "operation": "write",
    "itemIndex": 0,
    "time": "30/06/2024, 20:55:14",
    "n8nVersion": "1.47.1 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "NodeOperationError: The item has no binary field '' [item 0]",
      "    at assertBinaryData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/NodeExecuteFunctions.ts:1075:9)",
      "    at Object.assertBinaryData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/NodeExecuteFunctions.ts:3826:6)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/Files/ReadWriteFile/actions/write.operation.ts:77:36)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/Files/ReadWriteFile/ReadWriteFile.node.ts:68:37)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1379:31)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1059:42",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1763:11"
    ]
  }
}

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @E_B
you could try to append this Code node after “unzip_jobfile”
This should split the files into different items so you should be able to treat the separately with the normal iteration mechanism of n8n

Let me know if this helps

2 Likes

This is inspired by this: Split Out Binary Data | n8n workflow template

Thanks @giulioandreini

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.