Hello I’m using IMAP Email and Write Binary File nodes to save attachments from email on disk. How can I deal with more than one attachment?
Hey @N8N_userN,
Welcome to the community
Connect the Function node to the IMAP node, and use the following code snippet:
return Object.keys(items[0].binary).map(key => {
return {
json: {},
binary: {
data: items[0].binary[key],
}
}
});
This function will split the binary data, and return each file as an individual item.
Hello! TY for welcome and answer!
Code works fine, but if I connecting to Function node Telegram node, I receiving double messages for each file.
Not problem for me, to connect Telegram to another node. But did it mean, that files writing on disk two times?
Guess the solution is to connect the Telegram-Node directly to the Switch-Node so it will just run 1x.
Nope.
As I noticed:
Not problem for me, to connect Telegram to another node.
But did it mean, that files writing on disk two times?
If you have two items coming into the ‘write binary file’ node it should execute twice, once for each item (i.e. file). So you shouldn’t be writing individual files two times (unless both items contain the same filename)
Thank you. Just confused Telegram node