A utility to convert streams, async iterables, and ReadableStreams into strings, buffers, ArrayBuffers, or arrays.
get-stream is a JavaScript library that converts streams, async iterables, and ReadableStreams into strings, buffers, ArrayBuffers, or arrays. It solves the problem of consistently consuming stream data across different JavaScript environments, providing a unified API for Node.js streams, web streams, and async iterables.
JavaScript developers working with streams in Node.js, browsers, or other runtimes who need a reliable way to consume stream data into standard formats.
Developers choose get-stream for its cross-environment support, explicit output format control, error handling with partial data recovery, and performance that matches or exceeds native alternatives in many scenarios.
Get a stream as a string, Buffer, ArrayBuffer or array
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly in Node.js, browsers, and other JavaScript runtimes, as highlighted in the README's browser support section and examples with fetch and async iterables.
Returns partially read data in error.bufferedData when streams error, preventing complete data loss, as demonstrated in the Errors section with practical code snippets.
Provides clear methods like getStreamAsBuffer and getStreamAsArray for specific data types, avoiding fragile type inference and giving developers control over conversions.
Includes a maxBuffer option to reject streams exceeding specified sizes, helping prevent memory issues, with length measured appropriately for each output format.
Requires a bundler that supports exports.browser or strips Node.js imports, adding configuration complexity for browser-only projects compared to native Web APIs.
For non-UTF-8 text streams, additional transform streams like TextDecoderStream are needed, as noted in the Tips section, making it less straightforward for certain encodings.
Benchmarks show native methods like buffer() can be faster in some cases, making get-stream slightly less optimal for performance-critical Node.js applications without its extra features.