This repository was archived by the owner on Jun 2, 2024. It is now read-only.
Discussion: support for non-seekable reading#37
Merged
mvdnes merged 1 commit intozip-rs:masterfrom Jun 16, 2018
Merged
Conversation
Collaborator
|
Thank you for implementing this! |
|
@mvdnes I would love to use this functionality to be able to unpack a zip file as I'm reading it from a |
Collaborator
|
I have incorporated some of your code into this, and it seems to work for a few examples. |
awaken1ng
pushed a commit
to awaken1ng/zip-rs
that referenced
this pull request
Apr 27, 2024
…s/dependabot/fetch-metadata-2.1.0 ci(deps)(deps): bump dependabot/fetch-metadata from 2.0.0 to 2.1.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I would like to read entries from an un-seekable stream, such as
stdin.This pull request implements this by providing a
read_singlefunction that returns the next entry in the stream, orNoneif we've found the Central Directory, indicating the end of the file.Not all of the metadata is available, as it's not all stored in the local header. This code involves a bit of copy-paste, but not as much as I was expecting. It would be nice to restructure
ZipFileDatasuch that it had the "core" entries (the ones that are available in the local header, as I'm partially exposing asZipEntry), and the extended entries separately.In terms of API.. uh. Java has ZipInputstream, which has an awful API. An archive could provide an iterator over entries, for non-seekable readers?
I also don't know what to do about discrepancies between the Central Directory and what the iterator has already returned, when using this API. Perhaps the
read_singleentry could return the contents of the Central Directory when it's encountered, to allow users to work out whether they've seen deleted, or otherwise invalid entries? An iterator could validate this at the end, andErr()or something.zip64 is a mess, but it's currently not supported by the other code.