UNPKG

@wapython/wasi

Version:

Javascript library for interacting with WASI Modules in Node.js and the Browser.

58 lines (57 loc) 1.44 kB
/// <reference types="node" /> import type WASIFileSystem from "./filesystem"; export type { WASIFileSystem }; import { WASI_FILETYPE } from "./constants"; export interface WASIBindings { hrtime: () => bigint; exit: (rval: number) => void; kill: (signal: string) => void; randomFillSync: Function; isTTY: (fd: number) => boolean; fs: any; path: any; os?: any; child_process?: any; posix?: any; } export declare type WASIArgs = string[]; export interface WASIEnv { [key: string]: string | undefined; } export interface WASIPreopenedDirs { [key: string]: string; } export interface WASIConfig { preopens?: WASIPreopenedDirs; env?: WASIEnv; args?: WASIArgs; bindings: WASIBindings; spinLock?: (time: number) => void; waitForStdin?: () => Buffer; sendStdout?: (Buffer: any) => void; sendStderr?: (Buffer: any) => void; } export declare class WASIError extends Error { errno: number; constructor(errno: number); } export declare class WASIExitError extends Error { code: number | null; constructor(code: number | null); } export declare class WASIKillError extends Error { signal: string; constructor(signal: string); } interface Rights { base: bigint; inheriting: bigint; } export interface File { real: number; path?: string; fakePath?: string; rights: Rights; offset?: bigint; filetype?: WASI_FILETYPE; }