Releases: sindresorhus/get-stream
Releases · sindresorhus/get-stream
v9.0.1
v9.0.0
v8.0.1
Fixes
- Ensure
error.bufferedData
is as full as possible. (#106) - Fix the
maxBuffer
option being one byte off in some edge case. (#105)
v8.0.0
Huge thanks to @ehmicky for doing all the work for this release 🙌
Breaking
- Remove the
encoding
option. (#69, #67)- This package handles binary, UTF-8 and object streams.
- For other encodings like UTF-16, hexacimal and base64, please see the following tip. (#84)
- Methods like
buffer.toString('hex')
orbuffer.toString('base64')
can also be used.
Improvements
- Support any JavaScript environment, including browsers. (#85)
- Support web streams (
ReadableStream
). (#82, #78, #79, #80) - Support async iterables. (#69, #93)
- Add
getStreamAsArray()
method to pass streams in object mode. (#86) - Add
getStreamAsArrayBuffer()
method to return the stream as anArrayBuffer
. (#81) - When the stream is larger than the maximum size for a string, buffer or
ArrayBuffer
, seterror.bufferedData
with the partially read data instead of leaving it empty. (#68, #48)
Fixes
- Do not crash on big streams (with one/many GBs). (#66)
- Ensure
maxBuffer
stops infinite streams. (#62) - Stop consuming the streaming when hitting
maxBuffer
. (#42, #69). - Set
error.bufferedData
when the stream errors for other reasons thanmaxBuffer
. (#56, #63) - Ensure
error.bufferedData
is smaller thanmaxBuffer
. (#89)
TypeScript types
- The
stream
argument must be aReadable
,ReadableStream
orAsyncIterable
. (#71)
Documentation
- Add tips on alternatives,
Blob
and JSON streaming. (#58, #95, #96, #97)
Performance
- Do not block the event loop when the stream ends. (#92)
v7.0.1
- Work around issue with handling large sizes e58d141
v7.0.0
Breaking
- Require Node.js 16 70571f8
- This package is now pure ESM. Please read this.
- Removed
getStream.array()
- It complicated the codebase considerably and I personally never used it.
- You can use
readableStream.toArray()
instead. Example
const getStream = require('get-stream'); getStream.buffer(…);
→import {getStreamAsBuffer} from 'get-stream'; getStreamAsBuffer(…);
const getStream = require('get-stream'); getStream.MaxBufferError;
→import {MaxBufferError} from 'get-stream'; MaxBufferError;
Tip
You may not need this package anymore.