function
stream.iter.toReadable
Creates a byte-mode stream.Readable from an AsyncIterable<Uint8Array[]> (the native batch format used by the stream/iter API). Each Uint8Array in a yielded batch is pushed as a separate chunk into the Readable.
import { createWriteStream } from 'node:fs';
import { from, pull, toReadable } from 'node:stream/iter';
import { compressGzip } from 'node:zlib/iter';
const source = pull(from('hello world'), compressGzip());
const readable = toReadable(source);
readable.pipe(createWriteStream('output.gz'));@param source
An AsyncIterable<Uint8Array[]> source, such as the return value of pull() or from().
Referenced types
type Source =
| string
| ArrayBufferLike
| ArrayBufferView
| Iterable<SyncSource>
| AsyncIterable<Source>