systeminformation 5.28.4 → 5.28.6
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/lib/cli.js +22 -13
- package/lib/cpu.js +1 -1
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -23,19 +23,31 @@ function capFirst(string) {
|
|
|
23
23
|
return string[0].toUpperCase() + string.slice(1);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function getValue(value) {
|
|
27
|
+
if (value === null || value === undefined) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
if (typeof value === 'object') {
|
|
31
|
+
return JSON.stringify(value);
|
|
32
|
+
}
|
|
33
|
+
return value.toString();
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
function printLines(obj) {
|
|
27
37
|
for (const property in obj) {
|
|
28
|
-
console.log(capFirst(property) + ' '.substring(0, 17 - property.length)
|
|
38
|
+
console.log(`${capFirst(property) + ' '.substring(0, 17 - property.length)}: ${getValue(obj[property])}`);
|
|
29
39
|
}
|
|
30
40
|
console.log();
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
function info() {
|
|
34
44
|
console.log('┌─────────────────────────────────────────────────────────────────────────────────────────┐');
|
|
35
|
-
console.log(
|
|
45
|
+
console.log(
|
|
46
|
+
`${'│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length)}Version: ${lib_version} │`
|
|
47
|
+
);
|
|
36
48
|
console.log('└─────────────────────────────────────────────────────────────────────────────────────────┘');
|
|
37
49
|
|
|
38
|
-
si.osInfo().then(res => {
|
|
50
|
+
si.osInfo().then((res) => {
|
|
39
51
|
console.log();
|
|
40
52
|
console.log('Operating System:');
|
|
41
53
|
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
|
|
@@ -45,7 +57,7 @@ function info() {
|
|
|
45
57
|
delete res.fqdn;
|
|
46
58
|
delete res.uefi;
|
|
47
59
|
printLines(res);
|
|
48
|
-
si.system().then(res => {
|
|
60
|
+
si.system().then((res) => {
|
|
49
61
|
console.log('System:');
|
|
50
62
|
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
|
|
51
63
|
delete res.serial;
|
|
@@ -53,7 +65,7 @@ function info() {
|
|
|
53
65
|
delete res.sku;
|
|
54
66
|
delete res.uuid;
|
|
55
67
|
printLines(res);
|
|
56
|
-
si.cpu().then(res => {
|
|
68
|
+
si.cpu().then((res) => {
|
|
57
69
|
console.log('CPU:');
|
|
58
70
|
console.log('──────────────────────────────────────────────────────────────────────────────────────────');
|
|
59
71
|
delete res.cache;
|
|
@@ -74,18 +86,15 @@ function info() {
|
|
|
74
86
|
// ----------------------------------------------------------------------------------
|
|
75
87
|
// Main
|
|
76
88
|
// ----------------------------------------------------------------------------------
|
|
77
|
-
(
|
|
89
|
+
(() => {
|
|
78
90
|
const args = process.argv.slice(2);
|
|
79
91
|
|
|
80
92
|
if (args[0] === 'info') {
|
|
81
93
|
info();
|
|
82
94
|
} else {
|
|
83
|
-
si.getStaticData().then(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
));
|
|
95
|
+
si.getStaticData().then((data) => {
|
|
96
|
+
data.time = si.time();
|
|
97
|
+
console.log(JSON.stringify(data, null, 2));
|
|
98
|
+
});
|
|
89
99
|
}
|
|
90
|
-
|
|
91
100
|
})();
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.28.
|
|
3
|
+
"version": "5.28.6",
|
|
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)",
|