Runtime Documentation
Scope: global
fetch
fetch(url: string, options: { method?: string, headers?: Record<string, string>, body?: string }): Promise<{ status: number, ok: boolean, text(): Promise<string>, json(): Promise<any> }>
Performs an HTTP request. Returns a Promise that resolves to a Response object with status, ok, text(), and json() fields.
Parameters:
url(string): The URL to request.options({ method?: string, headers?: Record<string, string>, body?: string }): Optional request options: HTTP method (default GET), headers, and body.
Returns: Promise<{ status: number, ok: boolean, text(): Promise<string>, json(): Promise<any> }>
Scope: console
log
log(...args: any)
Logs a message to the console output.
Parameters:
...args(any): Values to log, formatted as a space-separated string.
info
info(...args: any)
Logs an informational message, prefixed with [info].
Parameters:
...args(any): Values to log, formatted as a space-separated string.
debug
debug(...args: any)
Logs a debug message, prefixed with [debug].
Parameters:
...args(any): Values to log, formatted as a space-separated string.
warn
warn(...args: any)
Logs a warning message, prefixed with [warn].
Parameters:
...args(any): Values to log, formatted as a space-separated string.
error
error(...args: any)
Logs an error message, prefixed with [error].
Parameters:
...args(any): Values to log, formatted as a space-separated string.
Scope: fs
readFileSync
readFileSync(path: string): string
Reads the entire contents of a file synchronously.
Parameters:
path(string): Path to the file.
Returns: string
writeFileSync
writeFileSync(path: string, data: string)
Writes data to a file, replacing it if it already exists.
Parameters:
path(string): Destination path.data(string): Content to write.
appendFileSync
appendFileSync(path: string, data: string)
Appends data to a file, creating it if it does not exist.
Parameters:
path(string): Path to the file.data(string): Content to append.
existsSync
existsSync(path: string): boolean
Returns true if the path exists, false otherwise.
Parameters:
path(string): Path to check.
Returns: boolean
readdirSync
readdirSync(path: string): string[]
Returns an array of file and directory names inside the given directory.
Parameters:
path(string): Directory path.
Returns: string[]
mkdirSync
mkdirSync(path: string, options: { recursive?: boolean })
Creates a directory. Pass { recursive: true } to create intermediate directories.
Parameters:
path(string): Directory path to create.options({ recursive?: boolean }): Optional. Setrecursive: trueto create all intermediate directories.
unlinkSync
unlinkSync(path: string)
Removes a file.
Parameters:
path(string): Path to the file to remove.
renameSync
renameSync(oldPath: string, newPath: string)
Renames or moves a file.
Parameters:
oldPath(string): Current path of the file.newPath(string): New path of the file.
copyFileSync
copyFileSync(src: string, dest: string)
Copies a file from one path to another.
Parameters:
src(string): Source path.dest(string): Destination path.
rmSync
rmSync(path: string, options: { recursive?: boolean, force?: boolean })
Removes a file or directory. Pass { recursive: true } to remove a directory tree, { force: true } to suppress errors when the path does not exist.
Parameters:
path(string): Path to remove.options({ recursive?: boolean, force?: boolean }): Optional.recursive: trueremoves a directory tree;force: trueignores missing-path errors.
statSync
statSync(path: string): { size: number, mtimeMs: number, isFile(): boolean, isDirectory(): boolean }
Returns metadata about a file or directory.
Parameters:
path(string): Path to inspect.
Returns: { size: number, mtimeMs: number, isFile(): boolean, isDirectory(): boolean }