Describe the problem/error/question
I’m using the Code node and have successfully used this.helpers.getBinaryDataBuffer(0, ‘data’); to read binary data from a previous file read node, then process it into a “buffer” variable.
I can’t find a way to return the “buffer” as a file from the code node.
Using prepareBinaryData gives an “ERROR: body.once is not a function [line 15]” error; is this the right way to do it?
await this.helpers.prepareBinaryData(
buffer,
'test',
);
If not, can we confirm how to return “buffer” as a downloadable file? I’ve tried this, it returns stuff in the Output pane, but it seems to be doing it bit by bit… guess I need to read the whole buffer into something first:
return {json: {}, binary:buffer};
Information on your n8n setup
- n8n version: Latest
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Linux