1.0.3 • Published 1 year ago

async-zip-parser v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

async-zip-parser

This package was created for my use case that couldn't be handled by node-unzipper because of a bug in node v18 and higher with the Parse function and async iterators.

The bug was that the function threw the following error: ERR_STREAM_PREMATURE_CLOSE: Premature close

When the Parse function was used with async iterators, in my edited version of the code the bug doesn't exist.

Most of the code is copied from node-unzipper but I made some optimizations and updates according to my needs.

Usage

const zip = fs.createReadStream('input.zip').pipe(asyncZipParser.ParseZip());
for await (const entry of zip) {
  const fileName = entry.path;
  const type = entry.type;
  const size = entry.vars.uncompressedSize;
  entry.pipe(fs.createWriteStream(`output/${fileName}`));
}
1.0.2

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago