@bytecodealliance/jco
Version:
JavaScript tooling for working with WebAssembly Components
33 lines (30 loc) • 918 B
TypeScript
/** @module Interface wasi:io/streams@0.2.3 **/
export type Error = import('./wasi-io-error.js').Error;
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
export interface StreamErrorLastOperationFailed {
tag: 'last-operation-failed',
val: Error,
}
export interface StreamErrorClosed {
tag: 'closed',
}
export class InputStream implements Partial<Disposable> {
/**
* This type does not have a public constructor.
*/
private constructor();
read(len: bigint): Uint8Array;
blockingRead(len: bigint): Uint8Array;
[Symbol.dispose]?: () => void;
}
export class OutputStream implements Partial<Disposable> {
/**
* This type does not have a public constructor.
*/
private constructor();
checkWrite(): bigint;
write(contents: Uint8Array): void;
blockingWriteAndFlush(contents: Uint8Array): void;
blockingFlush(): void;
[Symbol.dispose]?: () => void;
}