API Reference
get-stream
Gets the contents of a stream as a string, buffer, or array with promise interface.
Official Documentation ↗CompatibilityThis documentation covers version
v9.0.1. Check the official docs for the latest API surface.Installation
npm
npm install get-streampnpm
pnpm add get-streamMethods
No methods match this filter.
get-stream is gets the contents of a stream as a string, buffer, or array with promise interface.
Key Features
- data-fetching: Designed for data fetching scenarios with a focused API surface.
Installation
npm install get-stream
Usage
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/get-stream@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:49:46.921Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Errors If the stream errors, the returned promise will be rejected with the error. (https://cdn.jsdelivr.net/gh/sindresorhus/get-stream@latest/readme.md)
- Any contents already read from the stream will be set to error.bufferedData, which is a string, a Buffer, an ArrayBuffer or an array depending on the method used. (https://cdn.jsdelivr.net/gh/sindresorhus/get-stream@latest/readme.md)
- Tips ### Alternatives If you do not need the maxBuffer option, error.bufferedData, nor browser support, you can use the following methods instead of this package. (https://cdn.jsdelivr.net/gh/sindresorhus/get-stream@latest/readme.md)
FAQ
- What is backpressure?
- When a writable stream cannot keep up, write() returns false. Pause the source or wait for the drain event before writing more.
- How do I handle stream errors?
- Always listen for the error event on every stream in the pipeline; unhandled error events crash the process.
- Should I use pipe or pipeline?
- Prefer pipeline() from stream/promises; it properly cleans up all streams on error, unlike pipe().
Report a problem with this API docOpens a pre-filled issue on GitHub.