vael:os
Operating system target constants and host OS release metadata.
Available in both vjs (vaeljs) and vjs-lite (vaeljs-lite) runtimes.
Exposes compilation-target identifiers (platform, arch) using standard
cross-platform target names ("darwin" on macOS, "linux", "windows",
"amd64", "arm64", "386"), alongside release() for probing host OS
release and edition metadata. Installs no globals.
import ... from "vael:os"
vaeljs-core; vael-os (default) in vaeljs-lite-coreExample
Section titled “Example”import { arch, platform, release } from "vael:os";
console.log(`Running on ${platform}/${arch}`);const info = release();console.log(info.prettyName, info.variant);Functions
Section titled “Functions”release
Section titled “release”export function release(): OsRelease;
Probe the host operating system and return a frozen OsRelease metadata
object.
Reads /etc/os-release (falling back to /usr/lib/os-release) on Linux,
SystemVersion.plist on macOS, and RtlGetVersion / GetProductInfo on
Windows.
OsRelease — Frozen OsRelease record describing the host operating system.TypeError— when any argument is supplied.
import { release } from "vael:os";
const info = release();console.log(info.id, info.versionId, info.variant);Interfaces
Section titled “Interfaces”OsRelease
Section titled “OsRelease”export interface OsRelease {
readonly id: string;
readonly name: string;
readonly prettyName: string;
readonly version: string;
readonly versionId: string;
readonly codename: string;
readonly build: string;
readonly edition: string;
readonly variant: OsVariant;
}
Frozen operating system release metadata returned by release().
All string fields are always present (defaulting to "" when unavailable
on the host OS).
| Property | Type | Description | Since |
|---|---|---|---|
id readonly | string | Lowercase operating system identifier (for example "ubuntu", "fedora", "darwin", or "windows"). | v0.0.0-alpha.2 |
name readonly | string | Short operating system name (for example "Ubuntu", "macOS", or "Windows 11"). | v0.0.0-alpha.2 |
prettyName readonly | string | Human-readable display name (for example "Ubuntu 24.04.1 LTS" or "Windows 11 Pro"). | v0.0.0-alpha.2 |
version readonly | string | Full version string (for example "24.04.1 LTS (Noble Numbat)", "14.5", or "10.0.22631"). | v0.0.0-alpha.2 |
versionId readonly | string | Short machine-comparable version identifier (for example "24.04", "14.5", or "11"). | v0.0.0-alpha.2 |
codename readonly | string | Release codename when available (for example "noble", "bookworm", or "Sonoma"), or "" when unavailable. | v0.0.0-alpha.2 |
build readonly | string | Build identifier or kernel release fallback (for example "rolling", "23F79", or "22631"). | v0.0.0-alpha.2 |
edition readonly | string | Edition or variant label (for example "Workstation Edition", "Pro", or "Datacenter"). | v0.0.0-alpha.2 |
variant readonly | OsVariant | High-level OS role classification ("desktop", "server", "domain-controller", or "unknown"). | v0.0.0-alpha.2 |
Type Aliases
Section titled “Type Aliases”OsVariant
Section titled “OsVariant”export type OsVariant = "desktop" | "server" | "domain-controller" | "unknown";
High-level operating system role or edition classification returned in
OsRelease.variant.
Constants
Section titled “Constants”platform
Section titled “platform”export const platform:
| "darwin"
| "linux"
| "windows"
| "freebsd"
| "netbsd"
| "aix"
| "solaris"
| "illumos"
| "android"
| (string & {});
Compilation-target operating system identifier.
Uses standard cross-platform target names ("darwin" on macOS, "linux",
"windows", "freebsd", "netbsd", "aix", "solaris", "illumos",
"android") rather than legacy names. Constant from build time; performs
no runtime host probe.
import { platform } from "vael:os";
const sep = platform === "windows" ? "\\" : "/";console.log(sep);export const arch:
| "amd64"
| "arm64"
| "386"
| "arm"
| "riscv64"
| "ppc64le"
| "ppc64"
| "s390x"
| "loong64"
| (string & {});
Compilation-target CPU architecture identifier.
Uses normalized OCI/Go-style short architecture names ("amd64",
"arm64", "386", "arm", "riscv64", "ppc64le", "ppc64",
"s390x", "loong64"). Constant from build time; performs no runtime
host probe.
import { arch } from "vael:os";
if (arch === "amd64") { console.log("64-bit x86 target");}