import { StreamChunk, IOStreamTransport } from './types.js'; /** * A helper to bridge event-based or callback-based data sources to the AsyncIterable * required by `openStream`. * * @returns An object containing: * - `source`: The AsyncIterable to pass to `openStream`. * - `push`: A function to push a new chunk of data. * - `close`: A function to signal the end of the stream (or an error). * * @example * ```ts * const { source, push, close } = createPushSource(); * openStream(source); * * xhr.onprogress = () => push(xhr.responseText.substring(seen)); * xhr.onload = () => close(); * xhr.onerror = () => close(new Error('Network error')); * ``` */ declare function createPushSource(): { source: AsyncIterable; push: (chunk: StreamChunk) => void; close: (error?: Error) => void; }; /** * A transport that accumulates all written data into a single string buffer. * Useful for environments where streaming upload is not possible, and you need * to generate the full payload before sending. */ declare class BufferTransport implements IOStreamTransport { private chunks; send(chunk: string | Uint8Array): void; getOutput(): string; } export { BufferTransport, createPushSource };