Jszip: Recommended way to add a blob (image e.g.) to a zip in a browser

Created on 10 Dec 2015  路  2Comments  路  Source: Stuk/jszip

It seems blobs are not supported directly. Any suggestions on the most efficient conversion to perform before adding a blob to a zip?

(I've tried a FileReader() with readAsDataURL(blob) but it results in a corrupted file in the zip, and I'm also guessing this conversion may not be the most efficient).

Most helpful comment

JSZip v3.0.0 now supports blob as file content. zip.file("image.png", blob); will work.

All 2 comments

FileReader.readAsArrayBuffer() seems to provide good results. So no issue for me any more.

I think it would be helpful to add an example on how to add a blob to a zip. Super useful tool!

JSZip v3.0.0 now supports blob as file content. zip.file("image.png", blob); will work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zizizi17 picture zizizi17  路  6Comments

sriramkp picture sriramkp  路  6Comments

davejack1 picture davejack1  路  4Comments

maordany picture maordany  路  4Comments

jimmywarting picture jimmywarting  路  4Comments