schnee effeckt und fehler Korektur
This commit is contained in:
143
node_modules/decompress/readme.md
generated
vendored
143
node_modules/decompress/readme.md
generated
vendored
@@ -7,128 +7,97 @@
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save decompress
|
||||
$ npm install decompress
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
const decompress = require('decompress');
|
||||
|
||||
new Decompress({mode: '755'})
|
||||
.src('foo.zip')
|
||||
.dest('dest')
|
||||
.use(Decompress.zip({strip: 1}))
|
||||
.run();
|
||||
decompress('unicorn.zip', 'dist').then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### new Decompress(options)
|
||||
### decompress(input, [output], [options])
|
||||
|
||||
Creates a new `Decompress` instance.
|
||||
Returns a Promise for an array of files in the following format:
|
||||
|
||||
#### options.mode
|
||||
```js
|
||||
{
|
||||
data: Buffer,
|
||||
mode: Number,
|
||||
mtime: String,
|
||||
path: String,
|
||||
type: String
|
||||
}
|
||||
```
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string` `Buffer`
|
||||
|
||||
File to decompress.
|
||||
|
||||
#### output
|
||||
|
||||
Type: `string`
|
||||
|
||||
Set mode on the extracted files, i.e `{ mode: '755' }`.
|
||||
Output directory.
|
||||
|
||||
#### options.strip
|
||||
#### options
|
||||
|
||||
Type: `number`
|
||||
##### filter
|
||||
|
||||
Equivalent to `--strip-components` for tar.
|
||||
Type: `Function`
|
||||
|
||||
### .src(files)
|
||||
|
||||
#### files
|
||||
|
||||
Type: `array`, `buffer` or `string`
|
||||
|
||||
Set the files to be extracted.
|
||||
|
||||
### .dest(path)
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Set the destination to where your file will be extracted to.
|
||||
|
||||
### .use(plugin)
|
||||
|
||||
#### plugin
|
||||
|
||||
Type: `function`
|
||||
|
||||
Add a `plugin` to the middleware stack.
|
||||
|
||||
### .run(callback)
|
||||
|
||||
Extract your file with the given settings.
|
||||
|
||||
#### callback(err, files)
|
||||
|
||||
Type: `function`
|
||||
|
||||
The callback will return an array of vinyl files in `files`.
|
||||
|
||||
|
||||
## Plugins
|
||||
|
||||
The following [plugins](https://www.npmjs.org/browse/keyword/decompressplugin) are bundled with decompress:
|
||||
|
||||
* [tar](#tar) — Extract TAR files.
|
||||
* [tar.bz2](#tarbz2) — Extract TAR.BZ files.
|
||||
* [tar.gz](#targz) — Extract TAR.GZ files.
|
||||
* [zip](#zip) — Extract ZIP files.
|
||||
|
||||
### .tar(options)
|
||||
|
||||
Extract TAR files.
|
||||
Filter out files before extracting. E.g:
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.tar({strip: 1}));
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
filter: file => path.extname(file.path) !== '.exe'
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
### .tarbz2(options)
|
||||
*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.*
|
||||
|
||||
Extract TAR.BZ files.
|
||||
##### map
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Map files before extracting: E.g:
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.tarbz2({strip: 1}));
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
map: file => {
|
||||
file.path = `unicorn-${file.path}`;
|
||||
return file;
|
||||
}
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
### .targz(options)
|
||||
##### plugins
|
||||
|
||||
Extract TAR.GZ files.
|
||||
Type: `Array`<br>
|
||||
Default: `[decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]`
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
Array of [plugins](https://www.npmjs.com/browse/keyword/decompressplugin) to use.
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.targz({strip: 1}));
|
||||
```
|
||||
##### strip
|
||||
|
||||
### .zip(options)
|
||||
Type: `number`<br>
|
||||
Default: `0`
|
||||
|
||||
Extract ZIP files.
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.zip({strip: 1}));
|
||||
```
|
||||
Remove leading directory components from extracted files.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user