os is a built-in Node.js module that provides basic operating system-related utility methods, such as CPU architecture, platform, and memory usage. node-os-utils, os-utils, and systeminformation are third-party npm packages that extend this capability with richer metrics like real-time CPU load, disk I/O, network stats, and process details. These libraries help developers monitor system health, optimize resource usage, or expose diagnostics in backend services — though they differ significantly in scope, reliability, and maintenance status.
When building Node.js applications that interact with the host machine—whether for monitoring, diagnostics, or adaptive behavior—you’ll eventually need system-level data. While Node.js ships with a basic os module, many projects reach for third-party packages like node-os-utils, os-utils, or systeminformation. But these tools vary wildly in capability, accuracy, and maintenance. Let’s compare them head-to-head.
os-utils Is UnusableFirst, a critical note: os-utils is deprecated. Its npm page shows a deprecation warning, and its GitHub repo is archived with no updates since 2016. It doesn’t support modern Node.js versions and fails on current operating systems. Do not use it in any new project, and replace it immediately if found in legacy code.
// ❌ Avoid os-utils entirely
// const osu = require('os-utils'); // Deprecated — will break
Now, let’s focus on the three viable options.
All packages can retrieve fundamental OS details, but with different ergonomics.
os (built-in) gives you raw, synchronous access:
const os = require('os');
console.log(os.platform()); // 'darwin', 'win32', 'linux'
console.log(os.arch()); // 'x64', 'arm64'
console.log(os.totalmem()); // Total RAM in bytes
console.log(os.freemem()); // Free RAM in bytes
console.log(os.cpus().length); // Number of logical CPUs
node-os-utils wraps some of this but adds convenience methods:
const osu = require('node-os-utils');
osu.mem.used(); // Promise<number> — used memory in MB
osu.mem.free(); // Promise<number> — free memory in MB
osu.os.platform(); // Promise<string> — same as os.platform()
systeminformation goes far beyond basics:
const si = require('systeminformation');
si.osInfo().then(info => {
console.log(info.platform); // 'darwin'
console.log(info.distro); // 'Ubuntu', 'Windows 11', 'macOS'
console.log(info.kernel); // Kernel version
});
si.mem().then(mem => {
console.log(mem.total); // Total RAM in bytes
console.log(mem.free); // Free RAM in bytes
console.log(mem.active); // Active memory (Linux/macOS)
});
💡 Key insight: If you only need
platform()ortotalmem(), stick with the built-inos. No need to add a dependency.
This is where third-party packages shine — and diverge sharply.
os only gives static CPU info (model, speed, count), not dynamic load:
// os cannot measure current CPU usage
const cpus = os.cpus(); // Array of { model, speed, times: { user, sys, ... } }
// You’d have to manually diff `times` over intervals to estimate load
node-os-utils provides a simple async method:
const osu = require('node-os-utils');
osu.cpu.usage().then(usage => {
console.log(`${usage}%`); // e.g., 23.5
});
systeminformation offers more granular control:
const si = require('systeminformation');
si.currentLoad().then(load => {
console.log(load.avgLoad); // Overall % usage
console.log(load.cpus); // Per-core usage array
console.log(load.timestamp); // When measured
});
os has no disk or network metrics beyond mount points (os.networkInterfaces() gives IP config, not traffic).
node-os-utils supports basic disk space and network stats:
const osu = require('node-os-utils');
osu.drive.info('/').then(info => {
console.log(info.freePercentage); // e.g., 45
});
osu.netstat.inOut().then(stats => {
console.log(stats.input); // Bytes received
console.log(stats.output); // Bytes sent
});
systeminformation delivers exhaustive I/O data:
const si = require('systeminformation');
si.fsSize().then(disks => {
disks.forEach(d => {
console.log(d.fs, d.size, d.available, d.use);
});
});
si.networkStats().then(stats => {
stats.forEach(iface => {
console.log(iface.rx_bytes, iface.tx_bytes, iface.operstate);
});
});
os works everywhere Node.js runs — no surprises.
node-os-utils uses shell commands under the hood (top, df, wmic), which can:
Example internal implementation (simplified):
// node-os-utils may run:
// Linux: top -bn1 | grep "Cpu(s)"
// Windows: wmic cpu get LoadPercentage
systeminformation avoids shell commands where possible, using native Node.js APIs, /proc files (Linux), WMI (Windows), and ioreg (macOS). It includes extensive fallbacks and validation, making it far more reliable across platforms.
os: Synchronous, minimal, zero-config. Great for simple checks.node-os-utils: Promise-based but inconsistent — some methods return numbers, others objects. Limited error handling.systeminformation: Uniform promise-based API, rich return objects, and optional callback support. Includes TypeScript definitions out of the box.// systeminformation example with error handling
si.graphics()
.then(data => console.log(data.controllers))
.catch(err => console.error('GPU info failed:', err));
systeminformation SupportsNeed any of these? Only systeminformation delivers:
// Get battery status (laptops only)
si.battery().then(bat => {
console.log(bat.hasBattery, bat.percent, bat.isCharging);
});
// List all running processes
si.processes().then(proc => {
console.log(proc.all.length, proc.running); // Total and active count
});
| Scenario | Recommended Package |
|---|---|
| Detect OS/platform for config logic | os (built-in) |
| Simple health check (free mem, CPU %) | node-os-utils |
| Production monitoring / diagnostics dashboard | systeminformation |
Legacy code using os-utils | Migrate immediately |
os for basic, static system info. It’s fast, reliable, and dependency-free.node-os-utils only for quick prototypes where you accept potential inaccuracies and limited platform coverage.systeminformation for any serious application requiring trustworthy, detailed, and up-to-date system telemetry. Its active maintenance and depth make it the professional standard.Remember: system introspection is inherently platform-specific. Always test your chosen package on every target OS — especially if you’re deploying to containers, cloud VMs, or embedded environments where hardware access may be restricted.
Choose the built-in os module when you only need basic, stable information like total memory, hostname, platform, or CPU count. It’s ideal for configuration logic, environment detection, or lightweight telemetry where external dependencies are discouraged and real-time performance metrics aren’t required.
Choose node-os-utils if you need lightweight, cross-platform access to common system metrics like CPU usage percentage, free memory, and drive space without heavy dependencies. It’s suitable for simple monitoring dashboards or health checks where precision isn’t critical, but avoid it for production systems requiring high accuracy or detailed hardware introspection.
Do not use os-utils in new projects — it has been officially deprecated on npm and its GitHub repository is archived. The package hasn’t been updated in years and lacks support for modern Node.js versions or current operating systems. Migrate existing usage to alternatives like systeminformation or node-os-utils.
Choose systeminformation when you need comprehensive, accurate, and up-to-date system diagnostics across Windows, macOS, and Linux — including battery status, graphics cards, USB devices, network interfaces, and real-time sensor data. It’s well-maintained, actively developed, and ideal for professional monitoring tools, DevOps utilities, or applications requiring deep hardware insight.
This is a Node.js Core Module
Really, there's no need, just require/import it :)