Move binary data for all the items in the array

Describe the problem/error/question

seems move binary data only move the first item of the array, is that possible to make it move for all the items in the array ?

image

What is the error message (if any)?

none

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

Hey @marvinwu,
That look interessting. I would assume that you’ll get 81 binary datas after moving from JSON to Data actually.

This is how it should look like.

Question: What do you want to achieve. One binary with all 81 items inside? or 81 files?

If you want 1 file containing all the items then you need to convert them before to one item with a list inside. You can achieve this with the code node:

const returnList = [];

$input.all().map(item => item.json).forEach(item => returnList.push(item));

return {
  list: returnList
};

Demo showing that 2 input items generate two output items.

If you still need help, consider posting your workflow. Then it is possible for us to tke a deep dive into your configuration.

Cheers.

1 Like

thanks much @nico-kow, appreciate the help.

Question: What do you want to achieve. One binary with all 81 items inside? or 81 files?
i want 81 files

the intend of the workflow is to grep all files of a repo and post it to airtable ( as a content pipeline )

will give a try of the code.

Hey @marvinwu
If you just want to pass the files to airtable (as files) then the code is not the thing you are looking for. It merges all data.

What kind of files are in the repo?

I’ll try to give you an example workflow when I’m in the office later.

Hey @marvinwu,
I gave it a try. I created this repo: GitHub - nico-kow/test-n8n: Try to get some files
It contains two json files.

I saw that the github node has a switch to get binary data directly. Then I just realised that you might not want to convert from json to binary, but to do the opposite way. Thatswhy it is necessary to explain your usecase in detail.

Then I got the same behaviour.
image

I found that the github node is just returning one binary file instead of two. But it returns metadata for both files. This seems like a bug for me.

Here you see that there is only one binary:

And here is the JSON Metadata:

As I said this seems to be a bug in my opinion.

What you can do instead is a loop before the github node, so that it downloads only one file, then transform this one file to json and after the loop you have your data.


Here is the output data

This should solve your problem.

Cheers.

Workflow:

3 Likes

@nico-kow super big thank you, appreciate you went all the extra miles to figure it out:

in summary:

I think you are right, it indeed look like a bug

currently i used your solution of looping to duct-tape the problem, i haven’t figure out how to reports bugs to n8n teams yet

on the side node, the github node seems quite problematic, it have one more bug, it crashes when the file name contains “?”.

1 Like

Hi @marvinwu, thanks for reporting this and thanks so much @nico-kow for sharing a possible workaround. I’ll add these bugs to our internal bug tracker for a closer look and fix.

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