Lesson 12 / 30
The os Module
Inspect the platform, CPU count and memory of the host machine with the os module.
By Rahul Agarwal · 15 years in web development · Updated 1 Oct 2026
System info
Useful for logging, diagnostics, or scaling decisions (e.g. worker count).
import os from "node:os";
console.log(os.platform()); // 'linux'
console.log(os.cpus().length); // number of cores
console.log(os.totalmem()); // bytes
console.log(os.homedir());