jszip
jszip copied to clipboard
Corrupted zip error when accessing larger zip files
I packaged a 126 MB file (json data) in a 13 MB zip archive. When I try to open it, I am receiving error:
Error: Corrupted zip: missing 3589889 bytes.
at ZipEntries.readEndOfCentral (node_modules\jszip\lib\zipEntries.js:244:19)
at ZipEntries.load (node_modules\jszip\lib\zipEntries.js:256:14)
When I try to open a smaller package (1 KB), then it works. Both packages were created by the same program on the same operating system.
Here is my test code:
import JSZip from 'jszip';
import fs from 'fs';
import path from 'path';
async function main(): Promise<void> {
const jszip = new JSZip();
const data = fs.readFileSync(path.resolve(__dirname, './files/archive.zip'), 'utf8');
const contents = await jszip.loadAsync(data);
contents.forEach((filePath, entry) => console.log(filePath));
}
main().catch(console.error);
Here is the zip file which fails to load: archive.zip
Is there a solution? I met the same problem, but it reported an error when I decompressed 1KB file.😂