OS Utils

0.0.14 · abandoned · verified Sun Apr 19

The `os-utils` package is a Node.js library offering fundamental operating system utility functions. It enables developers to retrieve basic system metrics such as CPU usage (calculated per second, not as an average), total and free memory, platform identification, and system/process uptime. The package's latest version, 0.0.14, was released on October 30, 2012, signifying that its development has ceased and it is no longer actively maintained. Its release cadence was effectively non-existent after this initial publication. Compared to contemporary system monitoring libraries like `node-os-utils` or `systeminformation`, `os-utils` provides a very limited, callback-based API, lacks modern features such as TypeScript support, sophisticated error handling, or intelligent caching mechanisms, making it unsuitable for modern Node.js applications or environments requiring robust system insights.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `os-utils` and retrieve various system metrics such as CPU usage, memory information, and system details using its callback-based API.

const os = require('os-utils');

// Get CPU usage for the next second
os.cpuUsage(function(v) {
  console.log('CPU Usage (%): ' + v);
});

// Get free CPU for the next second
os.cpuFree(function(v) {
  console.log('CPU Free (%): ' + v);
});

// Get platform name
console.log('Platform:', os.platform());

// Get number of CPUs
console.log('CPU Count:', os.cpuCount());

// Get current free memory in MB
console.log('Free Memory (MB):', os.freemem());

// Get total memory in MB
console.log('Total Memory (MB):', os.totalmem());

// Get free memory percentage
console.log('Free Memory Percentage (%):', os.freememPercentage());

view raw JSON →