Node.js module
stream/consumers
The 'node:stream/consumers' submodule offers helper functions that consume Readable streams into other forms, such as blob, arrayBuffer, text, or json.
It simplifies common stream-to-data conversions without manual event handling.
Functions 6
- consumers.arrayBuffer()
``js import { arrayBuffer } from 'node:stream/consumers'; import { Readable } from 'node:stream'; import { TextEncoder } from 'node:util' - consumers.blob()
``js import { blob } from 'node:stream/consumers' - consumers.buffer()
``js import { buffer } from 'node:stream/consumers'; import { Readable } from 'node:stream'; import { Buffer } from 'node:buffer' - consumers.bytes()
``js import { bytes } from 'node:stream/consumers'; import { Readable } from 'node:stream'; import { Buffer } from 'node:buffer' - consumers.json()
``js import { json } from 'node:stream/consumers'; import { Readable } from 'node:stream' - consumers.text()
``js import { text } from 'node:stream/consumers'; import { Readable } from 'node:stream'