os
Provides operating system-related utility methods and properties.
Type Aliases
Arch
type Arch: | "x86" | "x86_64" | "arm" | "aarch64" | "mips" | "mips64" | "powerpc" | "powerpc64" | "riscv64" | "s390x" | "sparc64";Family
type Family: "unix" | "windows";OsType
type OsType: | "linux" | "windows" | "macos" | "ios" | "android";Platform
type Platform: | "linux" | "macos" | "ios" | "freebsd" | "dragonfly" | "netbsd" | "openbsd" | "solaris" | "android" | "windows";Functions
arch()
function arch(): ArchReturns the current operating system architecture.
Possible values are 'x86', 'x86_64', 'arm', 'aarch64', 'mips', 'mips64', 'powerpc', 'powerpc64', 'riscv64', 's390x', 'sparc64'.
Returns
Example
import { arch } from '@crabnebula/taurify-api/os';const archName = arch();eol()
function eol(): stringReturns the operating system-specific end-of-line marker.
\non POSIX\r\non Windows
Returns
string
exeExtension()
function exeExtension(): stringReturns the file extension, if any, used for executable binaries on this platform. Possible values are 'exe' and '' (empty string).
Returns
string
Example
import { exeExtension } from '@crabnebula/taurify-api/os';const exeExt = exeExtension();family()
function family(): FamilyReturns the current operating system family. Possible values are 'unix', 'windows'.
Returns
Example
import { family } from '@crabnebula/taurify-api/os';const family = family();hostname()
function hostname(): Promise<string | null>Returns the host name of the operating system.
Returns
Promise<string | null>
Example
import { hostname } from '@crabnebula/taurify-api/os';const hostname = await hostname();locale()
function locale(): Promise<string | null>Returns a String with a BCP-47 language tag inside. If the locale couldn’t be obtained, null is returned instead.
Returns
Promise<string | null>
Example
import { locale } from '@crabnebula/taurify-api/os';const locale = await locale();if (locale) { // use the locale string here}platform()
function platform(): PlatformReturns a string describing the specific operating system in use.
The value is set at compile time. Possible values are 'linux', 'macos', 'ios', 'freebsd', 'dragonfly', 'netbsd', 'openbsd', 'solaris', 'android', 'windows'
Returns
Example
import { platform } from '@crabnebula/taurify-api/os';const platformName = platform();type()
function type(): OsTypeReturns the current operating system type. Returns 'linux' on Linux, 'macos' on macOS, 'windows' on Windows, 'ios' on iOS and 'android' on Android.
Returns
Example
import { type } from '@crabnebula/taurify-api/os';const osType = type();version()
function version(): stringReturns the current operating system version.
Returns
string
Example
import { version } from '@crabnebula/taurify-api/os';const osVersion = version();