os.type()

Returns the operating system name as reported by uname.

Since Node 0.3 Spec ↗

Syntax

os.type()

Returns

string — e.g. 'Linux', 'Darwin', 'Windows_NT'.

Examples

import { type } from 'node:os';

console.log(type());
Output
Darwin
import { type, release } from 'node:os';

console.log(`${type()} ${release()}`);
Output
Linux 6.5.0-generic

Notes

Returns the uname-style OS name (`'Darwin'` for macOS, `'Windows_NT'` for Windows). For programmatic branching prefer the normalized `os.platform()` values instead.

See also