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

Fix ISTEXUnzip #280

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix ISTEXUnzip #280

wants to merge 3 commits into from

Conversation

parmentf
Copy link
Collaborator

@parmentf parmentf commented Dec 1, 2022

It seems that the npm package unzipper is not able to unzip that one file.

See #279.

@parmentf parmentf added bug Something isn't working @ezs/istex Concerns @ezs/istex labels Dec 1, 2022
@parmentf parmentf linked an issue Dec 1, 2022 that may be closed by this pull request
@parmentf
Copy link
Collaborator Author

parmentf commented Dec 2, 2022

yauzl's documentation explains why no standard-compliant unzip library can use a streaming API:

Due to the design of the .zip file format, it's impossible to interpret a .zip file from start to finish (such as from a readable stream) without sacrificing correctness. The Central Directory, which is the authority on the contents of the .zip file, is at the end of a .zip file, not the beginning. A streaming API would need to either buffer the entire .zip file to get to the Central Directory before interpreting anything (defeating the purpose of a streaming interface), or rely on the Local File Headers which are interspersed through the .zip file. However, the Local File Headers are explicitly denounced in the spec as being unreliable copies of the Central Directory, so trusting them would be a violation of the spec.

Any library that offers a streaming unzip API must make one of the above two compromises, which makes the library either dishonest or nonconformant (usually the latter). This library insists on correctness and adherence to the spec, and so does not offer a streaming API.

@parmentf
Copy link
Collaborator Author

parmentf commented Dec 5, 2022

Nicolas suggested to use unzipit in place of unzipper.

Of course, this implies to use temporary files, but would fix that (rare) problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @ezs/istex Concerns @ezs/istex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

One ISTEX-compressed file does not unzip using ISTEXUnzip
1 participant