sindresorhus / get-stream

Get a stream as a string, Buffer, ArrayBuffer or array
MIT License
341 stars 33 forks source link

maxBuffer doesn't stop buffering data when reached #42

Closed yocontra closed 1 year ago

yocontra commented 3 years ago

Based on the docs it seems like maxBuffer would stop buffering data / end the stream once it hits the limit - currently it just rejects the promise but continues buffering data forever.

Two things that should be done:

ehmicky commented 1 year ago

The latest version fixed this issue. The stream is now read in a for await loop. When the maxBuffer is hit, this iteration stops, which means the stream is not read nor listened to anymore. The chunks variable what's been previously read, but this gets garbage collected once the function ends since it is a local variable.

Based on this, I believe this can be closed?