FtoReadableSync
Bun

function

stream.iter.toReadableSync

function toReadableSync(
source: SyncSource,

Creates a byte-mode stream.Readable from a synchronous Iterable<Uint8Array[]>. The _read() method pulls from the iterator synchronously, so data is available immediately via readable.read().

import { fromSync, toReadableSync } from 'node:stream/iter';

const source = fromSync('hello world');
const readable = toReadableSync(source);

console.log(readable.read().toString()); // 'hello world'
@param source

An Iterable<Uint8Array[]> source, such as the return value of pullSync() or fromSync().

Referenced types

type SyncSource = string | ArrayBufferLike | ArrayBufferView | Iterable<SyncSource> | Streamable