Help needed to include 4 files/binary into one zip-file

Describe the problem/error/question

I want to create a zip file with the binary input of 4 different nodes (acutall workflow).
I tried different ways like with merge nodes and list item nodes and code nodes, but I’m struggling everytime.
What does the actuall workflow do:
Webhook input contains 1 binary and 2 Google Drive File-IDs
Step 1: binary (png) is uploaded to Drive folder XYZ
Step 2+3: Download 2 Google Drive File-IDs (from a other Folder) and upload to folder XYZ
Step 4: binary (png) from webhook is converted to jpg and uploaded to folder XYZ
Missing: include all files from step 1-4 to one zip file.

I would be very happy to get this workflow solved :slight_smile:

Information on your n8n setup

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

Hi @RoP
this can be achieved with a mix of Merge and Item Lists nodes.

First, use the merge nodes to have all the binary files as separate output items of a Merge node.
Second, use Concatenate Items of the Item Lists node, with the option Include Binaries ON.
Then, you can use the Compress node, adding all the field names in the Binary Property parameter.

It is probably clearer if you check this demo workflow:

Let me know if that helps!
All the best

1 Like

Hi @giulioandreini ,
thanks a lot for your fast reply!

For the input of the compression-node I get 6 binarys instead of expected 4.

That’s fine for me, IF the names of the binarys will be exact the same in the future.
Because I need these ones: 0,data,data_1,0_3 (0_3 is a jpg, I have to be sure, that this jpg always will be 0_3)

Best
Ronald

Hi @RoP
a couple of suggestions.

  1. If you get more files than expected, try to change how the nodes are plugged, see an example here:
  1. If you don’t want to hardcode the number and name of the files in the Compression node you can use this expression in the Binary Property parameter:
    {{ Object.keys($binary).join(',') }}
    this will write something like data,data_1,data_2,data_3 for you

Best

I changed the way how the nodes are plugged, but still the same.
So I take it like it is…
Hardcoded is fine for me :slight_smile:

Thanks a lot!
Best
Ronald

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