Skip to content
Tauri

@tauri-apps/plugin-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";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L36


Family

type Family: "unix" | "windows";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L91


OsType

type OsType:
| "linux"
| "windows"
| "macos"
| "ios"
| "android";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L34


Platform

type Platform:
| "linux"
| "macos"
| "ios"
| "freebsd"
| "dragonfly"
| "netbsd"
| "openbsd"
| "solaris"
| "android"
| "windows";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L22

Functions

arch()

function arch(): Promise<Arch>

Returns the current operating system architecture. Possible values are 'x86', 'x86_64', 'arm', 'aarch64', 'mips', 'mips64', 'powerpc', 'powerpc64', 'riscv64', 's390x', 'sparc64'.

Returns

Promise<Arch>

Example

import { arch } from '@tauri-apps/plugin-os';
const archName = await arch();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L132


eol()

function eol(): string

Returns the operating system-specific end-of-line marker.

  • \n on POSIX
  • \r\n on Windows

Returns

string

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L56


exeExtension()

function exeExtension(): Promise<string | null>

Returns the file extension, if any, used for executable binaries on this platform. Possible values are 'exe' and '' (empty string).

Returns

Promise<string | null>

Example

import { exeExtension } from '@tauri-apps/plugin-os';
const exeExt = await exeExtension();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L163


family()

function family(): Promise<Family>

Returns the current operating system family. Possible values are 'unix', 'windows'.

Returns

Promise<Family>

Example

import { family } from '@tauri-apps/plugin-os';
const family = await family();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L103


hostname()

function hostname(): Promise<string | null>

Returns the host name of the operating system.

Returns

Promise<string | null>

Example

import { hostname } from '@tauri-apps/plugin-os';
const hostname = await hostname();

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L175


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 '@tauri-apps/plugin-os';
const locale = await locale();
if (locale) {
// use the locale string here
}

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L149


platform()

function platform(): Promise<Platform>

Returns 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

Promise<Platform>

Example

import { platform } from '@tauri-apps/plugin-os';
const platformName = await platform();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L73


type()

function type(): Promise<OsType>

Returns the current operating system type. Returns 'linux' on Linux, 'macos' on macOS, 'windows' on Windows, 'ios' on iOS and 'android' on Android.

Returns

Promise<OsType>

Example

import { type } from '@tauri-apps/plugin-os';
const osType = await type();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L117


version()

function version(): Promise<string>

Returns the current operating system version.

Returns

Promise<string>

Example

import { version } from '@tauri-apps/plugin-os';
const osVersion = await version();

Since

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/os/guest-js/index.ts#L87


© 2024 Tauri Contributors. CC-BY / MIT