Hi,
How could I get the size of each files inside a zip after a.load?
Sorry, I was sure I added a comment some days ago...
You can't with the current version. This information is stored in _data.compressedSize (like in zip.file("...")._data.compressedSize) but this is not a public API and it can/will change without notice.
It sounds interesting, we should maybe add a way to extract cleanly these informations.
For now I compute the size based on the base64 data (base64.length * 0.75). It's seems right but I find that a bit hacky.
Thanks for the answer and your work.
zip.file("...")._data.compressedSize is no longer accessible with the latest version. Is there any other way to access the size of the file in browser memory?
One way is to use the forEach method JSZip#forEach(callback)
like:
let size = 0;
zip.forEach((file) => size += file ? 1 : 0);
Most helpful comment
Sorry, I was sure I added a comment some days ago...
You can't with the current version. This information is stored in _data.compressedSize (like in
zip.file("...")._data.compressedSize) but this is not a public API and it can/will change without notice.It sounds interesting, we should maybe add a way to extract cleanly these informations.