just-zip

0.0.2 • Public • Published

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.

/just-zip/

    Package Sidebar

    Install

    npm i just-zip

    Weekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • polomoshnov