Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error "too many length or distance symbols" #242

Open
ChrisZieba opened this issue Jul 10, 2021 · 1 comment
Open

Getting error "too many length or distance symbols" #242

ChrisZieba opened this issue Jul 10, 2021 · 1 comment

Comments

@ChrisZieba
Copy link

ChrisZieba commented Jul 10, 2021

Based on some of the tickets I've seen, extracting a nested zip is possible, but I'm running into this error when attempting:

    Error: too many length or distance symbols
        at Zlib.zlibOnError [as onerror] (zlib.js:168:17)

Here is the parent zip: https://nces.ed.gov/ccd/Data/zip/ccd_sch_052_1718_l_1a_083118.zip. It contains two nested zip structures.

I try to pass the buffer directly to zipper.Open.buffer but that's where I get the error when processing the stream after.

    const buffer = (
      await axios.get(
        'https://nces.ed.gov/ccd/Data/zip/ccd_sch_052_1718_l_1a_083118.zip',
        { responseType: 'arraybuffer' },
      )
    ).data;
    const directory = await unzipper.Open.buffer(buffer);

    const nestedZip = directory.files.find(file =>
      file.path.endsWith('CSV.zip'),
    );

    const innerZip = await unzipper.Open.buffer(await nestedZip.buffer());
    const stream = innerZip.files[0].stream();

   // Do something with inner zip stream ...

Is this not a supported way to extract the nested structure currently? I have also tried parsing the parent, writing the nested zip to disk, and then attempting an unzip that way, but I run into the same issue. Any ideas?

@dobesv
Copy link

dobesv commented Jul 14, 2021

What if you manually extract the outer ZIP from the command line or something and try to use unzipper to read the inner ZIP?

The fact that the ZIP file comes from another ZIP file shouldn't make any difference, as you never told the unzipper that it originally got that buffer from another unzipper.

Maybe it's just something about the inner ZIP file that is causing problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants