Hi @hermanmaleiane , the file data is stored in memory, thus you need to use the .data field from the attachment. Then you convert it into a stream.
first, you need to enable the ‘stream’ module by running the next command in your console and restart n8n instance
export NODE_FUNCTION_ALLOW_BUILTIN=stream
then you apply this code in the Function item node, don’t forget to add the email parsing part
const { Readable } = require('stream');
// retrieve the base64 encoded data (from the attachment)
const data = getBinaryData().attachment_0.data;
// convert it into a buffer
const buff = new Buffer(data, 'base64');
// create a stream
const stream = Readable.from(buff.toString());
/*
Your code to parse the email using email_parser
*/
console.log(stream);
return item;
Thank you @dali.
I really appreciate your help. I think I’m close.
Sorry for bothering you again.
I’m don’t have experience with nodejs.
I’m getting this error:
@hermanmaleiane would you mind sharing this workflow with me? I’m also looking a parsing information from eml files. Thanks in advance and best regards - Dick