Ziptool
A simple tool to zip and unzip from the command line or from your code.
Requirements
- Node.js https://nodejs.org
Installation
Ziptool can be installed globally: npm install ziptool -g
or locally into your npm project: npm install ziptool --save
Usage
-
## CLI ### Globally installed Ziptool can be used directly from the command line to zip/unzip files:
# Zip file-1.txt and file-2.png into a new zip archive 'zip-archive':ziptool --zip file-1.txt file-2.png -o zip-archive.zip# Extract the files from my-archive.zip into the directory 'my-directory':ziptool --unzip my-archive.zip -o zip-archive.zipFor more information, run the command:
ziptool --help
### Locally installed If ziptool is installed locally, you need to replace the 'ziptool' command by
node node_modules/ziptool/bin/ziptool
or by adding scripts into your package.json file:"scripts":"ziptool": "ziptool" -
## Code ## Example Ziptool's api is also available to use in your Node.js javascript files, simply require it:
const ziptool = ;You can also require only the functions you need:
const zip = ;## References
-
VERSION: constant
/*** Current ziptool's version.* @const*/Example:
console; // Will print the package's version you are using -
zip (src, dest, callback): function
/*** Create a zip archive from one or multiple files.* @param* @param* @param* been created or if an error occured.*/Example:
; -
unzip (src, dest, callback): function
/*** Extract a zip archive to a specified location.* @param* @param* @param* been extracted or if an error occured.*/Example:
;
-