jszip icon indicating copy to clipboard operation
jszip copied to clipboard

RangeError: Array buffer allocation failed

Open Julycc41 opened this issue 4 years ago • 1 comments

when I compress a large number of images,Less pictures won't appear

Julycc41 avatar Jul 28 '21 07:07 Julycc41

If you want to add a large number of images/files at all, you have to have 3x size of compressed files and sadness is that you have to have that in your RAM. In my case, downloading files from Amazon and saving as a zip files created on the fronted side the solution is:

await zip.generateInternalStream({
          type: 'blob',
          compression: 'DEFLATE',
          compressionOptions: {
            level: 8
          },
          streamFiles: true
        })
        .on('data', (data: any, metadata: any) => writer.write(data))
        .on('end', () => writer.close())
        .resume();

But won't work on the FIrefox- maybe because of partial stream support.

I think there is no workaround for the standard

zip.generateAsync 

konraddzbik avatar Aug 02 '21 19:08 konraddzbik