antelle / node-stream-zip

node.js library for fast reading of large ZIPs
Other
447 stars 63 forks source link

[Feature Request] ReadStream for input #97

Open guoyunhe opened 1 year ago

guoyunhe commented 1 year ago

Thanks for the package! It is really helpful.

In my project, I download a large zip file and then unzip it. Currently, I have to first save the zip on disk and then use node-stream-zip to extract it, because node-stream-zip only supports file path as input, not stream. This will write extra data to disk that actually not needed.

Preferred way could be, node-stream-zip can be chained with the download stream, like:

download().pipe(new StreamZip())

This will save disk space and time on disk I/O.

cinderblock commented 1 year ago

While I would love this too, I think it is not possible.

To simplify, as I understand it, the zip format stores important metadata at the end of the file. Therefore, you need to download the whole file before you can process it. This means it requires some more significant storage which isn't compatible with the streaming API.

pauldraper commented 1 year ago

Correct, this request doesn't make sense with the ZIP format. Writing a stream makes sense, but reading a stream does not.