jszip
jszip copied to clipboard
RangeError: Array buffer allocation failed
when I compress a large number of images,Less pictures won't appear
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