0

I'm noticing a strange behavior while using this library. I'm trying to compress multiple EML files, to do so I first convert them to buffers and add them to adm-zip instance using the addFile() method. Here's my code:

    const zip = new AdmZip();
    assetBodies.forEach((body) => {
      // emlData to buffer
      let emlBuffer = Buffer.from(body);
      zip.addFile(`${new Date().getTime()}.eml`, emlBuffer);
    });
    zip.getEntries().forEach((entry) => {
      console.log("entry name", entry.entryName);
    });
    const willSendthis = zip.toBuffer();

The problem is that sometimes it compresses all the files and sometimes it doesn't.

For example, I received 5 items in the assetBodies array, but when I log the entries of the zip file I only see 1 or 2, sometimes 5.

Am I missing something or there's an issue with the library?

EDIT:

It's worth mentioning that some of the files are quite large in terms of text so I wonder if that could be the issue

osmodiar16
  • 31
  • 5

0 Answers0