Files
cell/docs/api/modules/os.md
2025-02-09 00:07:01 -06:00

2.1 KiB

os

os

make_transform

Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.

clean_transforms

Force an update on all transforms to remove dangling references or perform house-keeping.

platform

Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.

arch

Return the CPU architecture string for this system (e.g. 'x64', 'arm64').

totalmem

Return the total system RAM in bytes.

freemem

Return the amount of free system RAM in bytes, if known.

hostname

Return the system's hostname, or an empty string if not available.

version

Return the OS or kernel version string, if the platform provides it.

kill

Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.

exit

Exit the application with the specified exit code.

now

Return current time (in seconds as a float) with high resolution.

openurl

Open the provided URL in the default web browser, if possible.

make_timer

Create a new timer object that will call a specified function after a certain delay.

update_timers

Advance all timers by the provided time delta (in seconds).

sleep

Block execution for the specified number of seconds.

battery_pct

Return the battery level (percentage) or negative if unknown.

battery_voltage

Return the current battery voltage in volts, if available.

battery_seconds

Return the estimated remaining battery time in seconds, or negative if unknown.

power_state

Return a string describing power status: 'on battery', 'charging', 'charged', etc.

on

Register a global callback for certain engine-wide or system-level events.

rt_info

Return internal QuickJS runtime info, such as object counts.

rusage

Return resource usage stats for this process, if the platform supports it.

mallinfo

Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.

env

Fetch the value of a given environment variable, or undefined if it doesn't exist.

system

Execute a shell command using the system() call. Returns the command's exit code.