systeminformation 5.28.3 → 5.28.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cpu.js +5 -5
- package/lib/filesystem.js +15 -15
- package/lib/util.js +39 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ changes!):
|
|
|
99
99
|
- better uuid function to get unique hardware and OS UUIDs
|
|
100
100
|
- better/extended cpu info detection
|
|
101
101
|
- better/extended system info detection
|
|
102
|
-
- Apple Silicon M1/M2/M3 support
|
|
102
|
+
- Apple Silicon M1/M2/M3/M4/M5 support
|
|
103
103
|
- better Raspberry-PI detection
|
|
104
104
|
- systeminformation website updated and extended with full documentation and
|
|
105
105
|
examples [systeminformation.io][systeminformation-url]
|
package/lib/cpu.js
CHANGED
|
@@ -1238,7 +1238,7 @@ function getCpuCurrentSpeedSync() {
|
|
|
1238
1238
|
const cores = [];
|
|
1239
1239
|
const speeds = [];
|
|
1240
1240
|
|
|
1241
|
-
if (cpus
|
|
1241
|
+
if (cpus && cpus.length && Object.prototype.hasOwnProperty.call(cpus[0], 'speed')) {
|
|
1242
1242
|
for (let i in cpus) {
|
|
1243
1243
|
speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
|
|
1244
1244
|
}
|
|
@@ -1256,7 +1256,7 @@ function getCpuCurrentSpeedSync() {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
1259
|
-
if (speeds
|
|
1259
|
+
if (speeds && speeds.length) {
|
|
1260
1260
|
try {
|
|
1261
1261
|
for (const i in speeds) {
|
|
1262
1262
|
avgFreq = avgFreq + speeds[i];
|
|
@@ -1545,7 +1545,7 @@ function cpuTemperature(callback) {
|
|
|
1545
1545
|
if (result.max) {
|
|
1546
1546
|
result.max = Math.round(result.max * 100) / 100;
|
|
1547
1547
|
}
|
|
1548
|
-
if (result
|
|
1548
|
+
if (result && result.cores && result.cores.length) {
|
|
1549
1549
|
for (let i = 0; i < result.cores.length; i++) {
|
|
1550
1550
|
result.cores[i] = Math.round(result.cores[i] * 100) / 100;
|
|
1551
1551
|
}
|
|
@@ -1565,7 +1565,7 @@ function cpuTemperature(callback) {
|
|
|
1565
1565
|
// round to 2 digits
|
|
1566
1566
|
result.chipset = Math.round(res.soc * 100) / 100;
|
|
1567
1567
|
}
|
|
1568
|
-
if (res
|
|
1568
|
+
if (res && res.cpuDieTemps.length) {
|
|
1569
1569
|
for (const temp of res.cpuDieTemps) {
|
|
1570
1570
|
result.cores.push(Math.round(temp * 100) / 100);
|
|
1571
1571
|
}
|
|
@@ -2204,7 +2204,7 @@ function getFullLoad() {
|
|
|
2204
2204
|
|
|
2205
2205
|
let result = 0;
|
|
2206
2206
|
|
|
2207
|
-
if (cpus
|
|
2207
|
+
if (cpus && cpus.length) {
|
|
2208
2208
|
for (let i = 0, len = cpus.length; i < len; i++) {
|
|
2209
2209
|
const cpu = cpus[i].times;
|
|
2210
2210
|
totalUser += cpu.user;
|
package/lib/filesystem.js
CHANGED
|
@@ -75,7 +75,7 @@ function fsSize(drive, callback) {
|
|
|
75
75
|
if (stdout.toString().toLowerCase().indexOf('filesystem')) {
|
|
76
76
|
let removeLines = 0;
|
|
77
77
|
for (let i = 0; i < lines.length; i++) {
|
|
78
|
-
if (lines[i]
|
|
78
|
+
if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) {
|
|
79
79
|
removeLines = i;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -194,11 +194,10 @@ function fsSize(drive, callback) {
|
|
|
194
194
|
}
|
|
195
195
|
resolve(data);
|
|
196
196
|
} else {
|
|
197
|
-
exec('df -kPT', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
197
|
+
exec('df -kPT 2>/dev/null', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
198
|
+
// fixed issue alpine fallback
|
|
199
|
+
const lines = filterLines(stdout);
|
|
200
|
+
data = parseDf(lines);
|
|
202
201
|
if (callback) {
|
|
203
202
|
callback(data);
|
|
204
203
|
}
|
|
@@ -491,7 +490,7 @@ function raidMatchLinux(data) {
|
|
|
491
490
|
element.label = mdData.label; // <- assign label info
|
|
492
491
|
element.uuid = mdData.uuid; // <- assign uuid info
|
|
493
492
|
|
|
494
|
-
if (mdData.members
|
|
493
|
+
if (mdData && mdData.members && mdData.members.length && mdData.raid === element.type) {
|
|
495
494
|
result = result.map((blockdevice) => {
|
|
496
495
|
if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) {
|
|
497
496
|
blockdevice.group = element.name;
|
|
@@ -778,7 +777,7 @@ function calcFsSpeed(rx, wx) {
|
|
|
778
777
|
ms: 0
|
|
779
778
|
};
|
|
780
779
|
|
|
781
|
-
if (_fs_speed
|
|
780
|
+
if (_fs_speed && _fs_speed.ms) {
|
|
782
781
|
result.rx = rx;
|
|
783
782
|
result.wx = wx;
|
|
784
783
|
result.tx = result.rx + result.wx;
|
|
@@ -829,7 +828,7 @@ function fsStats(callback) {
|
|
|
829
828
|
|
|
830
829
|
let rx = 0;
|
|
831
830
|
let wx = 0;
|
|
832
|
-
if ((_fs_speed && !_fs_speed.ms) || (_fs_speed
|
|
831
|
+
if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
|
|
833
832
|
if (_linux) {
|
|
834
833
|
// exec("df -k | grep /dev/", function(error, stdout) {
|
|
835
834
|
const procLsblk = exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
@@ -951,7 +950,7 @@ function calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime) {
|
|
|
951
950
|
tWaitPercent: null,
|
|
952
951
|
ms: 0
|
|
953
952
|
};
|
|
954
|
-
if (_disk_io
|
|
953
|
+
if (_disk_io && _disk_io.ms) {
|
|
955
954
|
result.rIO = rIO;
|
|
956
955
|
result.wIO = wIO;
|
|
957
956
|
result.tIO = rIO + wIO;
|
|
@@ -1033,7 +1032,7 @@ function disksIO(callback) {
|
|
|
1033
1032
|
let wWaitTime = 0;
|
|
1034
1033
|
let tWaitTime = 0;
|
|
1035
1034
|
|
|
1036
|
-
if ((_disk_io && !_disk_io.ms) || (_disk_io
|
|
1035
|
+
if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) {
|
|
1037
1036
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
|
1038
1037
|
// prints Block layer statistics for all mounted volumes
|
|
1039
1038
|
// var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
|
@@ -1295,7 +1294,7 @@ function diskLayout(callback) {
|
|
|
1295
1294
|
for (let i = 0; i < result.length; i++) {
|
|
1296
1295
|
if (result[i].BSDName === diskBSDName) {
|
|
1297
1296
|
result[i].smartStatus = disk.smart_status.passed ? 'Ok' : disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown';
|
|
1298
|
-
if (disk.temperature
|
|
1297
|
+
if (disk.temperature && disk.temperature.current) {
|
|
1299
1298
|
result[i].temperature = disk.temperature.current;
|
|
1300
1299
|
}
|
|
1301
1300
|
result[i].smartData = disk;
|
|
@@ -1581,7 +1580,7 @@ function diskLayout(callback) {
|
|
|
1581
1580
|
if (util.smartMonToolsInstalled()) {
|
|
1582
1581
|
try {
|
|
1583
1582
|
const smartDev = JSON.parse(execSync('smartctl --scan -j').toString());
|
|
1584
|
-
if (smartDev
|
|
1583
|
+
if (smartDev && smartDev.devices && smartDev.devices.length > 0) {
|
|
1585
1584
|
smartDev.devices.forEach((dev) => {
|
|
1586
1585
|
workload.push(execPromiseSave(`smartctl -j -a ${dev.name}`, util.execOptsWin));
|
|
1587
1586
|
});
|
|
@@ -1661,8 +1660,9 @@ function diskLayout(callback) {
|
|
|
1661
1660
|
const serialNum = smartData.serial_number;
|
|
1662
1661
|
const i = util.findObjectByKey(result, 'serialNum', serialNum);
|
|
1663
1662
|
if (i !== -1) {
|
|
1664
|
-
result[i].smartStatus =
|
|
1665
|
-
|
|
1663
|
+
result[i].smartStatus =
|
|
1664
|
+
smartData.smart_status && smartData.smart_status.passed ? 'Ok' : smartData.smart_status && smartData.smart_status.passed === false ? 'Predicted Failure' : 'unknown';
|
|
1665
|
+
if (smartData.temperature && smartData.temperature.current) {
|
|
1666
1666
|
result[i].temperature = smartData.temperature.current;
|
|
1667
1667
|
}
|
|
1668
1668
|
result[i].smartData = smartData;
|
package/lib/util.js
CHANGED
|
@@ -375,7 +375,7 @@ function getWmic() {
|
|
|
375
375
|
} else {
|
|
376
376
|
wmicPath = 'wmic';
|
|
377
377
|
}
|
|
378
|
-
} catch
|
|
378
|
+
} catch {
|
|
379
379
|
wmicPath = 'wmic';
|
|
380
380
|
}
|
|
381
381
|
}
|
|
@@ -471,7 +471,7 @@ function powerShellRelease() {
|
|
|
471
471
|
_psChild.stdin.end();
|
|
472
472
|
_psPersistent = false;
|
|
473
473
|
}
|
|
474
|
-
} catch
|
|
474
|
+
} catch {
|
|
475
475
|
if (_psChild) {
|
|
476
476
|
_psChild.kill();
|
|
477
477
|
}
|
|
@@ -480,11 +480,6 @@ function powerShellRelease() {
|
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
function powerShell(cmd) {
|
|
483
|
-
/// const pattern = [
|
|
484
|
-
/// '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
485
|
-
/// '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
|
|
486
|
-
/// ].join('|');
|
|
487
|
-
|
|
488
483
|
if (_psPersistent) {
|
|
489
484
|
const id = Math.random().toString(36).substring(2, 12);
|
|
490
485
|
return new Promise((resolve) => {
|
|
@@ -502,7 +497,7 @@ function powerShell(cmd) {
|
|
|
502
497
|
if (_psChild && _psChild.pid) {
|
|
503
498
|
_psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
|
|
504
499
|
}
|
|
505
|
-
} catch
|
|
500
|
+
} catch {
|
|
506
501
|
resolve('');
|
|
507
502
|
}
|
|
508
503
|
});
|
|
@@ -513,7 +508,13 @@ function powerShell(cmd) {
|
|
|
513
508
|
return new Promise((resolve) => {
|
|
514
509
|
process.nextTick(() => {
|
|
515
510
|
try {
|
|
516
|
-
const
|
|
511
|
+
const osVersion = os.release().split('.').map(Number);
|
|
512
|
+
// windows 7 compatibility issue
|
|
513
|
+
const spanOptions =
|
|
514
|
+
osVersion[0] < 10
|
|
515
|
+
? ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-']
|
|
516
|
+
: ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', cmd];
|
|
517
|
+
const child = spawn(_powerShell, spanOptions, {
|
|
517
518
|
stdio: 'pipe',
|
|
518
519
|
windowsHide: true,
|
|
519
520
|
maxBuffer: 1024 * 102400,
|
|
@@ -543,18 +544,20 @@ function powerShell(cmd) {
|
|
|
543
544
|
child.kill();
|
|
544
545
|
resolve(result);
|
|
545
546
|
});
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
547
|
+
if (osVersion[0] < 10) {
|
|
548
|
+
try {
|
|
549
|
+
child.stdin.write(_psToUTF8 + cmd + os.EOL);
|
|
550
|
+
child.stdin.write('exit' + os.EOL);
|
|
551
|
+
child.stdin.end();
|
|
552
|
+
} catch {
|
|
553
|
+
child.kill();
|
|
554
|
+
resolve(result);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
554
557
|
} else {
|
|
555
558
|
resolve(result);
|
|
556
559
|
}
|
|
557
|
-
} catch
|
|
560
|
+
} catch {
|
|
558
561
|
resolve(result);
|
|
559
562
|
}
|
|
560
563
|
});
|
|
@@ -1124,7 +1127,7 @@ function getRpiGpu(cpuinfo) {
|
|
|
1124
1127
|
try {
|
|
1125
1128
|
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
|
|
1126
1129
|
_rpi_cpuinfo = cpuinfo;
|
|
1127
|
-
} catch
|
|
1130
|
+
} catch {
|
|
1128
1131
|
return false;
|
|
1129
1132
|
}
|
|
1130
1133
|
}
|
|
@@ -1140,22 +1143,23 @@ function getRpiGpu(cpuinfo) {
|
|
|
1140
1143
|
}
|
|
1141
1144
|
|
|
1142
1145
|
function promiseAll(promises) {
|
|
1143
|
-
const resolvingPromises = promises.map(
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1146
|
+
const resolvingPromises = promises.map(
|
|
1147
|
+
(promise) =>
|
|
1148
|
+
new Promise((resolve) => {
|
|
1149
|
+
const payload = new Array(2);
|
|
1150
|
+
promise
|
|
1151
|
+
.then((result) => {
|
|
1152
|
+
payload[0] = result;
|
|
1153
|
+
})
|
|
1154
|
+
.catch((error) => {
|
|
1155
|
+
payload[1] = error;
|
|
1156
|
+
})
|
|
1157
|
+
.then(() => {
|
|
1158
|
+
// The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all
|
|
1159
|
+
resolve(payload);
|
|
1160
|
+
});
|
|
1161
|
+
})
|
|
1162
|
+
);
|
|
1159
1163
|
const errors = [];
|
|
1160
1164
|
const results = [];
|
|
1161
1165
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.28.
|
|
3
|
+
"version": "5.28.5",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|