In this section you will learn how to get general systeminformation data. We will also cover the "get-all" functions to get all data at once.
For function reference and examples we assume, that we imported systeminformation as follows:
const si = require('systeminformation');
Lib-Version and Time/Timezone
The first two functions just gibe back system information library version and time/timezone information of your machine:
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|---|---|---|---|---|---|---|---|
| si.version() | : string | X | X | X | X | X | lib version (no callback/promise) |
| si.time() | {...} | X | X | X | X | X | object (no callback/promise) with: |
| current | X | X | X | X | X | local (server) time | |
| uptime | X | X | X | X | X | uptime | |
| timezone | X | X | X | X | X | e.g. GMT+0200 | |
| timezoneName | X | X | X | X | X | e.g. CEST |
Keep in mind, that there is another function si.versions() that will return versions of other system libraries and software packages
Get All At Once
The following three functions si.getStaticData(), si.getDynamicData() and si.getAllData() will return most of the available data in a single result object:
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|---|---|---|---|---|---|---|---|
| si.getStaticData(cb) | {...} | X | X | X | X | X | all static data at once |
| si.getDynamicData(srv,iface,cb) | {...} | X | X | X | X | X | all dynamic data at once Specify services and interfaces to monitor Defaults to first external network interface Pass "*" for ALL services (linux/win only) Pass "*" for ALL network interfaces |
| si.getAllData(srv,iface,cb) | {...} | X | X | X | X | X | all data at once Specify services and interfaces to monitor Defaults to first external network interface Pass "*" for ALL services (linux/win only) Pass "*" for ALL network interfaces |
Static data is all hardware related (or more or less constant) data like system, baseboard, bios, OS, versions, cpu, network interfces, memory and disk layout
Dynamic data will return user, cpu-speed, load, processes, services, temperature, file system, network and disk stats, ...
As not all funtions are supported in each operating system the result object might be different in each OS.
ATTENTION: Use this only if you really need ALL information. Especially on Windows this can take really long (up to 20 seconds) because the underlying WMIC command is very slow when using it the first time.