export interface IStreamToolsRead { done: () => void; write: (writeArg: TInput) => void; } /** * the read function is called anytime * -> the WebDuplexStream is being read from * and at the same time if nothing is enqueued */ export interface IStreamReadFunction { (toolsArg: IStreamToolsRead): Promise; } export interface IStreamToolsWrite { truncate: () => void; push: (pushArg: TOutput) => void; } /** * the write function can return something. * It is called anytime a chunk is written to the stream. */ export interface IStreamWriteFunction { (chunkArg: TInput, toolsArg: IStreamToolsWrite): Promise; } export interface IStreamFinalFunction { (toolsArg: IStreamToolsWrite): Promise; } export interface WebDuplexStreamOptions { readFunction?: IStreamReadFunction; writeFunction?: IStreamWriteFunction; finalFunction?: IStreamFinalFunction; } export declare class WebDuplexStream extends TransformStream { static fromUInt8Array(uint8Array: Uint8Array): WebDuplexStream; options: WebDuplexStreamOptions; constructor(optionsArg: WebDuplexStreamOptions); getCustomReadableStream(): ReadableStream; }