get-stream
Advanced tools
Comparing version 2.2.1 to 2.3.0
10
index.js
@@ -18,2 +18,3 @@ 'use strict'; | ||
stream = bufferStream(opts); | ||
inputStream.once('error', error); | ||
inputStream.pipe(stream); | ||
@@ -26,3 +27,3 @@ | ||
}); | ||
stream.on('error', reject); | ||
stream.once('error', error); | ||
stream.on('end', resolve); | ||
@@ -33,2 +34,9 @@ | ||
}; | ||
function error(err) { | ||
if (err) { // null check | ||
err.bufferedData = stream.getBufferedValue(); | ||
} | ||
reject(err); | ||
} | ||
}); | ||
@@ -35,0 +43,0 @@ |
{ | ||
"name": "get-stream", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Get a stream as a string, buffer, or array", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -90,2 +90,13 @@ # get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) | ||
## Errors | ||
If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. | ||
```js | ||
getStream(streamThatErrorsAtTheEnd('unicorn')) | ||
.catch(err => console.log(err.bufferedData)); | ||
// unicorn | ||
``` | ||
## FAQ | ||
@@ -92,0 +103,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8057
86
116
1