zip-folder-promise
v1.2.0
Published
Use archiver to zip a folder using promises instead of callbacks
Downloads
7,436
Maintainers
Readme
Use Archiver to zip a folder using promises instead of callbacks.
Install
$ npm install --save zip-folder-promise
Usage
zipFolder(
inputDir: string,
outputFileName: string,
format?: 'tar' | 'zip',
subDirectory?: string
): Promise<string>
Example:
const zipFolderPromise = require('zip-folder-promise');
async function yourAsyncFn() {
try {
// ..
// Using default ZIP format
const zipFolderMsg = await zipFolder('dirName', 'zipName');
console.log(zipFolderMsg);
// Using a subDirectory to wrap your files
const zipFolderMsgSubdirectory = await zipFolder('dirName', 'zipName', 'zip', 'subdirectoryFolder');
console.log(zipFolderMsgSubdirectory);
// Using alternate TAR format
const tarFolderMsg = await zipFolder('dirName', 'tarName', 'tar');
console.log(tarFolderMsg);
// ..
}
catch(err) {
// Handler error
}
}
Author
👤 Ricardo Tribaldos (https://barustudio.com)
- Github: @tribal2
- Twitter: @r_tribaldos
- LinkedIn: @rtribaldos
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2022 Ricardo Tribaldos (https://barustudio.com). This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator