0.0.9 • Published 7 years ago

smart-zip v0.0.9

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

smart-zip

You can zip and unzip files, when you zip you can pass a regular expression to exclude files from zip, each file matched at regex will not be inserted at zip file.
You can choose create top folder or not with the parameter.

Work on windows and ios (not tested on linux but i believe it's work to).



Usage

npm install smart-zip

Generate zip without top folder

var smartZip = require("smart-zip");

// Use to don't put files into .zip, each match won't be inserted into .zip
var regexExcludes = ['index.html'];

// Generate zip without top folder
smartZip.zip('app\\', 'zip.zip', false, regexExcludes, function (error) {
	if (error) {
		throw error;
	}
	console.log('zip file created without top folder.');
});

Generate zip with top folder

var smartZip = require("smart-zip");

// Use to don't put files into .zip, each match won't be inserted into .zip
var regexExcludes = ['index.html'];

// Generate zip with top folder
smartZip.zip('app\\', 'zipTopLevel.zip', true, regexExcludes, function (error) {
	if (error) {
		throw error;
	}
	console.log('zip file created with top folder.');
});

Unzip the files

var smartZip = require("smart-zip");

// Unzip the files
smartZip.unzip("app1.zip", "app1", function (error) {
	if (error) {
		throw error;
	}
	console.log('File unziped.');
});

Unzip from stream

var smartZip = require("smart-zip");
var fs = require("fs");

// Unzip from stream
var zipFileStream = fs.createReadStream('app1.zip');
smartZip.unzipFromStream(zipFileStream, "app1Stream", function (error) {
	if (error) {
		throw error;
	}
	console.log('Stream unziped.');
});

News

  • 0.0.8 Added support to unzip from stream.
  • 0.0.9 Added support to ignore folders as well.

Thanks

0.0.9

7 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago