Comparing version 0.9.2 to 0.9.3
@@ -85,7 +85,10 @@ var util = require('util'); | ||
__autodraining = true; | ||
return new Promise(function(resolve,reject) { | ||
entry.pipe(NoopStream()); | ||
entry.on('finish',resolve); | ||
entry.on('error',reject); | ||
}); | ||
var draining = entry.pipe(NoopStream()); | ||
draining.promise = function() { | ||
return new Promise(function(resolve, reject) { | ||
draining.on('finish',resolve); | ||
draining.on('error',reject); | ||
}); | ||
}; | ||
return draining; | ||
}; | ||
@@ -92,0 +95,0 @@ |
{ | ||
"name": "unzipper", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Unzip cross-platform streaming API ", | ||
@@ -5,0 +5,0 @@ "author": "Evan Oxfeld <eoxfeld@gmail.com>", |
@@ -1,2 +0,2 @@ | ||
# unzipper [![Build Status](https://api.travis-ci.org/ZJONSSON/node-unzipper.png)](https://travis-ci.org/ZJONSSON/node-unzipper.svg?branch=master) | ||
# unzipper [![Build Status](https://api.travis-ci.org/ZJONSSON/node-unzipper.png?branch=master)](https://travis-ci.org/ZJONSSON/node-unzipper?branch=master) | ||
@@ -37,5 +37,16 @@ This is a fork of [node-unzip](https://github.com/EvanOxfeld/node-unzip) which has not been maintained in a while. This fork addresses the following issues: | ||
__Important__: If you do not intend to consume an entry stream's raw data, call autodrain() to dispose of the entry's | ||
contents. Otherwise you the stream will halt. | ||
contents. Otherwise you the stream will halt. `.autodrain()` returns an empty stream that provides `error` and `finish` events. | ||
Additionally you can call `.autodrain().promise()` to get the promisified version of success or failure of the autodrain. | ||
```js | ||
// If you want to handle autodrain errors you can either: | ||
entry.autodrain().catch(e => handleError); | ||
// or | ||
entry.autodrain().on('error' => handleError); | ||
``` | ||
Here is a quick example: | ||
```js | ||
fs.createReadStream('path/to/archive.zip') | ||
@@ -42,0 +53,0 @@ .pipe(unzipper.Parse()) |
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
38338
788
262