Closed lekoala closed 2 years ago
Since this is a ZIP file, you need to use the ZIP decompression API. You were trying to decompress with the DEFLATE/GZIP/Zlib API, which is meant for single files, not archives.
const zip = new Uint8Array(result);
const unzipped = fflate.unzipSync(zip);
console.log(unzipped); // This is an object with potentially multiple files
It doesn't seem to work much better
browser.js:211
Uncaught (in promise) Error: invalid zip data
at Gl (browser.js:2512)
as a comparison, it works with JSZip
let zip = await JSZip.loadAsync(result);
Could you upload or send the ZIP that reproduces this? I haven't found any files that work in JSZip and not fflate
.
@101arrowz sent by email
Sorry for the delayed response! I've just tested it and the file works fine on my end, yielding a complete page_0.json
. I suspect the issue is that you might be converting your data into a Uint8Array
incorrectly. Could you supply the surrounding code, all the way from where you first load the data to where you unzip with fflate
?
@101arrowz so.. not sure what happened (i was probably getting a blob instead of an arraybuffer) but it now seems to work! I believe jszip simply detects the type (arraybuffer or blob) and act accordingly
your library is working great :-)
Hi,
I'm using this library to decode a simple zip file in the browser but I get the following issue
I don't seem to do anything special since i'm doing this: (result is an arraybuffer from a fetch call)
uncompressing the file in 7zip works fine. The file is created in php with the ZipArchive class. I didn't test yet with other zip files or with another decoding library.