Skip to main content

"quickjs:os" (namespace)

declare module "quickjs:os" {
export function open(filename: string, flags: number, mode?: number): number;
export var O_RDONLY: number;
export var O_WRONLY: number;
export var O_RDWR: number;
export var O_APPEND: number;
export var O_CREAT: number;
export var O_EXCL: number;
export var O_TRUNC: number;
export var O_BINARY: number;
export var O_TEXT: number;
export function close(fd: number): void;
interface OsSeek {
(fd: number, offset: number, whence: number): number;
(fd: number, offset: bigint, whence: number): bigint;
}
export var seek: OsSeek;
export function read(
fd: number,
buffer: ArrayBuffer,
offset: number,
length: number,
): number;
export function write(
fd: number,
buffer: ArrayBuffer,
offset: number,
length: number,
): number;
export function isatty(fd: number): boolean;
export function ttyGetWinSize(fd: number): null | [number, number];
export function ttySetRaw(fd: number): void;
export function remove(filename: string): void;
export function rename(oldname: string, newname: string): void;
export function realpath(path: string): string;
export function getcwd(): string;
export function chdir(path: string): void;
export function mkdir(path: string, mode?: number): void;
export function readdir(path: string): Array<string>;
export type Stats = {
dev: number;
ino: number;
mode: number;
nlink: number;
uid: number;
gid: number;
rdev: number;
size: number;
blocks: number;
atime: number;
mtime: number;
ctime: number;
};
export function stat(path: string): Stats;
export function lstat(path: string): Stats;
export var S_IFMT: number;
export var S_IFIFO: number;
export var S_IFCHR: number;
export var S_IFDIR: number;
export var S_IFBLK: number;
export var S_IFREG: number;
export var S_IFSOCK: number;
export var S_IFLNK: number;
export var S_ISGID: number;
export var S_ISUID: number;
export var S_IRWXU: number;
export var S_IRUSR: number;
export var S_IWUSR: number;
export var S_IXUSR: number;
export var S_IRWXG: number;
export var S_IRGRP: number;
export var S_IWGRP: number;
export var S_IXGRP: number;
export var S_IRWXO: number;
export var S_IROTH: number;
export var S_IWOTH: number;
export var S_IXOTH: number;
export function utimes(path: string, atime: number, mtime: number): void;
export function symlink(target: string, linkpath: string): void;
export function readlink(path: string): string;
export function setReadHandler(fd: number, func: null | (() => void)): void;
export function setWriteHandler(fd: number, func: null | (() => void)): void;
export function signal(
signal: number,
func: null | undefined | (() => void),
): void;
export var SIGINT: number;
export var SIGABRT: number;
export var SIGFPE: number;
export var SIGILL: number;
export var SIGSEGV: number;
export var SIGTERM: number;
export var SIGQUIT: number;
export var SIGPIPE: number;
export var SIGALRM: number;
export var SIGUSR1: number;
export var SIGUSR2: number;
export var SIGCHLD: number;
export var SIGCONT: number;
export var SIGSTOP: number;
export var SIGTSTP: number;
export var SIGTTIN: number;
export var SIGTTOU: number;
export function kill(pid: number, sig: number): void;
export type ExecOptions = {
block?: boolean;
usePath?: boolean;
file?: string;
cwd?: string;
stdin?: number | FILE;
stdout?: number | FILE;
stderr?: number | FILE;
env?: {
[key: string | number]: string | number | boolean;
};
uid?: number;
gid?: number;
};
export function exec(args: Array<string>, options?: ExecOptions): number;
export function getpid(): number;
export function waitpid(pid: number, options?: number): [number, number];
export var WNOHANG: number;
export var WUNTRACED: number;
export function WEXITSTATUS(status: number): number;
export function WTERMSIG(status: number): number;
export function WSTOPSIG(status: number): number;
export function WIFEXITED(status: number): boolean;
export function WIFSIGNALED(status: number): boolean;
export function WIFSTOPPED(status: number): boolean;
export function WIFCONTINUED(status: number): boolean;
export function dup(fd: number): number;
export function dup2(oldfd: number, newfd: number): number;
export function pipe(): [number, number];
export function sleep(delay_ms: number): void;
export function now(): number;
export var platform:
| "win32"
| "darwin"
| "emscripten"
| "wasm"
| "freebsd"
| "linux"
| "unknown";
export type StructuredClonable =
| string
| number
| boolean
| null
| undefined
| Boolean
| String
| Date
| RegExp
| ArrayBuffer
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
| DataView
| SharedArrayBuffer
| {
[key: string | number]: StructuredClonable;
};
export class Worker {
constructor(
moduleFilename: string,
options?: {
overrideCode?: string;
},
);
static parent: Pick<Worker, "postMessage" | "onmessage">;
terminate(): void;
onmessage: null | ((event: { data: StructuredClonable }) => void);
| null
| ((event: {
message: string;
filename: string;
lineno: number;
error: Error | null;
}) => void);
}
export class Win32Handle {
private constructor();
readonly [Symbol.toStringTag]: "Win32Handle";
}
export type CreateProcessOptions = {
moduleName?: string;
flags?: number;
cwd?: string;
env?: {
[key: string]: string;
};
stdin?: FILE | number;
stdout?: FILE | number;
stderr?: FILE | number;
};
export type CreateProcessResult = {
pid: number;
tid: number;
};
export var CreateProcess:
| undefined
| ((
commandLine: string | null,
export var WaitForSingleObject:
undefined | ((handle: Win32Handle, timeoutMs?: number) => number);
export var GetExitCodeProcess: undefined | ((handle: Win32Handle) => number);
export var TerminateProcess:
undefined | ((handle: Win32Handle, exitCode: number) => void);
export var CloseHandle: undefined | ((handle: Win32Handle) => void);
export type CreatePipeOptions = {
inheritHandle?: boolean;
};
export type CreatePipeResult = {
};
export var CreatePipe:
undefined | ((options?: CreatePipeOptions) => CreatePipeResult);
export var WAIT_OBJECT_0: number | undefined;
export var WAIT_ABANDONED: number | undefined;
export var WAIT_TIMEOUT: number | undefined;
export var WAIT_FAILED: number | undefined;
export var R_OK: number;
export var W_OK: number;
export var X_OK: number;
export var F_OK: number;
export function access(path: string, accessMode: number): void;
export function execPath(): string;
export function chmod(path: string, mode: number): void;
export function gethostname(): string;
}

"quickjs:os".open (exported function)

Open a file handle. Returns a number; the file descriptor.

  • @param filename — The path to the file to open.
  • @param flags — Numeric flags that set the mode to use when opening the file. See os.O_*
  • @param mode — Octal access mask. Defaults to 0o666.
export function open(filename: string, flags: number, mode?: number): number;

"quickjs:os".O_RDONLY (exported number)

POSIX open flag, used in open.

var O_RDONLY: number;

"quickjs:os".O_WRONLY (exported number)

var O_WRONLY: number;

"quickjs:os".O_RDWR (exported number)

var O_RDWR: number;

"quickjs:os".O_APPEND (exported number)

var O_APPEND: number;

"quickjs:os".O_CREAT (exported number)

var O_CREAT: number;

"quickjs:os".O_EXCL (exported number)

var O_EXCL: number;

"quickjs:os".O_TRUNC (exported number)

var O_TRUNC: number;

"quickjs:os".O_BINARY (exported number)

var O_BINARY: number;

"quickjs:os".O_TEXT (exported number)

var O_TEXT: number;

"quickjs:os".close (exported function)

Close the file with descriptor fd.

export function close(fd: number): void;

"quickjs:os".OsSeek (interface)

interface OsSeek {
(fd: number, offset: number, whence: number): number;
(fd: number, offset: bigint, whence: number): bigint;
}

OsSeek(...) (call signature)

(fd: number, offset: number, whence: number): number;

OsSeek(...) (call signature)

(fd: number, offset: bigint, whence: number): bigint;

"quickjs:os".seek (exported OsSeek)

var seek: OsSeek;

"quickjs:os".read (exported function)

export function read(
fd: number,
buffer: ArrayBuffer,
offset: number,
length: number,
): number;

"quickjs:os".write (exported function)

export function write(
fd: number,
buffer: ArrayBuffer,
offset: number,
length: number,
): number;

"quickjs:os".isatty (exported function)

export function isatty(fd: number): boolean;

"quickjs:os".ttyGetWinSize (exported function)

export function ttyGetWinSize(fd: number): null | [number, number];

"quickjs:os".ttySetRaw (exported function)

export function ttySetRaw(fd: number): void;

"quickjs:os".remove (exported function)

export function remove(filename: string): void;

"quickjs:os".rename (exported function)

export function rename(oldname: string, newname: string): void;

"quickjs:os".realpath (exported function)

export function realpath(path: string): string;

"quickjs:os".getcwd (exported function)

export function getcwd(): string;

"quickjs:os".chdir (exported function)

export function chdir(path: string): void;

"quickjs:os".mkdir (exported function)

export function mkdir(path: string, mode?: number): void;

"quickjs:os".readdir (exported function)

export function readdir(path: string): Array<string>;

"quickjs:os".Stats (exported type)

type Stats = {
dev: number;
ino: number;
mode: number;
nlink: number;
uid: number;
gid: number;
rdev: number;
size: number;
blocks: number;
atime: number;
mtime: number;
ctime: number;
};

Stats.dev (number property)

dev: number;

Stats.ino (number property)

ino: number;

Stats.mode (number property)

mode: number;
nlink: number;

Stats.uid (number property)

uid: number;

Stats.gid (number property)

gid: number;

Stats.rdev (number property)

rdev: number;

Stats.size (number property)

size: number;

Stats.blocks (number property)

blocks: number;

Stats.atime (number property)

atime: number;

Stats.mtime (number property)

mtime: number;

Stats.ctime (number property)

ctime: number;

"quickjs:os".stat (exported function)

export function stat(path: string): Stats;

"quickjs:os".lstat (exported function)

export function lstat(path: string): Stats;

"quickjs:os".S_IFMT (exported number)

var S_IFMT: number;

"quickjs:os".S_IFIFO (exported number)

var S_IFIFO: number;

"quickjs:os".S_IFCHR (exported number)

var S_IFCHR: number;

"quickjs:os".S_IFDIR (exported number)

var S_IFDIR: number;

"quickjs:os".S_IFBLK (exported number)

var S_IFBLK: number;

"quickjs:os".S_IFREG (exported number)

var S_IFREG: number;

"quickjs:os".S_IFSOCK (exported number)

var S_IFSOCK: number;

"quickjs:os".S_IFLNK (exported number)

var S_IFLNK: number;

"quickjs:os".S_ISGID (exported number)

var S_ISGID: number;

"quickjs:os".S_ISUID (exported number)

var S_ISUID: number;

"quickjs:os".S_IRWXU (exported number)

var S_IRWXU: number;

"quickjs:os".S_IRUSR (exported number)

var S_IRUSR: number;

"quickjs:os".S_IWUSR (exported number)

var S_IWUSR: number;

"quickjs:os".S_IXUSR (exported number)

var S_IXUSR: number;

"quickjs:os".S_IRWXG (exported number)

var S_IRWXG: number;

"quickjs:os".S_IRGRP (exported number)

var S_IRGRP: number;

"quickjs:os".S_IWGRP (exported number)

var S_IWGRP: number;

"quickjs:os".S_IXGRP (exported number)

var S_IXGRP: number;

"quickjs:os".S_IRWXO (exported number)

var S_IRWXO: number;

"quickjs:os".S_IROTH (exported number)

var S_IROTH: number;

"quickjs:os".S_IWOTH (exported number)

var S_IWOTH: number;

"quickjs:os".S_IXOTH (exported number)

var S_IXOTH: number;

"quickjs:os".utimes (exported function)

export function utimes(path: string, atime: number, mtime: number): void;
export function symlink(target: string, linkpath: string): void;
export function readlink(path: string): string;

"quickjs:os".setReadHandler (exported function)

Register a function to be called when fd becomes readable. Pass null as func to unregister.

Windows: only fd === 0 (stdin) is supported. Calling with any other fd throws — the underlying Windows event loop has no plumbing for arbitrary fds (it special-cases the stdin console handle), so registering would silently never fire.

export function setReadHandler(fd: number, func: null | (() => void)): void;

"quickjs:os".setWriteHandler (exported function)

Register a function to be called when fd becomes writable. Pass null as func to unregister.

Windows: not supported — the Windows event loop has no plumbing for write readiness on any fd. Calling this with a non-null handler throws on Windows.

export function setWriteHandler(fd: number, func: null | (() => void)): void;

"quickjs:os".signal (exported function)

export function signal(
signal: number,
func: null | undefined | (() => void),
): void;

"quickjs:os".SIGINT (exported number)

var SIGINT: number;

"quickjs:os".SIGABRT (exported number)

var SIGABRT: number;

"quickjs:os".SIGFPE (exported number)

var SIGFPE: number;

"quickjs:os".SIGILL (exported number)

var SIGILL: number;

"quickjs:os".SIGSEGV (exported number)

var SIGSEGV: number;

"quickjs:os".SIGTERM (exported number)

var SIGTERM: number;

"quickjs:os".SIGQUIT (exported number)

var SIGQUIT: number;

"quickjs:os".SIGPIPE (exported number)

var SIGPIPE: number;

"quickjs:os".SIGALRM (exported number)

var SIGALRM: number;

"quickjs:os".SIGUSR1 (exported number)

var SIGUSR1: number;

"quickjs:os".SIGUSR2 (exported number)

var SIGUSR2: number;

"quickjs:os".SIGCHLD (exported number)

var SIGCHLD: number;

"quickjs:os".SIGCONT (exported number)

var SIGCONT: number;

"quickjs:os".SIGSTOP (exported number)

var SIGSTOP: number;

"quickjs:os".SIGTSTP (exported number)

var SIGTSTP: number;

"quickjs:os".SIGTTIN (exported number)

var SIGTTIN: number;

"quickjs:os".SIGTTOU (exported number)

var SIGTTOU: number;

"quickjs:os".kill (exported function)

export function kill(pid: number, sig: number): void;

"quickjs:os".ExecOptions (exported type)

type ExecOptions = {
block?: boolean;
usePath?: boolean;
file?: string;
cwd?: string;
stdin?: number | FILE;
stdout?: number | FILE;
stderr?: number | FILE;
env?: {
[key: string | number]: string | number | boolean;
};
uid?: number;
gid?: number;
};

ExecOptions.block (boolean property)

block?: boolean;

ExecOptions.usePath (boolean property)

usePath?: boolean;

ExecOptions.file (string property)

file?: string;

ExecOptions.cwd (string property)

cwd?: string;

ExecOptions.stdin (property)

stdin?: number | FILE;

ExecOptions.stdout (property)

stdout?: number | FILE;

ExecOptions.stderr (property)

stderr?: number | FILE;

ExecOptions.env (object property)

env?: {
[key: string | number]: string | number | boolean;
};

ExecOptions.uid (number property)

uid?: number;

ExecOptions.gid (number property)

gid?: number;

"quickjs:os".exec (exported function)

export function exec(args: Array<string>, options?: ExecOptions): number;

"quickjs:os".getpid (exported function)

Return the current process ID.

export function getpid(): number;

"quickjs:os".waitpid (exported function)

export function waitpid(pid: number, options?: number): [number, number];

"quickjs:os".WNOHANG (exported number)

var WNOHANG: number;

"quickjs:os".WUNTRACED (exported number)

var WUNTRACED: number;

"quickjs:os".WEXITSTATUS (exported function)

export function WEXITSTATUS(status: number): number;

"quickjs:os".WTERMSIG (exported function)

export function WTERMSIG(status: number): number;

"quickjs:os".WSTOPSIG (exported function)

export function WSTOPSIG(status: number): number;

"quickjs:os".WIFEXITED (exported function)

export function WIFEXITED(status: number): boolean;

"quickjs:os".WIFSIGNALED (exported function)

export function WIFSIGNALED(status: number): boolean;

"quickjs:os".WIFSTOPPED (exported function)

export function WIFSTOPPED(status: number): boolean;

"quickjs:os".WIFCONTINUED (exported function)

export function WIFCONTINUED(status: number): boolean;

"quickjs:os".dup (exported function)

export function dup(fd: number): number;

"quickjs:os".dup2 (exported function)

export function dup2(oldfd: number, newfd: number): number;

"quickjs:os".pipe (exported function)

export function pipe(): [number, number];

"quickjs:os".sleep (exported function)

export function sleep(delay_ms: number): void;

"quickjs:os".now (exported function)

Return a timestamp in milliseconds with more precision than Date.now(). The time origin is unspecified and is normally not impacted by system clock adjustments.

export function now(): number;

"quickjs:os".platform (exported value)

"win32" | "darwin" | "emscripten" | "wasm" | "freebsd" | "linux" | "unknown";

"quickjs:os".StructuredClonable (exported type)

| string
| number
| boolean
| null
| undefined
| Boolean
| String
| Date
| RegExp
| ArrayBuffer
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
| DataView
| SharedArrayBuffer
| {
[key: string | number]: StructuredClonable;
};

"quickjs:os".Worker (exported class)

class Worker {
constructor(
moduleFilename: string,
options?: {
overrideCode?: string;
},
);
static parent: Pick<Worker, "postMessage" | "onmessage">;
terminate(): void;
onmessage: null | ((event: { data: StructuredClonable }) => void);
| null
| ((event: {
message: string;
filename: string;
lineno: number;
error: Error | null;
}) => void);
}

Worker (constructor)

Create a Worker which runs the module at moduleFilename.

If options.overrideCode is present, the Worker instead runs a synthetic module with filename moduleFilename and source code options.overrideCode (JS source code string). In this case, moduleFilename is not read from disk and is only used as the module's assigned filename for import.meta, module resolution, etc.

If options.initialData is present, it'll be available within the worker as the static initialData property on the Worker constructor.

constructor(moduleFilename: string, options?: {
overrideCode?: string;
});

Worker.initialData (static StructuredClonable property)

If accessed within a Worker, and the Worker was constructed with non-undefined initialData, then this will be a structured clone of that initial data.

Outside of a worker, this is always undefined.

Worker.parent (static property)

Worker-side communication channel back to the parent context that invoked it (ie. the main thread).

static parent: Pick<Worker, "postMessage" | "onmessage">;

Worker.prototype.postMessage (method)

Worker.prototype.terminate (method)

Terminate the worker thread. Equivalent to setting onmessage to null.

terminate(): void;

Worker.prototype.onmessage (property)

onmessage: null | ((event: {
}) => void);

Worker.prototype.onerror (property)

Fires on the parent side whenever an uncaught exception escapes anywhere in the worker: top-level errors at startup, the worker's global onmessage throwing, timer / I/O / signal callbacks throwing, microtask rejections, and unhandled promise rejections.

The event is a plain object shaped like a WHATWG ErrorEvent (minus colno, which this event does not surface):

  • message — the error's message, or String(reason) for a non-Error throw.
  • filename — from the error's fileName own-prop when present, otherwise the worker's entry-module filename.
  • lineno — from the error's lineNumber own-prop, otherwise 0.
  • error — a real Error instance when the worker threw an Error (one of the nine recognized classes: Error, TypeError, RangeError, SyntaxError, ReferenceError, URIError, EvalError, AggregateError, InternalError, with user subclasses reified to base Error with .name preserved). null when the thrown value was not an Error.

Cycles and shared references in the error graph (e.g. err.cause === err, or shared nodes inside AggregateError.errors[]) are preserved, matching the HTML structured-clone algorithm.

A handler assigned same-tick as new Worker(...) is guaranteed to be in place before any error dispatch: the parent's event loop cannot drain and dispatch error-pipe messages until the current synchronous tick finishes, and the error-port registration (on which dispatch is gated) happens synchronously in the Worker ctor. Cross-tick late assignment (setTimeout(() => w.onerror = fn, 100)) is still racy with any error that fires before the timeout — such errors fall through to the stderr fallback. When onerror is unset, errors print to stderr in the same format as an uncaught exception would.

onerror: null | ((event: {
message: string;
filename: string;
lineno: number;
error: Error | null;
}) => void);

"quickjs:os".Win32Handle (exported class)

An opaque wrapper around a Win32 HANDLE.

Win32Handle objects cannot be created directly from JavaScript code. They are created by native functions like CreateProcess.

On non-Windows platforms, this class exists but no instances will ever be created.

class Win32Handle {
private constructor();
readonly [Symbol.toStringTag]: "Win32Handle";
}

Win32Handle (constructor)

private constructor();

"quickjs:os".CreateProcessOptions (exported type)

moduleName?: string;
flags?: number;
cwd?: string;
env?: {
[key: string]: string;
};
stdin?: FILE | number;
stdout?: FILE | number;
stderr?: FILE | number;
};

CreateProcessOptions.moduleName (string property)

The name of the module to be executed (maps to lpApplicationName).

moduleName?: string;

CreateProcessOptions.flags (number property)

Process creation flags (maps to dwCreationFlags).

flags?: number;

CreateProcessOptions.cwd (string property)

The working directory of the new process.

cwd?: string;

CreateProcessOptions.env (object property)

Environment variables for the new process. If not specified, the parent's environment is inherited. Values must be strings.

env?: {
[key: string]: string;
};

CreateProcessOptions.stdin (property)

FILE object or file descriptor number to use for the child's stdin.

stdin?: FILE | number;

CreateProcessOptions.stdout (property)

FILE object or file descriptor number to use for the child's stdout.

stdout?: FILE | number;

CreateProcessOptions.stderr (property)

FILE object or file descriptor number to use for the child's stderr.

stderr?: FILE | number;

"quickjs:os".CreateProcessResult (exported type)

CreateProcessResult.pid (number property)

The process ID of the newly created process.

pid: number;

CreateProcessResult.processHandle (Win32Handle property)

A Win32Handle for the process.

CreateProcessResult.tid (number property)

The thread ID of the primary thread of the newly created process.

tid: number;

CreateProcessResult.threadHandle (Win32Handle property)

A Win32Handle for the primary thread.

"quickjs:os".CreateProcess (exported value)

Create a new process using the Win32 CreateProcessW API.

