Process

process.platform

Identifies the platform for which Node was compiled, such as linux, win32 or darwin. Use it for platform-specific behavior, not to infer security capabilities. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].

Formal Syntax & Structure

nodejs syntaxnodejs
process.platform

Return Value

string

Platform identifier.

Working Example

Example Snippetnodejs
import os from 'node:os';console.log(process.platform === os.platform());
Node.js Reference