diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 14:41:48 +0200 |
commit | d25e11bee6ca5ca523884da132d18e1400e077b9 (patch) | |
tree | 8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/decompress/readme.md | |
download | kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2 kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip |
Initial commit
Diffstat (limited to 'node_modules/decompress/readme.md')
-rw-r--r-- | node_modules/decompress/readme.md | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/node_modules/decompress/readme.md b/node_modules/decompress/readme.md new file mode 100644 index 0000000..fd23f91 --- /dev/null +++ b/node_modules/decompress/readme.md @@ -0,0 +1,105 @@ +# decompress [![Build Status](https://travis-ci.org/kevva/decompress.svg?branch=master)](https://travis-ci.org/kevva/decompress) + +> Extracting archives made easy + +*See [decompress-cli](https://github.com/kevva/decompress-cli) for the command-line version.* + +## Install + +``` +$ npm install decompress +``` + + +## Usage + +```js +const decompress = require('decompress'); + +decompress('unicorn.zip', 'dist').then(files => { + console.log('done!'); +}); +``` + + +## API + +### decompress(input, [output], [options]) + +Returns a Promise for an array of files in the following format: + +```js +{ + data: Buffer, + mode: Number, + mtime: String, + path: String, + type: String +} +``` + +#### input + +Type: `string` `Buffer` + +File to decompress. + +#### output + +Type: `string` + +Output directory. + +#### options + +##### filter + +Type: `Function` + +Filter out files before extracting. E.g: + +```js +decompress('unicorn.zip', 'dist', { + filter: file => path.extname(file.path) !== '.exe' +}).then(files => { + console.log('done!'); +}); +``` + +*Note that in the current implementation, **`filter` is only applied after fully reading all files from the archive in memory**. Do not rely on this option to limit the amount of memory used by `decompress` to the size of the files included by `filter`. `decompress` will read the entire compressed file into memory regardless.* + +##### map + +Type: `Function` + +Map files before extracting: E.g: + +```js +decompress('unicorn.zip', 'dist', { + map: file => { + file.path = `unicorn-${file.path}`; + return file; + } +}).then(files => { + console.log('done!'); +}); +``` + +##### plugins + +Type: `Array`<br> +Default: `[decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]` + +Array of [plugins](https://www.npmjs.com/browse/keyword/decompressplugin) to use. + +##### strip + +Type: `number`<br> +Default: `0` + +Remove leading directory components from extracted files. + + +## License + +MIT © [Kevin Mårtensson](https://github.com/kevva) |