39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
|
/// <reference types="node" />
|
||
|
import type { WASIBindings, WASIEnv, WASIConfig, File } from "./types";
|
||
|
export declare const SOCKET_DEFAULT_RIGHTS: bigint;
|
||
|
declare type Exports = {
|
||
|
[key: string]: any;
|
||
|
};
|
||
|
interface State {
|
||
|
env: WASIEnv;
|
||
|
FD_MAP: Map<number, File>;
|
||
|
bindings: WASIBindings;
|
||
|
}
|
||
|
export default class WASI {
|
||
|
memory: WebAssembly.Memory;
|
||
|
view: DataView;
|
||
|
FD_MAP: Map<number, File>;
|
||
|
wasiImport: Exports;
|
||
|
bindings: WASIBindings;
|
||
|
sleep?: (milliseconds: number) => void;
|
||
|
lastStdin: number;
|
||
|
getStdin?: (milliseconds?: number) => Buffer;
|
||
|
stdinBuffer?: Buffer;
|
||
|
sendStdout?: (Buffer: any) => void;
|
||
|
sendStderr?: (Buffer: any) => void;
|
||
|
env: WASIEnv;
|
||
|
getState(): State;
|
||
|
setState(state: State): void;
|
||
|
fstatSync(real_fd: number): any;
|
||
|
constructor(wasiConfig: WASIConfig);
|
||
|
shortPause(): void;
|
||
|
getUnusedFileDescriptor(start?: number): number;
|
||
|
refreshMemory(): void;
|
||
|
setMemory(memory: WebAssembly.Memory): void;
|
||
|
start(instance: WebAssembly.Instance, memory?: WebAssembly.Memory): void;
|
||
|
private getImportNamespace;
|
||
|
getImports(module: WebAssembly.Module): Record<string, Record<string, Function>>;
|
||
|
initWasiFdInfo(): void;
|
||
|
}
|
||
|
export {};
|