JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4940
  • Score
    100M100P100Q142032F
  • License BSD

Easy zip is extend from jszip,run in the nodejs.

Package Exports

  • easy-zip

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (easy-zip) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Easy zip is extend from jszip,and run in the nodejs.

Installation

$ npm install easy-zip

Examples

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

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

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

//add file
var zip3 = new EasyZip();
zip3.addFile('main.js','easyzip.js',function(){
    zip3.writeToFile('file.zip');
});

//batch add files
var files = [
    {source : 'easyzip.js',target:'easyzip.js'},
    {target : 'img'},//if source is null,means make a folder
    {source : 'jszip.js',target:'lib/tmp.js'}
];
var zip4 = new EasyZip();
zip4.batchAdd(files,function(){
    zip4.writeToFile('batchadd.zip');
});

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

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

//write to file sync 
//zip.writeToFileSycn(filePath);

License

BSD