decompress
Advanced tools
Comparing version 2.2.1 to 2.3.0
#!/usr/bin/env node | ||
'use strict'; | ||
var Decompress = require('./'); | ||
var fs = require('fs'); | ||
var meow = require('meow'); | ||
var stdin = require('get-stdin'); | ||
var getStdin = require('get-stdin'); | ||
var Decompress = require('./'); | ||
@@ -94,5 +94,5 @@ var cli = meow({ | ||
stdin.buffer(function (buf) { | ||
getStdin.buffer(function (buf) { | ||
run(buf, dest, cli.flags); | ||
}); | ||
} |
14
index.js
'use strict'; | ||
var bufferToVinyl = require('buffer-to-vinyl'); | ||
var combine = require('stream-combiner2'); | ||
var concat = require('concat-stream'); | ||
var vfs = require('vinyl-fs'); | ||
var streamCombiner = require('stream-combiner2'); | ||
var concatStream = require('concat-stream'); | ||
var vinylFs = require('vinyl-fs'); | ||
var vinylAssign = require('vinyl-assign'); | ||
@@ -82,3 +82,3 @@ | ||
stream.on('error', cb); | ||
stream.pipe(concat(cb.bind(null, null))); | ||
stream.pipe(concatStream(cb.bind(null, null))); | ||
}; | ||
@@ -104,6 +104,6 @@ | ||
if (this.dest()) { | ||
this.streams.push(vfs.dest(this.dest())); | ||
this.streams.push(vinylFs.dest(this.dest())); | ||
} | ||
return combine(this.streams); | ||
return streamCombiner(this.streams); | ||
}; | ||
@@ -122,3 +122,3 @@ | ||
return vfs.src(this.src()); | ||
return vinylFs.src(this.src()); | ||
}; | ||
@@ -125,0 +125,0 @@ |
{ | ||
"name": "decompress", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Extracting archives made easy", | ||
@@ -47,3 +47,3 @@ "license": "MIT", | ||
"vinyl-assign": "^1.0.1", | ||
"vinyl-fs": "^0.3.7" | ||
"vinyl-fs": "^1.0.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "devDependencies": { |
@@ -5,8 +5,10 @@ # decompress [![Build Status](http://img.shields.io/travis/kevva/decompress.svg?style=flat)](https://travis-ci.org/kevva/decompress) | ||
## Install | ||
```sh | ||
``` | ||
$ npm install --save decompress | ||
``` | ||
## Usage | ||
@@ -17,31 +19,25 @@ | ||
var decompress = new Decompress({mode: '755'}) | ||
new Decompress({mode: '755'}) | ||
.src('foo.zip') | ||
.dest('destFolder') | ||
.use(Decompress.zip({strip: 1})); | ||
.dest('dest') | ||
.use(Decompress.zip({strip: 1})) | ||
.run(); | ||
``` | ||
decompress.run(function (err) { | ||
if (err) { | ||
throw err; | ||
} | ||
console.log('Archive extracted successfully!'); | ||
}); | ||
``` | ||
## API | ||
### new Decompress(opts) | ||
### new Decompress(options) | ||
Creates a new `Decompress` instance. | ||
#### opts.mode | ||
#### options.mode | ||
Type: `String` | ||
Type: `string` | ||
Set mode on the extracted files, i.e `{ mode: '755' }`. | ||
#### opts.strip | ||
#### options.strip | ||
Type: `Number` | ||
Type: `number` | ||
@@ -54,3 +50,3 @@ Equivalent to `--strip-components` for tar. | ||
Type: `Array|Buffer|String` | ||
Type: `array`, `buffer` or `string` | ||
@@ -63,3 +59,3 @@ Set the files to be extracted. | ||
Type: `String` | ||
Type: `string` | ||
@@ -72,16 +68,17 @@ Set the destination to where your file will be extracted to. | ||
Type: `Function` | ||
Type: `function` | ||
Add a `plugin` to the middleware stack. | ||
### .run(cb) | ||
### .run(callback) | ||
Extract your file with the given settings. | ||
#### cb(err, files) | ||
#### callback(err, files) | ||
Type: `Function` | ||
Type: `function` | ||
The callback will return an array of vinyl files in `files`. | ||
## Plugins | ||
@@ -140,26 +137,28 @@ | ||
## CLI | ||
```sh | ||
``` | ||
$ npm install --global decompress | ||
``` | ||
```sh | ||
``` | ||
$ decompress --help | ||
Usage | ||
$ decompress <file> [directory] | ||
$ cat <file> | decompress [directory] | ||
Usage | ||
$ decompress <file> [directory] | ||
$ cat <file> | decompress [directory] | ||
Example | ||
$ decompress --strip 1 file.zip out | ||
$ cat file.zip | decompress out | ||
Example | ||
$ decompress --strip 1 file.zip out | ||
$ cat file.zip | decompress out | ||
Options | ||
-m, --mode Set mode on the extracted files | ||
-s, --strip Equivalent to --strip-components for tar | ||
Options | ||
-m, --mode Set mode on the extracted files | ||
-s, --strip Equivalent to --strip-components for tar | ||
``` | ||
## License | ||
MIT © [Kevin Mårtensson](https://github.com/kevva) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8664
159
+ Addedduplexify@3.7.1(transitive)
+ Addedglob-stream@4.1.1(transitive)
+ Addedglob-watcher@0.0.8(transitive)
+ Addedjson-stable-stringify-without-jsonify@1.0.1(transitive)
+ Addedmerge-stream@0.1.8(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedstream-shift@1.0.3(transitive)
+ Addedthrough2@4.0.2(transitive)
+ Addedthrough2-filter@3.1.0(transitive)
+ Addedunique-stream@2.3.1(transitive)
+ Addedvinyl-fs@1.0.0(transitive)
- Removeddefaults@1.0.4(transitive)
- Removedglob-stream@3.1.18(transitive)
- Removedglob-watcher@0.0.6(transitive)
- Removedunique-stream@1.0.0(transitive)
- Removedvinyl-fs@0.3.14(transitive)
Updatedvinyl-fs@^1.0.0