ZJONSSON / node-unzipper

node.js cross-platform unzip using streams
Other
424 stars 114 forks source link

Open methods - only stream up to length #310

Closed ZJONSSON closed 2 months ago

ZJONSSON commented 2 months ago

The stream method under the Open method did not utilize the fact that we know the size of the individual compressed file and, therefore, can avoid having the stream unbounded, reducing I/O.

Each entry comprises the local file header followed by the compressed file content. The size of the local header is dynamic; the base variables are 30 bytes, but then we have a dynamically sized filename and extra field. For some reason, I have to add a small buffer on top (a few bytes) to get all test cases passing.

Local file header (source Wikipedia) image

Thanks to @jpambrun for catching this. Closes https://github.com/ZJONSSON/node-unzipper/issues/308

ZJONSSON commented 2 months ago

@jpambrun can you check this out confirm whether this solution works

jpambrun commented 2 months ago

Yes, this branch works in my current project and minimal example in https://github.com/ZJONSSON/node-unzipper/issues/309.

This is not exaustive testing by any means.

ZJONSSON commented 2 months ago

published as + unzipper@0.11.5

jribbens commented 1 month ago

This change severely breaks things - see #311