zipstream

Creates ZIP output streams.

5 个版本
安装
npm install zipstream
yarn add zipstream
pnpm add zipstream
bun add zipstream
README

zipstream

Creates ZIP output streams. Depends on Node's build-in zlib module for compression.

Beware, this version is still under development. Basic functionality is in place but has not been tested in production.

Written by Antoine van Wel (website).

API

    createZip(options)  

Creates a ZipStream object. Options are passed to Zlib.

    ZipStream.addEntry(inputStream, features, callback)

Adds an entry to the ZIP stream. Features may contain "name" (mandatory).

    ZipStream.finalize()

Finalizes the ZIP.

Example

     var zipstream = require('zipstream');
     var fs = require('fs');
    
     var out = fs.createWriteStream('out.zip');
     var zip = zipstream.createZip({ level: 1 });
    
     zip.on('data', function(data) { out.write(data); });
    
     zip.addEntry(fs.createReadStream('README.md'), { name: 'README.md' }, function() {
       zip.addEntry(fs.createReadStream('example.js'), { name: 'example.js' }, function() {
         zip.finalize();
       });
     });
版本列表
0.2.1 2012-03-11
0.2.0 2012-01-29
0.1.0 2012-01-26
0.0.3 2011-12-25
0.0.2 2011-12-25