I’ve already go it … promise does not seem to work, but await does …
let data = item;
const results = [];
const simpleParser = require('mailparser').simpleParser;
let parsed = await simpleParser(data, 'skipImageLinks');
let items = parsed;
let att = (items.attachments).length
results.push({
'From': items.from.value[0].address,
'To': items.to.value[0].address,
'Subject': items.subject,
'Text': items.text,
'HTML': items.html,
'messageId': items.messageId,
'Date': items.date
});
for (att in items.attachments) {
results.push({
attachement: Buffer.from(items.attachments[(att)].content).toString('base64'),
filename: items.attachments[(att)].filename
});
}
return results;
BTW: I brought the processing time down by 25%, so I’m now concluding that most of the work actually takes place in the simpleParser (function) node and the transfer of data between nodes is actually not the biggest bottle neck … as long as you set Save execution progress in Settings to Default - No