Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

xen::os

Provides utilities for interacting with the operating system.

include os;

Public Functions

readtxt

readtxt (filename: string) -> string | null

Reads a file to a string.

readlines

readlines (filename: string) -> [string] | null

Read a file’s lines into an array.

readbytes

readbytes (filename: string) -> UInt8Array | null

Read a file into a byte array.

exit

exit (exit_code?: number) -> null

Exit the current process.

exec

exec (cmd: string, args?: [string]) -> null

Execute the specified command.

mkdir

mkdir (dir: string, overwrite?: bool) -> bool

Create a new directory. If overwrite is true and the directory already exists, it will be overwritten with the new, empty directory.

rmdir

rmdir (dir: string) -> bool

Deletes the specified directory. For files, use rm.

rm

rm (file: string) -> bool

Deletes the specified file. For directories, use rmdir.

exists

exists (path: string) -> bool

Returns whether the given directory or file exists.

sleep

sleep (duration: number) -> number

Sleeps the current process for duration seconds.