Skip to content
Tauri
Releases

@tauri-apps/plugin-os

Provides operating system-related utility methods and properties.

Type Aliases

Arch

Arch: 'x86' |
'x86_64' |
'arm' |
'aarch64' |
'mips' |
'mips64' |
'powerpc' |
'powerpc64' |
'riscv64' |
's390x' |
'sparc64';

Source: index.ts:36


Family

Family: 'unix' | 'windows';

Source: index.ts:91


OsType

OsType: 'linux' | 'windows' | 'macos' | 'ios' | 'android';

Source: index.ts:34


Platform

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

Source: index.ts:22

Functions

arch()

arch(): Promise< Arch >

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

Example

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

Since

2.0.0

Returns

Promise< Arch >

Source: index.ts:132


eol()

eol(): string

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

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

Since

2.0.0

Returns

string

Source: index.ts:56


exeExtension()

exeExtension(): Promise< string | null >

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

Example

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

Since

2.0.0

Returns

Promise< string | null >

Source: index.ts:163


family()

family(): Promise< Family >

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

Example

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

Since

2.0.0

Returns

Promise< Family >

Source: index.ts:103


hostname()

hostname(): Promise< string | null >

Returns the host name of the operating system.

Example

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

Returns

Promise< string | null >

Source: index.ts:175


locale()

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.

Example

import { locale } from '@tauri-apps/plugin-os';
const locale = await locale();
if (locale) {
// use the locale string here
}

Since

2.0.0

Returns

Promise< string | null >

Source: index.ts:149


platform()

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'

Example

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

Since

2.0.0

Returns

Promise< Platform >

Source: index.ts:73


type()

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.

Example

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

Since

2.0.0

Returns

Promise< OsType >

Source: index.ts:117


version()

version(): Promise< string >

Returns the current operating system version.

Example

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

Since

2.0.0

Returns

Promise< string >

Source: index.ts:87


© 2024 Tauri Contributors. CC-BY / MIT