-
Notifications
You must be signed in to change notification settings - Fork 36
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
Seek bound on W in ZipWriter<W> seems overly restrictive? #32
Comments
Not all decompression software will correctly handle a ZIP-file entry whose size, compressed size and checksum aren't known at the time the entry's local-file header is transmitted. Therefore, supporting stream output when it isn't at least possible to buffer and flush the individual compressed files will mean a separate ZipWriter type and so on. I'll try to implement this, but it'll probably take a while. |
Just to clarify, I think you're saying that we need to know things like compressed size up front, which means compressing the file to somewhere. Presumably what happens at the moment is space is left for the header, then compression happens and is appended and then it seeks back to the header and fills in the information it now knows: sizes, checksum etc. Right? I wonder what tools like Thanks for looking into this. |
What Per https://github.com/Pr0methean/zip/blob/ffa7772cc362049308193e133744a0120092f0c2/src/read.rs#L1239, the |
I think the only solution will be to give |
In case it's useful at all, an implementation of this was submitted for |
I don't quite understand the current discussion but is this comment still accurate? https://github.com/ofek/pyapp/blob/fc356202f49cb79f5e92294e4ed29d33b50442b0/src/distribution.rs#L217-L225 Essentially, there is an option to embed an archive inside the binary itself but I must save to a temporary file in order to extract. Is it possible to directly extract now given a stream? |
Extracting without |
It appears that the
W
inZipWriter<W>
must always beWrite + Seek
. This means that for example, one can't write the zip tostdout
.It seems that
Seek
should only be required on the methods that actually make use of the functionality. As far as I understand, it should be perfectly possible to not haveSeek
if we're not doing anything exotic. In my use-case, I just want to add a set of files sequentially and then I'm done.A poor work-around is to use a temporary file or a buffer and write to that, but that obviously wastes space/memory and makes the process non-streaming.
I'm not too privy to zip internals so correct me if I'm wrong. I'm pretty sure that
zip
program on Linux can write to stdout just by passing-
as an argument. You can then send the data over the network directly without an intermediate, so presumably it's possible for the simple case.The text was updated successfully, but these errors were encountered: