Hello,
I managed to decompress a zip file containing a dozen of files thanks to a Compression node. The output is only 1 item containing all the files as binary data.
I would like to extract text and filename from each file but I cannot loop on the output, as it is only 1 item !
I saw a closed question with a code node workaround to split 1 list of binary files into several items, but the script does not work any more.
Here is the closed question : Process decompressed files
Here is the old script given as an answer to this question:
let results = ;
for (item of items) {
for (key of Object.keys(item.binary)) {
results.push({
json: {
fileName: item.binary[key].fileName
},
binary: {
data: item.binary[key],
}
});
}
}
Hello @jabbson , I hope all is good for you too!
Thank you for looking into my issue: I realize now that I really need time to understand how to use n8n…
I actually did not try to use the code as I found it.
When I initially copied the code into my node, I saw an error under the “items” variable and altered the code immediately, before even trying.
As the error was “Cannot find name ‘items’. Did you mean ‘item’? “, I put “input.all()” instead of “items” and as it did not work (of course), I tried many other fruitless alterations…