Add ReadStream support for .zip-files (uncompressed or deflate) to node
npm install node-zip-streamerThis is the implementation of a very simple ZipStreamReader. Whenever you are facing the situation to read multiple files from a given zip file this simple stream will help you.
Now with ZIP64 support.
npm i node-zip-streamer`Usage
A simple example might be:
`typescript
import { ZipFileReadStream } from 'node-zip-streamer';
...
try {
const zipStream = new ZipFileReadStream('some-file.zip');
zipStream.on('data', file => {
console.log(File ${file.metaInfo.fileName} has content '${file.content.toString()}'.);
});
zipStream.on('end', () => {
console.log('Reading finished');
});
} catch (err) {
console.error(err);
}// You might want to prefilter the files (new in 1.0.4)
// via RegEx...
const zipStream = new ZipFileReadStream(
'some-file.zip',
{ filter: /by-regex/ }
);
// via exact file name...
const zipStream = new ZipFileReadStream(
'some-file.zip',
{ filter: 'exact-match.txt' }
);
// via your own custom function (should return boolean true to mark a match)...
const zipStream = new ZipFileReadStream(
'some-file.zip',
{ filter: (fileName) => fileName.startsWith('a') }
);
``