Version 6 is a complete rewrite in TypeScript, but the API stayed as close as possible to version 5 - most code keeps working after the update. This guide walks through everything you may need to change. For the full list of changes see Version 6 Changes.
Checklist
- Node.js >= 20.0
- no callbacks - use async / await or promises
- await also si.time() and si.version()
- graphics() → gpu() and displays()
- renamed functions: cpuCurrentLoad(), cpuFullLoad(), inetCheckSite()
- checks for null on unsupported platforms
- imports: no deep dist/... paths, TypeScript types
- macOS (Apple Silicon): macos-smc instead of macos-temperature-sensor
1. Installation and Node.js
Version 6 requires Node.js 20.0 or newer. Bun and Deno are supported as well. While version 6 is a release candidate, install it with the next tag:
$ npm install systeminformation@next
If you need to stay on version 5 (e.g. older Node.js versions), pin the major version:
$ npm install systeminformation@5
2. Callbacks are removed
In version 5 every function optionally accepted a callback. In version 6 all functions only return a promise.
Version 5
si.cpu(data => {
console.log(data.brand);
});
Version 6
const data = await si.cpu();
console.log(data.brand);
// or with promises
si.cpu().then(data => console.log(data.brand));
A callback passed in version 6 is never called. Search your code for function calls with a function argument, e.g. si.mem(... => or function (data).
The only exception is si.observe(valueObject, interval, callback) - its callback is still called on every change, exactly as in version 5.
3. time() and version() are asynchronous
time() and version() were synchronous in version 5. Now all functions are async:
Version 5
const t = si.time();
console.log(si.version(), t.uptime);
Version 6
const t = await si.time();
console.log(await si.version(), t.uptime);
Without await you get a pending promise instead of the value - e.g. t.uptime is undefined.
4. graphics() is split into gpu() and displays()
graphics() returned one object with two arrays. Version 6 has two functions, each returning a plain array:
Version 5
const { controllers, displays } = await si.graphics();
Version 6
const controllers = await si.gpu();
const displays = await si.displays();
graphics() is still available as deprecated wrapper and returns the version 5 result { controllers, displays }, so existing code keeps working - also in si.get({ graphics: '...' }). It will be removed in a future major version.
5. Renamed functions
Some functions were renamed for naming consistency. The old names still work as deprecated aliases (marked @deprecated in the type declarations) but will be removed in a future major version:
| Version 5 | Version 6 |
|---|---|
| currentLoad() | cpuCurrentLoad() |
| fullLoad() | cpuFullLoad() |
| inetChecksite() | inetCheckSite() |
| graphics() | gpu(), displays() |
6. Changed results
Unsupported platforms: empty results instead of null
If a function is not supported on the current platform, version 6 returns [] for array results, the default object (all fields present) for object results and '' for string results instead of null. Checks like if (data === null) no longer match:
// version 5
if (usbDevices === null) { ... }
// version 6
if (!usbDevices.length) { ... }
inetLatency(), diskSpeed(), inetSpeed() and processFocused() still return null when there is no result. dockerInfo() returns the default object instead of {} when Docker is not available.
Changed values
| Function | Change |
|---|---|
| disksIO() | rWaitTime, wWaitTime, tWaitTime are the wait time of the last interval in ms (instead of the total since boot) and null on the first call - same convention as rIO_sec |
| cpuCurrentLoad() | Linux: iowait is now part of the total - currentLoadIdle is lower by the iowait share, all categories add up to 100% |
| osInfo() | distro reports flavors and derivatives, e.g. Kubuntu instead of Ubuntu, Raspberry Pi OS instead of Debian GNU/Linux - adapt checks like distro === 'Ubuntu' |
| dockerContainerProcesses() | pidHost, ppid, pgid, nice, rss, vsz are numbers (null if not available) instead of strings |
7. Imports and TypeScript
Entry points
require('systeminformation') works as before. Deep imports like require('systeminformation/lib/cpu') or .../dist/... are no longer possible - only the documented entry points of the exports map are importable:
require('systeminformation'); // whole library
require('systeminformation/cpu'); // single function
require('systeminformation/linux'); // single operating system
require('systeminformation/linux/cpu'); // single function of a single operating system
TypeScript types
Version 5 shipped one hand written declaration file with the namespace Systeminformation (e.g. Systeminformation.CpuData). Version 6 generates the declarations from the source - the return types are inferred automatically, the type names can be imported directly:
// version 5
import { Systeminformation } from 'systeminformation';
let data: Systeminformation.CpuData;
// version 6
import type { CpuData } from 'systeminformation/common/types';
let data: CpuData;
This requires "moduleResolution" node16, nodenext or bundler in your tsconfig.json - the legacy node resolution ignores the exports map.
Bundlers
Single executable tools that do not support dynamic import() (e.g. pkg) are not supported by version 6 - see Known Issues.
8. macOS temperature (Apple Silicon)
The optional package macos-temperature-sensor is no longer used. Install macos-smc instead:
$ npm install macos-smc
It provides cpuTemperature(), temperatureGpu in gpu(), fans() and the real current frequency in cpuCurrentSpeed(). cpuTemperature().main is now the average of the CPU sensors (max the hottest one), chipset is null. Values are read from the SMC, so they may differ slightly from version 5.
Need Help?
If something does not work as expected after the migration, please check the Known Issues and feel free to open an issue on github.