extract-zip
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@types/yauzl | 2.10.3 | 2.35 kB | MIT | prod optional | |
debug | 4.3.4 | 12.94 kB | MIT | prod | |
get-stream | 5.2.0 | 4.25 kB | MIT | prod | |
yauzl | 2.10.0 | 18.26 kB | MIT | prod |
The npm package "extract-zip" is a handy tool written purely in JavaScript. This utility is used to unzip or extract ZIP files into a specific directory. It leverages the features of the 'yauzl' ZIP parser for optimal function. The package can be utilized via a command line program or, alternatively, it can be incorporated into JavaScript code as a library.
To use "extract-zip", install the package through npm by running npm install extract-zip --save
for application usage or npm install extract-zip -g
for global command line usage.
In your JavaScript code, you can require and use the package as follows:
const extract = require('extract-zip')
async function main () {
try {
await extract(source, { dir: target })
console.log('Extraction complete')
} catch (err) {
// handle any errors
}
}
In the code snippet above, source
refers to the ZIP file you wish to extract, while target
specifies the directory where the extracted files will be stored.
In a command line context, you can use "extract-zip' as follows:
extract-zip foo.zip <targetDirectory>
Here foo.zip
is the ZIP file to be extracted, and targetDirectory
specifies the directory where the extracted files will be written. If targetDirectory
is not specified, it will default to process.cwd()
(the current working directory).
For comprehensive details on how to use "extract-zip", please visit the official GitHub repository. The README file in the repository provides an extensive overview, code usage examples, and options for customization. Do pay particular attention to the "Options" section to understand how you can specify directory permissions, handle zip file entries, and more.