node-unzipper icon indicating copy to clipboard operation
node-unzipper copied to clipboard

Open methods - only stream up to length

Open ZJONSSON opened this issue 2 years ago • 2 comments

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 avatar Apr 28 '24 15:04 ZJONSSON

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

ZJONSSON avatar Apr 28 '24 15:04 ZJONSSON

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.

jpambrun avatar Apr 28 '24 18:04 jpambrun

published as + [email protected]

ZJONSSON avatar May 04 '24 19:05 ZJONSSON

This change severely breaks things - see #311

jribbens avatar May 07 '24 09:05 jribbens