GithubHelp home page GithubHelp logo

isabella232 / node-zipstream Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apla/node-zipstream

0.0 0.0 0.0 118 KB

Creates ZIP output streams for Node.JS

License: MIT License

JavaScript 100.00%

node-zipstream's Introduction

zipstream

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

This version could use some proper testing. Give me a bump if you experience problems.

Written by Antoine van Wel (website).

Install

    npm install zipstream

API

    createZip(options)

Creates a ZipStream object. Options are passed to Zlib.

    ZipStream.addFile(inputStream, options, callback)

Adds a File, String or Buffer to the ZIP stream. At his moment, options must contain "name". If the "store" option is set to true, the file will be added uncompressed.

    ZipStream.finalize(callback(bytes written))

Finalizes the ZIP. When everything is done, callback is called with the total number of bytes in the ZIP archive.

Example

    var zipstream = require('zipstream');
    var fs = require('fs');

    var out = fs.createWriteStream('out.zip');
    var zip = zipstream.createZip({ level: 1 });

    zip.pipe(out);

    zip.addFile(fs.createReadStream('README.md'), { name: 'README.md' }, function() {
      zip.addFile(fs.createReadStream('example.js'), { name: 'example.js' }, function() {
        zip.finalize(function(written) { console.log(written + ' total bytes written'); });
      });
    });

node-zipstream's People

Contributors

apla avatar dcolens avatar dmmalam avatar egirshov avatar papandreou avatar wellawel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.