Registry / observability / os-utils

os-utils

JSON →
library0.2.0jsnpmunverified

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.

npm install os-utils
INSTALL
IMPORT
SIG · OS-UTILS
O
os-utils
observabilityjavascriptv0.2.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

module object
✓ const os = require('os-utils');
✗ import os from 'os-utils';
This package is a CommonJS module from 2012. ESM `import` syntax will result in an `ERR_REQUIRE_ESM` error in most modern Node.js environments unless specific compatibility flags or bundler configurations are used. Always use `require()`.
cpuUsage
✓ const os = require('os-utils'); os.cpuUsage(function(v) { /* ... */ });
✗ import { cpuUsage } from 'os-utils';
Functions like `cpuUsage` are properties of the default exported module object. They are accessed via `os.cpuUsage()`, not as named exports.
freememPercentage
✓ const os = require('os-utils'); os.freememPercentage();
✗ import { freememPercentage } from 'os-utils';
Similar to `cpuUsage`, this is a method on the default module object. Attempts to destructure or directly import it will fail.

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());
Debug
Known issues
breakingThe `os-utils` package is completely unmaintained, with its last update over a decade ago (version 0.0.14 published in October 2012). It is highly likely to have compatibility issues with modern Node.js versions and environments.
fix
Migrate to actively maintained alternatives like `node-os-utils` (https://www.npmjs.com/package/node-os-utils) or `systeminformation` (https://www.npmjs.com/package/systeminformation) for reliable system monitoring.
affects: >=0.0.14
gotchaThe package uses a callback-based API, which is an outdated pattern in modern asynchronous JavaScript. Integrating it into Promise-based or async/await codebases requires manual promisification or wrapper functions.
fix
Consider wrapping `os-utils` functions in Promises for better integration, or, preferably, switch to a modern library that provides native Promise support.
affects: >=0.0.1
gotchaThe `cpuUsage` and `cpuFree` functions calculate CPU usage for 'the next second' and are not true averages like those provided by Node.js's native `os` module or other monitoring tools. This can lead to misleading or inconsistent metrics.
fix
Be aware of this distinction when interpreting CPU metrics. For more accurate average CPU usage, consider using the native `os.cpus()` module with custom calculation logic or a more robust monitoring library.
affects: >=0.0.1
breakingBeing an unmaintained package, `os-utils` may contain unpatched security vulnerabilities. Directly interacting with operating system APIs through outdated code poses a significant supply chain risk.
fix
Avoid using `os-utils` in production environments. Prioritize secure, actively maintained packages for any OS-level interactions to mitigate potential security risks.
affects: >=0.0.1
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module ... not supported. Instead change the require of ... to a dynamic import()
Attempting to use `require('os-utils')` within an ECMAScript Module (ESM) file or project configured as 'type': 'module' in `package.json`.
fix
Ensure your file is a CommonJS module (e.g., ends with `.cjs` or `package.json` specifies `'type': 'commonjs'`) or refactor your project to use an ESM-compatible system monitoring library. You *cannot* `import` this package directly as it's pure CommonJS.
TypeError: os.cpuUsage is not a function
Incorrectly trying to destructure the module or using an import syntax that results in `os` not being the module object, or the `os-utils` package wasn't installed correctly.
fix
Always import `os-utils` using `const os = require('os-utils');` and access its methods as `os.methodName()`. Verify `npm install os-utils` completed successfully.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
2
Anthropic
1
Resources
os-utils — npm install os-utils · libregistry