Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Single-pass ZIP generation #16

Closed
tanriol opened this issue Aug 24, 2016 · 3 comments
Closed

Single-pass ZIP generation #16

tanriol opened this issue Aug 24, 2016 · 3 comments

Comments

@tanriol
Copy link

tanriol commented Aug 24, 2016

ZipWriter currently expects the underlying stream to be seekable. The seekability is used to update the local file header after the file is complete (and also to determine some offsets).

The ZIP file format specification supports writing an archive in one pass without seeking. This mode may be useful in some cases (for example, streaming a ZIP archive of several large files without generating the archive ahead of time).

Would you be interested in implementing this mode and lifting the seekability requirement?

@mvdnes
Copy link
Collaborator

mvdnes commented Aug 28, 2016

I would love to have this, but lack the time and interest unfortunately.

It should not be to hard, as the only thing to do is to write the sizes and CRC after the data instead of before. The only real issue lies in determining the compressed file size, as that also uses the Seek trait at the moment.

nabijaczleweli added a commit to nabijaczleweli/gen-epub-book.rs that referenced this issue Feb 14, 2017
@gyscos
Copy link

gyscos commented Jun 14, 2019

When writing the file, we can remember how much data was written to compute the compressed size.
When reading, it's probably fine to require the Seek trait as we need to jump between the files and the central directory anyway.

@tanriol
Copy link
Author

tanriol commented Jul 9, 2019

Technically single-pass reading is possible too as most information from the central directory is duplicated in the file headers too, IIRC.

@Plecra Plecra added this to the Release 0.6 milestone Jun 16, 2020
@Plecra Plecra mentioned this issue Jan 23, 2022
@zip-rs zip-rs locked and limited conversation to collaborators Feb 1, 2023
@Plecra Plecra converted this issue into discussion #339 Feb 1, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

5 participants