get-stream
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -89,3 +89,3 @@ /// <reference types="node"/> | ||
*/ | ||
array<StreamObjectModeType = unknown>( | ||
array<StreamObjectModeType>( | ||
stream: Stream, | ||
@@ -92,0 +92,0 @@ options?: getStream.Options |
'use strict'; | ||
const {constants: BufferConstants} = require('buffer'); | ||
const pump = require('pump'); | ||
@@ -27,3 +28,4 @@ const bufferStream = require('./buffer-stream'); | ||
const rejectPromise = error => { | ||
if (error) { // A null check | ||
// Don't retrieve an oversized buffer. | ||
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) { | ||
error.bufferedData = stream.getBufferedValue(); | ||
@@ -30,0 +32,0 @@ } |
{ | ||
"name": "get-stream", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Get a stream as a string, buffer, or array", | ||
"license": "MIT", | ||
"repository": "sindresorhus/get-stream", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
@@ -43,4 +44,4 @@ "engines": { | ||
"devDependencies": { | ||
"@types/node": "^11.13.0", | ||
"ava": "^1.4.1", | ||
"@types/node": "^12.0.7", | ||
"ava": "^2.0.0", | ||
"into-stream": "^5.0.0", | ||
@@ -47,0 +48,0 @@ "tsd": "^0.7.2", |
@@ -1,6 +0,5 @@ | ||
# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) | ||
# get-stream [![Build Status](https://travis-ci.com/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.com/github/sindresorhus/get-stream) | ||
> Get a stream as a string, buffer, or array | ||
## Install | ||
@@ -12,3 +11,2 @@ | ||
## Usage | ||
@@ -48,3 +46,2 @@ | ||
## API | ||
@@ -54,3 +51,3 @@ | ||
### getStream(stream, [options]) | ||
### getStream(stream, options?) | ||
@@ -61,8 +58,8 @@ Get the `stream` as a string. | ||
Type: `Object` | ||
Type: `object` | ||
##### encoding | ||
Type: `string`<br> | ||
Default: `utf8` | ||
Type: `string`\ | ||
Default: `'utf8'` | ||
@@ -73,3 +70,3 @@ [Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. | ||
Type: `number`<br> | ||
Type: `number`\ | ||
Default: `Infinity` | ||
@@ -79,3 +76,3 @@ | ||
### getStream.buffer(stream, [options]) | ||
### getStream.buffer(stream, options?) | ||
@@ -86,3 +83,3 @@ Get the `stream` as a buffer. | ||
### getStream.array(stream, [options]) | ||
### getStream.array(stream, options?) | ||
@@ -99,3 +96,2 @@ Get the `stream` as an array of values. | ||
## Errors | ||
@@ -116,3 +112,2 @@ | ||
## FAQ | ||
@@ -124,3 +119,2 @@ | ||
## Related | ||
@@ -130,5 +124,12 @@ | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-get-stream?utm_source=npm-get-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
Sorry, the diff of this file is not supported yet
12397
177
125