0.0.2 • Published 9 years ago

just-zip v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Just Zip

by Alexander Polomoshnov

released under the MIT license

Just Zip both files and directories with ease.

Install

npm install just-zip

Examples

zip = require('just-zip')

filePath = 'C:\\Users\\Polomoshnov\\test.pdf'
filePath2 = '../lorem ipsum.txt'
dirPath = '../pdfs'
customZipFilePath = 'C:\\Users\\Polomoshnov\\files.zip'

zip(filePath, function (err, zipFilePath) {
	if (err) return console.error('Failed to zip:', err)
	console.log('Zipped one file into', zipFilePath)
})

zip([filePath, filePath2], function (err, zipFilePath) {
	if (err) return console.error('Failed to zip:', err)
	console.log('Zipped two files into', zipFilePath)
})

zip([filePath, filePath2, dirPath], function (err, zipFilePath) {
	if (err) return console.error('Failed to zip:', err)
	console.log('Zipped two files and one directory into', zipFilePath)
})

zip([filePath, filePath2, dirPath], customZipFilePath, function (err, zipFilePath) {
	if (err) return console.error('Failed to zip:', err)
	console.log('Zipped two files and one directory into', zipFilePath)
})

Acknowledgment

Just Zip is built upon node-archiver.