npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-zip2

v3.1.0

Published

A fork of npm module easy-zip

Downloads

489

Readme

easy-zip2

A fork of npm module easy-zip

  • Uses nodebuffer instead of base64 to get better speed
  • JSZip version 3.1.3
  • Supports zip streams for handdling big zip files.

Installation

npm install --save easy-zip2

Examples

var EasyZip = require('easy-zip2').EasyZip;

// add text
console.log("add text");
var zip = new EasyZip();
zip.file('hello.txt', 'Hello World!');
zip.writeToFile('text.zip'); //write zip data to disk

// add folder
console.log("add folder");
var zip2 = new EasyZip();
var jsFolder = zip2.folder('js');
jsFolder.file('hello.js', 'alert("hello world")');
zip2.writeToFile('folder.zip');

// add file
console.log("add file");
var zip3 = new EasyZip();
zip3.addFile('main.js', 'easy-zip.js', function() {
    zip3.writeToFile('file.zip');
});

// batch add files
console.log("batch add files");
var files = [{
        source: 'easy-zip.js',
        target: 'easy-zip.js'
    }, {
        target: 'img'
    }, // if source is null, means make a folder
    {
        source: 'jszip.js',
        target: 'lib/tmp.js'
    }  // ignore missing source files
];
var zip4 = new EasyZip();
zip4.batchAdd(files, {
    ignore_missing: true
}, function() {
    zip4.writeToFile('batchadd.zip');
});

// zip a folder
console.log("zip a folder");
var zip5 = new EasyZip();
zip5.zipFolder('../easy-zip2', function() {
    zip5.writeToFile('folderall.zip');
});

// zip a folder and change folder destination name
console.log("zip a folder and change folder destination name");
var zip6 = new EasyZip();
zip6.zipFolder('../easy-zip2', {
    rootFolder: 'easy-zip6'
}, function() {
    zip6.writeToFile('folderall.zip');
});


// zip with Stream
// use for zip a lot files or big file
console.log("zip with Stream");
var zip7 = new EasyZip();
var files = [{
        source: 'easy-zip.js',
        target: 'files-1.js'
    },{
        source: 'easy-zip.js',
        target: 'files-2.js'
    },{
        source: 'easy-zip.js',
        target: 'files-3.js'
    },{
        source: 'easy-zip.js',
        target: 'files-4.js'
    },{
        source: 'easy-zip.js',
        target: 'files-5.js'
    }
];
zip7.batchAdd(files, function() {
    zip7.writeToFileStream('stream.zip', function(metadata) {
        console.log(metadata);
    }, function() {
        console.log("stream.zip is finished");
    });
});

// write data to http.Response
//zip.writeToResponse(response,'attachment.zip');

License

MIT License