async-zip-parser

1.0.3 • Public • Published

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}`));
}

Readme

Keywords

none

Package Sidebar

Install

npm i async-zip-parser

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

11.1 kB

Total Files

7

Last publish

Collaborators

  • mikael-kolehmainen