  • @param commandLine — The command line to execute.
  • @param options — Optional settings for module name, flags, cwd, env, and stdio redirection.
  • @returns An object with pid, processHandle, tid, and threadHandle.

NOTE: this function is only present on windows

| undefined
| ((
commandLine: string | null,

"quickjs:os".WaitForSingleObject (exported value)

Wait for a Win32 handle to be signaled (wrapper for Win32 WaitForSingleObject).

  • @param handle — The handle to wait on.
  • @param timeoutMs — Timeout in milliseconds. Defaults to Infinity (INFINITE). Pass Infinity to wait indefinitely.
  • @returns One of the WAIT_* constants.

NOTE: this function is only present on windows

undefined | ((handle: Win32Handle, timeoutMs?: number) => number);

"quickjs:os".GetExitCodeProcess (exported value)

Retrieve the exit code of a process (wrapper for Win32 GetExitCodeProcess).

  • @param handle — A process handle.
  • @returns The exit code of the process.

NOTE: this function is only present on windows

var GetExitCodeProcess: undefined | ((handle: Win32Handle) => number);

"quickjs:os".TerminateProcess (exported value)

Terminate a process (wrapper for Win32 TerminateProcess).

  • @param handle — A process handle.
  • @param exitCode — The exit code to assign to the process.

NOTE: this function is only present on windows

undefined | ((handle: Win32Handle, exitCode: number) => void);

"quickjs:os".CloseHandle (exported value)

Close a Win32 handle. The handle will automatically be closed when the Win32Handle object is garbage-collected, but it's safe to close it yourself as well; a handle that has already been closed will not be closed again during garbage collection.

  • @param handle — The handle to close.

NOTE: this function is only present on windows

var CloseHandle: undefined | ((handle: Win32Handle) => void);

"quickjs:os".CreatePipeOptions (exported type)

inheritHandle?: boolean;
};

CreatePipeOptions.inheritHandle (boolean property)

Whether the pipe handles should be inheritable. Defaults to true.

inheritHandle?: boolean;

"quickjs:os".CreatePipeResult (exported type)

CreatePipeResult.readEnd (FILE property)

The read end of the pipe (a FILE object opened in binary read mode).

CreatePipeResult.writeEnd (FILE property)

The write end of the pipe (a FILE object opened in binary write mode).

"quickjs:os".CreatePipe (exported value)

Create an anonymous pipe (wrapper for Win32 CreatePipe).

Returns FILE objects for both ends of the pipe. The read end is opened in binary read mode ("rb") and the write end in binary write mode ("wb"). You can use all standard FILE methods (readAsString, getline, puts, write, read, close, etc.) on the returned objects.

  • @param options — Optional settings. inheritHandle defaults to true.
  • @returns An object with readEnd and writeEnd FILE properties.

NOTE: this function is only present on windows

var CreatePipe: undefined | ((options?: CreatePipeOptions) => CreatePipeResult);

"quickjs:os".WAIT_OBJECT_0 (exported value)

Win32 wait result constant: the object was signaled.

NOTE: this property is only present on windows

var WAIT_OBJECT_0: number | undefined;

"quickjs:os".WAIT_ABANDONED (exported value)

Win32 wait result constant: the object was an abandoned mutex.

NOTE: this property is only present on windows

var WAIT_ABANDONED: number | undefined;

"quickjs:os".WAIT_TIMEOUT (exported value)

Win32 wait result constant: the wait timed out.

NOTE: this property is only present on windows

var WAIT_TIMEOUT: number | undefined;

"quickjs:os".WAIT_FAILED (exported value)

Win32 wait result constant: the function call failed.

NOTE: this property is only present on windows

var WAIT_FAILED: number | undefined;

"quickjs:os".R_OK (exported number)

var R_OK: number;

"quickjs:os".W_OK (exported number)

var W_OK: number;

"quickjs:os".X_OK (exported number)

var X_OK: number;

"quickjs:os".F_OK (exported number)

var F_OK: number;

"quickjs:os".access (exported function)

export function access(path: string, accessMode: number): void;

"quickjs:os".execPath (exported function)

export function execPath(): string;

"quickjs:os".chmod (exported function)

export function chmod(path: string, mode: number): void;

"quickjs:os".gethostname (exported function)

export function gethostname(): string;