node-stream-zip icon indicating copy to clipboard operation
node-stream-zip copied to clipboard

[Feature Request] ReadStream for input

Open guoyunhe opened this issue 2 years ago • 2 comments

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.

guoyunhe avatar Jan 26 '23 07:01 guoyunhe

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.

cinderblock avatar Feb 13 '23 08:02 cinderblock

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

pauldraper avatar Apr 09 '23 23:04 pauldraper