Skip to content

Instantly share code, notes, and snippets.

@cowchimp
Created July 4, 2025 16:04
Show Gist options
  • Save cowchimp/8f70643054b629e6bdfde60aa9ba2434 to your computer and use it in GitHub Desktop.
Save cowchimp/8f70643054b629e6bdfde60aa9ba2434 to your computer and use it in GitHub Desktop.
n8n code node that turns the input json data to a JSONL binary file (single line json object with new line at the end)
const content = $input.item.json.content;
const jsonlString = JSON.stringify(content) + '\n';
const buffer = Buffer.from(jsonlString, 'utf-8');
const binaryData = await this.helpers.prepareBinaryData(
buffer,
'data.jsonl',
'application/jsonl'
);
return {
binary: {
data: binaryData,
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment