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.
+In this section you will learn how to get general systeminformation data. We will also cover the "get" and "get-all" functions to get partial or all data with one single call.
For function reference and examples we assume, that we imported systeminformation as follows:
const si = require('systeminformation');
Lib-Version and Time/Timezone
@@ -128,6 +128,81 @@Keep in mind, that there is another function si.versions() that will return versions of other system libraries and software packages
+Get Defined Result Object
+Normally you would call each of the functions (where you want to have detailed system information) seperately. The docs pages contain a full reference (with examples) for each available function. But there is also another really handy way to get a self-defined information object in one single call:
+The si.get() function is an alternative, where you can obtain several system information data in one call. You can define a json object which represents the data structure you are expecting and the si.get() call will then return all of the requested data in a single result object
+| Function | +Result object | +Linux | +BSD | +Mac | +Win | +Sun | +Comments | +
|---|---|---|---|---|---|---|---|
| si.get(valueObject,cb) | +{...} | +X | +X | +X | +X | +X | +get partial data at once Specify return object for all values that should be returned: |
+
| + |
+ Example+
+
+{
+ cpu: {
+ manufacturer: 'Intel®',
+ brand: 'Core™ i7-8569U',
+ vendor: 'GenuineIntel',
+ family: '6',
+ model: '142',
+ stepping: '10',
+ revision: '',
+ voltage: '',
+ speed: '2.80',
+ speedmin: '2.80',
+ speedmax: '2.80',
+ governor: '',
+ cores: 8,
+ physicalCores: 4,
+ processors: 1,
+ socket: '',
+ cache: { l1d: 32768, l1i: 32768, l2: 262144, l3: 8388608 }
+ },
+ osInfo: {
+ platform: 'darwin',
+ release: '10.15.4'
+ },
+ system: {
+ model: 'MacBookPro15,2',
+ manufacturer: 'Apple Inc.'
+ }
+}
+
+ | ||||||
The key names of the valueObject must be exactly the same as the representing function within systeminformation.
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:
| 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 |
- ||||||
| si.get(valueObject,cb) | -{...} | -X | -X | -X | -X | -X | -get partial data at once Specify return object for all values that should be returned. See example: |
-
| - |
- Example-
-
-{
- cpu: {
- manufacturer: 'Intel®',
- brand: 'Core™ i7-8569U',
- vendor: 'GenuineIntel',
- family: '6',
- model: '142',
- stepping: '10',
- revision: '',
- voltage: '',
- speed: '2.80',
- speedmin: '2.80',
- speedmax: '2.80',
- governor: '',
- cores: 8,
- physicalCores: 4,
- processors: 1,
- socket: '',
- cache: { l1d: 32768, l1i: 32768, l2: 262144, l3: 8388608 }
- },
- osInfo: {
- platform: 'darwin',
- release: '10.15.4'
- },
- system: {
- model: 'MacBookPro15,2',
- manufacturer: 'Apple Inc.'
- }
-}
-
- | ||||||
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