How to get binary data from a previously processed node?

Hi everyone, I am currently getting used to the way n8n does things. The one issue I struggle the most is about binary data.

The way I found from documentation is to use getBinaryData() to get binary data in function node. However, it won’t work after any ‘string or json returning’ node. For an example,

Noted that the binary file is not in the output and can’t be used anymore.

The other way I found from the documentation is getBinaryDataBuffer(), but it doesn’t work it seems for the same reason.

And $node["XXX"].binary.keyname doesn’t seem to work, and I am told in the documentation to avoid accessing it like this directly.

Is there anything I am missing here? It seems very weird that I can’t use the binary data anymore after any JSON or String returning node.

Hi @Ronald_Lam, Welcome to the community. You may want to try this function node and see if it does what you are trying to accomplish. My understanding is that is should call all data in the specified node.

Welcome to the community @Ronald_Lam!

Sorry not at the computer right now, so can not post an example. But what you can do is to merge the binary data back in the flow again by using the Merge-Node in mode “Merge by Index”.

Hope that is helpful!

Thank you so much for the replies. I will use a merge node for now.

But I think it’s very common to process data and download multiple binary files at different points within a workflow, and send them all as email attachments in the end etc… so I hope this kind of merge can be implemented and can be used on the setting tab of all nodes directly.

2 Likes