export { createReadableChunkStream }; import type { StreamReadOptions } from './types.js'; /** * Public-boundary `ReadableStream` builder — wraps a pull-based chunk reader * into a WHATWG `ReadableStream` that's handed to user code * (`arg.stream()` on a streaming telefunction argument, telefunction return * values, etc.). User code uses standard `ReadableStream` affordances * (`for await`, `getReader`, `pipeTo`, `tee`, ...), so returning an * `AsyncIterable` here would break that contract. * * Distinct from telefunc's *internal* response/request body pipes — those * stay as bare `AsyncIterable` so the runtime adapter (`Readable.from` on * Node, `new ReadableStream({ pull })` on Web) can wrap them once at the * very edge, skipping the spec overhead webstreams charge per chunk. */ declare function createReadableChunkStream(opts: { readNextChunk: () => Promise | null>; cancel: () => void; isCancelled: () => boolean; readOptions?: StreamReadOptions; highWaterMark?: number; }): ReadableStream>;