OS Module in Node.js

From the Node.js Core Modules cheat sheet ยท Process & OS ยท verified Jul 2026

OS Module

Get operating system information and utilities

javascript
const os = require('os');

// System info
os.platform();  // 'darwin', 'linux', 'win32'
os.arch();      // 'x64', 'arm'
os.hostname();
os.cpus();
os.totalmem();
os.freemem();

// User info
os.userInfo();
os.homedir();
๐Ÿ’ก Useful for system monitoring and diagnostics
๐Ÿ“Œ os.platform() returns darwin, win32, linux
โšก os.cpus() for CPU info and core count
๐ŸŸข Essential for cross-platform apps
๐Ÿ”— Related: systeminformation for detailed stats

Continue with Node.js Core Modules

Save the full cheat sheet or work through every related task.

More Node.js tasks

Back to the full Node.js Core Modules cheat sheet