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

Handle zipfile entry error and forward to onEntryError callback option #49

Closed
wants to merge 3 commits into from

Conversation

kiejo
Copy link

@kiejo kiejo commented Jul 25, 2017

This prevents the node process from crashing in case of a zipfile error.
I also created a test case to ensure it works as expected. The zip file used in the test has an entry with an absolute path, which causes the yauzl library to emit an error, which causes the node process to crash if not handled.

@danrzeppa
Copy link

Why not just call cb passing the error? What's the advantage of having an optional onEntryError callback? Does anyone really want the current behavior of crashing the node process?

@kiejo
Copy link
Author

kiejo commented Feb 21, 2018

I'm sorry for the late response.

Why not just call cb passing the error? What's the advantage of having an optional onEntryError callback?

A zip file can contain many files of which only one or a few files cause a zipfile error. In such a case the overall zip extraction succeeds with only a few files missing from the output. I think that calling the onEntryError for every zipfile error during the extraction is a better solution than signaling a complete failure by calling the cb after the first zipfile error. It allows the user of the library to work with the successfully extracted files and to optionally handle any failed files.

Does anyone really want the current behavior of crashing the node process?

I don't think anyone wants this behavior, which is why I set up an error listener regardless of whether an onEntryError callback is supplied. This prevents the node process from crashing for all users.

@malept
Copy link
Collaborator

malept commented Mar 25, 2020

Closing in favor of #67

@malept malept closed this Mar 25, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants