-
Notifications
You must be signed in to change notification settings - Fork 80
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
Can't unzip .zip files created by OS X 10.12's native zipper #63
Comments
Thanks for the report. i'll take a look and get back to you. |
I'm getting this same error on a file created with command line |
Tried zipping using BetterZip. Different error:
So nothing works for me yet. The weird thing is, this error is being thrown and it's not coming through the callback. AFAIK, Side note: is there no easy way to just unzip and write the files to a folder? Without having to mess with streams, |
I tried with a few of the other node.js libs namely
If you don't want streaming (i.e. an entire 1gb file would have to load into memory) then adm-zip is probably the most loved and respected. If you need browser support too then |
I went with one called |
I am unable to reproduce your issue. The zipfile you linked seems to parse just fine for me. I can explain what that particular error means, but it doesn't seem to be relevant to your zipfile. Also, I believe
Here's a fairly harmless looking way to create a zipfile using Info-ZIP (which is the
My experimentation confirms my theory that |
Here's me showing it fail in about 72 seconds: https://youtu.be/0rKj9TZkPD4 Here are my versions:
|
Just updated to latest node, npm, and retried after aj@bowie /p/t/yauzl-test> npm install --save yauzl
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
added 4 packages in 4.303s aj@bowie /p/t/yauzl-test> node test.js
/private/tmp/yauzl-test/test.js:28
throw err;
^
Error: extra field length exceeds extra field buffer size
at /private/tmp/yauzl-test/node_modules/yauzl/index.js:305:83
at /private/tmp/yauzl-test/node_modules/yauzl/index.js:618:5
at /private/tmp/yauzl-test/node_modules/fd-slicer/index.js:32:7
at FSReqWrap.wrapper [as oncomplete] (fs.js:660:17) aj@bowie /p/t/yauzl-test> node --version
v8.8.1
aj@bowie /p/t/yauzl-test> npm --version
5.4.2 I also tried |
Ah. Sorry about that. I was so focused on the zip file that I completely neglected to look at your sample code. My bad. I am able to reproduce the issue now. The video helped! The problem is that you're using both This is such a easy mistake to make that I'm adding a check for it to throw an exception rather than this "undefined behavior". This change should make this pitfall much more friendly to navigate. Here's an example of what you get with this change:
And just for reference, the |
Thank you very much. I can confirm that several files that threw errors before now parse as expected... I'm not sure how I didn't add the |
Error
On Mac OS X 10.12.6 the native zip utility (right-click "compress folder") creates a zip file that gives this error:
Not that I don't believe it's possible for Apple to make a mistake, but my guess is that the underlying zip utility is probably the same Unix / Darwin zip that has been in use for a very long time and that it's statistically more likely to be a problem with this library.
For reference, here is the failing zip file (just a couple of test files for a website):
Example Zip File
I've attached fails-to-parse.zip for the test case.
The contents are as follows:
I have also zipped files that do unzip just fine. My guess is that there's some sort of off-by-one byte alignment issue.
Test Case
And a test case (based on the example):
test.js
:The text was updated successfully, but these errors were encountered: