Home Node.js Get system information using node.js

Get system information using node.js

Systeminformation is a very useful node.js library

The library can get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes

It is supported on multiple operating systems although not all functions are supported on every operating system

Installation

$ npm install systeminformation --save

Examples

Here are some examples of the functionality in this library

CPU information

const si = require('systeminformation')

si.cpu(function (data) {
    console.log('CPU Information:');
    console.log('- manufucturer: ' + data.manufacturer);
    console.log('- brand: ' + data.brand);
    console.log('- speed: ' + data.speed);
    console.log('- cores: ' + data.cores);
    console.log('- physical cores: ' + data.physicalCores);
    console.log('...');
})

You will see something like this

C:\Program Files\nodejs\node.exe .\test.js
CPU Information:
- manufucturer: AMD
- brand: Ryzen 5 3600 6-Core Processor
- speed: 3.6
- cores: 12
- physical cores: 6

Memory information

const si = require('systeminformation');

si.mem(function (data) {
    console.log('memory information:');
    console.log('- total: ' + data.total / 1024 / 1024 + ' Gb');
    console.log('- free: ' + data.free / 1024 / 1024 + ' Gb');
    console.log('- used: ' + data.used / 1024 / 1024 + ' Gb');
    console.log('...');
})

You will see something like this

memory information:
- used: 20863.59375 Gb
- free: 11855.3203125 Gb
- total: 32718.9296875 Gb

Operating system information

 

const si = require('systeminformation');

si.osInfo(function (data) {
    console.log('OS information:');
    console.log('- platform: ' + data.platform);
    console.log('- distro: ' + data.distro);
    console.log('- release: ' + data.release);
	console.log('- build: ' + data.build);
	console.log('- servicepack: ' + data.servicepack);
    console.log('...');
})

You will see something like this

OS information:
- platform: win32
- distro: Microsoft Windows 10 Pro
- release: 10.0.19042
- build: 19042
- servicepack: 0.0

More info

You can get visit https://github.com/sebhildebrandt/systeminformation

Full function reference with examples can be found at https://systeminformation.io.

You may also like