os vs node-os-utils vs os-utils vs systeminformation
Accessing System and OS Information in Node.js Applications
osnode-os-utilsos-utilssysteminformationSimilar Packages:

Accessing System and OS Information in Node.js Applications

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.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
os810,73120-05 years agoMIT
node-os-utils293,9021311.14 MB145 months agoMIT
os-utils0247-1113 years agoMIT
systeminformation03,063846 kB1114 days agoMIT

Accessing System Metrics in Node.js: Built-in vs Third-Party Packages Compared

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.

⚠️ Deprecation Alert: os-utils Is Unusable

First, 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.

🧱 Core Capabilities: What Can Each Package Actually Do?

Basic System Info (Platform, Architecture, Memory)

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() or totalmem(), stick with the built-in os. No need to add a dependency.

📊 Real-Time Performance Metrics: CPU, Disk, Network

This is where third-party packages shine — and diverge sharply.

CPU Usage Percentage

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
});

Disk and Network I/O

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);
  });
});

🖥️ Cross-Platform Support and Accuracy

os works everywhere Node.js runs — no surprises.

node-os-utils uses shell commands under the hood (top, df, wmic), which can:

  • Fail silently on unsupported systems
  • Return inaccurate values due to parsing errors
  • Block the event loop during command execution

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.

🛠️ API Design and Developer Experience

  • 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));

🔍 Advanced Use Cases Only systeminformation Supports

Need any of these? Only systeminformation delivers:

  • Battery charge level and health
  • USB device enumeration
  • Graphics card VRAM and driver version
  • Process list with memory/CPU per PID
  • Temperature sensors and fan speeds
  • BIOS and motherboard details
// 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
});

📌 When to Use Which Package

ScenarioRecommended Package
Detect OS/platform for config logicos (built-in)
Simple health check (free mem, CPU %)node-os-utils
Production monitoring / diagnostics dashboardsysteminformation
Legacy code using os-utilsMigrate immediately

💡 Final Recommendation

  • Default to os for basic, static system info. It’s fast, reliable, and dependency-free.
  • Use node-os-utils only for quick prototypes where you accept potential inaccuracies and limited platform coverage.
  • Choose 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.

How to Choose: os vs node-os-utils vs os-utils vs systeminformation

  • os:

    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.

  • node-os-utils:

    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.

  • os-utils:

    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.

  • systeminformation:

    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.

README for os

os

This is a Node.js Core Module

There's no need to install through npm

Really, there's no need, just require/import it :)

API

https://nodejs.org/api/os.html