jszip icon indicating copy to clipboard operation
jszip copied to clipboard

Corrupted zip error when accessing larger zip files

Open bennycode opened this issue 3 years ago • 1 comments

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

bennycode avatar Aug 17 '21 10:08 bennycode

Is there a solution? I met the same problem, but it reported an error when I decompressed 1KB file.😂

zmzimpl avatar Jan 24 '22 07:01 zmzimpl