systeminformation 5.27.16 → 5.28.0
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 +2 -1
- package/lib/cpu.js +232 -39
- package/lib/graphics.js +348 -241
- package/lib/network.js +1 -1
- package/lib/system.js +246 -143
- package/lib/util.js +52 -51
- package/lib/wifi.js +120 -129
- package/package.json +1 -1
package/lib/util.js
CHANGED
|
@@ -101,11 +101,11 @@ function isFunction(functionToCheck) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function unique(obj) {
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const uniques = [];
|
|
105
|
+
const stringify = {};
|
|
106
106
|
for (let i = 0; i < obj.length; i++) {
|
|
107
107
|
let keys = Object.keys(obj[i]);
|
|
108
|
-
keys.sort(
|
|
108
|
+
keys.sort((a, b) => {
|
|
109
109
|
return a - b;
|
|
110
110
|
});
|
|
111
111
|
let str = '';
|
|
@@ -122,10 +122,10 @@ function unique(obj) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function sortByKey(array, keys) {
|
|
125
|
-
return array.sort(
|
|
125
|
+
return array.sort((a, b) => {
|
|
126
126
|
let x = '';
|
|
127
127
|
let y = '';
|
|
128
|
-
keys.forEach(
|
|
128
|
+
keys.forEach((key) => {
|
|
129
129
|
x = x + a[key];
|
|
130
130
|
y = y + b[key];
|
|
131
131
|
});
|
|
@@ -159,6 +159,7 @@ function getValue(lines, property, separator, trimmed, lineMatch) {
|
|
|
159
159
|
return true;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
return false;
|
|
162
163
|
});
|
|
163
164
|
return result;
|
|
164
165
|
}
|
|
@@ -195,8 +196,8 @@ function parseTime(t, pmDesignator) {
|
|
|
195
196
|
t = t.toUpperCase();
|
|
196
197
|
let hour = 0;
|
|
197
198
|
let min = 0;
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
const splitter = detectSplit(t);
|
|
200
|
+
const parts = t.split(splitter);
|
|
200
201
|
if (parts.length >= 2) {
|
|
201
202
|
if (parts[2]) {
|
|
202
203
|
parts[1] += parts[2];
|
|
@@ -222,8 +223,8 @@ function parseDateTime(dt, culture) {
|
|
|
222
223
|
time: ''
|
|
223
224
|
};
|
|
224
225
|
culture = culture || {};
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
const dateFormat = (culture.dateFormat || '').toLowerCase();
|
|
227
|
+
const pmDesignator = culture.pmDesignator || '';
|
|
227
228
|
|
|
228
229
|
const parts = dt.split(' ');
|
|
229
230
|
if (parts[0]) {
|
|
@@ -283,7 +284,7 @@ function parseDateTime(dt, culture) {
|
|
|
283
284
|
}
|
|
284
285
|
if (parts[1]) {
|
|
285
286
|
parts.shift();
|
|
286
|
-
|
|
287
|
+
const time = parts.join(' ');
|
|
287
288
|
result.time = parseTime(time, pmDesignator);
|
|
288
289
|
}
|
|
289
290
|
return result;
|
|
@@ -294,7 +295,7 @@ function parseHead(head, rights) {
|
|
|
294
295
|
let count = 1;
|
|
295
296
|
let from = 0;
|
|
296
297
|
let to = 0;
|
|
297
|
-
|
|
298
|
+
const result = [];
|
|
298
299
|
for (let i = 0; i < head.length; i++) {
|
|
299
300
|
if (count <= rights) {
|
|
300
301
|
if (/\s/.test(head[i]) && !space) {
|
|
@@ -441,20 +442,20 @@ function powerShellStart() {
|
|
|
441
442
|
});
|
|
442
443
|
if (_psChild && _psChild.pid) {
|
|
443
444
|
_psPersistent = true;
|
|
444
|
-
_psChild.stdout.on('data',
|
|
445
|
+
_psChild.stdout.on('data', (data) => {
|
|
445
446
|
_psResult = _psResult + data.toString('utf8');
|
|
446
447
|
if (data.indexOf(_psCmdSeperator) >= 0) {
|
|
447
448
|
powerShellProceedResults(_psResult);
|
|
448
449
|
_psResult = '';
|
|
449
450
|
}
|
|
450
451
|
});
|
|
451
|
-
_psChild.stderr.on('data',
|
|
452
|
+
_psChild.stderr.on('data', () => {
|
|
452
453
|
powerShellProceedResults(_psResult + _psError);
|
|
453
454
|
});
|
|
454
|
-
_psChild.on('error',
|
|
455
|
+
_psChild.on('error', () => {
|
|
455
456
|
powerShellProceedResults(_psResult + _psError);
|
|
456
457
|
});
|
|
457
|
-
_psChild.on('close',
|
|
458
|
+
_psChild.on('close', () => {
|
|
458
459
|
if (_psChild) {
|
|
459
460
|
_psChild.kill();
|
|
460
461
|
}
|
|
@@ -521,24 +522,24 @@ function powerShell(cmd) {
|
|
|
521
522
|
});
|
|
522
523
|
|
|
523
524
|
if (child && !child.pid) {
|
|
524
|
-
child.on('error',
|
|
525
|
+
child.on('error', () => {
|
|
525
526
|
resolve(result);
|
|
526
527
|
});
|
|
527
528
|
}
|
|
528
529
|
if (child && child.pid) {
|
|
529
|
-
child.stdout.on('data',
|
|
530
|
+
child.stdout.on('data', (data) => {
|
|
530
531
|
result = result + data.toString('utf8');
|
|
531
532
|
});
|
|
532
|
-
child.stderr.on('data',
|
|
533
|
+
child.stderr.on('data', () => {
|
|
533
534
|
child.kill();
|
|
534
535
|
resolve(result);
|
|
535
536
|
});
|
|
536
|
-
child.on('close',
|
|
537
|
+
child.on('close', () => {
|
|
537
538
|
child.kill();
|
|
538
539
|
|
|
539
540
|
resolve(result);
|
|
540
541
|
});
|
|
541
|
-
child.on('error',
|
|
542
|
+
child.on('error', () => {
|
|
542
543
|
child.kill();
|
|
543
544
|
resolve(result);
|
|
544
545
|
});
|
|
@@ -571,26 +572,26 @@ function execSafe(cmd, args, options) {
|
|
|
571
572
|
const child = spawn(cmd, args, options);
|
|
572
573
|
|
|
573
574
|
if (child && !child.pid) {
|
|
574
|
-
child.on('error',
|
|
575
|
+
child.on('error', () => {
|
|
575
576
|
resolve(result);
|
|
576
577
|
});
|
|
577
578
|
}
|
|
578
579
|
if (child && child.pid) {
|
|
579
|
-
child.stdout.on('data',
|
|
580
|
+
child.stdout.on('data', (data) => {
|
|
580
581
|
result += data.toString();
|
|
581
582
|
});
|
|
582
|
-
child.on('close',
|
|
583
|
+
child.on('close', () => {
|
|
583
584
|
child.kill();
|
|
584
585
|
resolve(result);
|
|
585
586
|
});
|
|
586
|
-
child.on('error',
|
|
587
|
+
child.on('error', () => {
|
|
587
588
|
child.kill();
|
|
588
589
|
resolve(result);
|
|
589
590
|
});
|
|
590
591
|
} else {
|
|
591
592
|
resolve(result);
|
|
592
593
|
}
|
|
593
|
-
} catch
|
|
594
|
+
} catch {
|
|
594
595
|
resolve(result);
|
|
595
596
|
}
|
|
596
597
|
});
|
|
@@ -605,7 +606,7 @@ function getCodepage() {
|
|
|
605
606
|
const lines = stdout.toString().split('\r\n');
|
|
606
607
|
const parts = lines[0].split(':');
|
|
607
608
|
codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : '';
|
|
608
|
-
} catch
|
|
609
|
+
} catch {
|
|
609
610
|
codepage = '437';
|
|
610
611
|
}
|
|
611
612
|
}
|
|
@@ -621,7 +622,7 @@ function getCodepage() {
|
|
|
621
622
|
if (!codepage) {
|
|
622
623
|
codepage = 'UTF-8';
|
|
623
624
|
}
|
|
624
|
-
} catch
|
|
625
|
+
} catch {
|
|
625
626
|
codepage = 'UTF-8';
|
|
626
627
|
}
|
|
627
628
|
}
|
|
@@ -642,7 +643,7 @@ function smartMonToolsInstalled() {
|
|
|
642
643
|
} else {
|
|
643
644
|
_smartMonToolsInstalled = false;
|
|
644
645
|
}
|
|
645
|
-
} catch
|
|
646
|
+
} catch {
|
|
646
647
|
_smartMonToolsInstalled = false;
|
|
647
648
|
}
|
|
648
649
|
}
|
|
@@ -650,7 +651,7 @@ function smartMonToolsInstalled() {
|
|
|
650
651
|
try {
|
|
651
652
|
const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n');
|
|
652
653
|
_smartMonToolsInstalled = pathArray.length > 0;
|
|
653
|
-
} catch
|
|
654
|
+
} catch {
|
|
654
655
|
util.noop();
|
|
655
656
|
}
|
|
656
657
|
}
|
|
@@ -669,7 +670,7 @@ function isRaspberry(cpuinfo) {
|
|
|
669
670
|
try {
|
|
670
671
|
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
|
|
671
672
|
_rpi_cpuinfo = cpuinfo;
|
|
672
|
-
} catch
|
|
673
|
+
} catch {
|
|
673
674
|
return false;
|
|
674
675
|
}
|
|
675
676
|
}
|
|
@@ -683,7 +684,7 @@ function isRaspbian() {
|
|
|
683
684
|
let osrelease = [];
|
|
684
685
|
try {
|
|
685
686
|
osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n');
|
|
686
|
-
} catch
|
|
687
|
+
} catch {
|
|
687
688
|
return false;
|
|
688
689
|
}
|
|
689
690
|
const id = getValue(osrelease, 'id', '=');
|
|
@@ -696,7 +697,7 @@ function execWin(cmd, opts, callback) {
|
|
|
696
697
|
opts = execOptsWin;
|
|
697
698
|
}
|
|
698
699
|
let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
|
|
699
|
-
exec(newCmd, opts,
|
|
700
|
+
exec(newCmd, opts, (error, stdout) => {
|
|
700
701
|
callback(error, stdout);
|
|
701
702
|
});
|
|
702
703
|
}
|
|
@@ -849,7 +850,7 @@ function isPrototypePolluted() {
|
|
|
849
850
|
const s1 = st[i];
|
|
850
851
|
try {
|
|
851
852
|
s1.__proto__.toLowerCase = stringToLower;
|
|
852
|
-
} catch
|
|
853
|
+
} catch {
|
|
853
854
|
Object.setPrototypeOf(st, stringObj);
|
|
854
855
|
}
|
|
855
856
|
const s2 = stl ? stl[i] : '';
|
|
@@ -878,14 +879,14 @@ function getFilesInPath(source) {
|
|
|
878
879
|
|
|
879
880
|
function getDirectories(source) {
|
|
880
881
|
return readdirSync(source)
|
|
881
|
-
.map(
|
|
882
|
+
.map((name) => {
|
|
882
883
|
return join(source, name);
|
|
883
884
|
})
|
|
884
885
|
.filter(isDirectory);
|
|
885
886
|
}
|
|
886
887
|
function getFiles(source) {
|
|
887
888
|
return readdirSync(source)
|
|
888
|
-
.map(
|
|
889
|
+
.map((name) => {
|
|
889
890
|
return join(source, name);
|
|
890
891
|
})
|
|
891
892
|
.filter(isFile);
|
|
@@ -893,16 +894,16 @@ function getFilesInPath(source) {
|
|
|
893
894
|
|
|
894
895
|
function getFilesRecursively(source) {
|
|
895
896
|
try {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
.map(
|
|
897
|
+
const dirs = getDirectories(source);
|
|
898
|
+
const files = dirs
|
|
899
|
+
.map((dir) => {
|
|
899
900
|
return getFilesRecursively(dir);
|
|
900
901
|
})
|
|
901
|
-
.reduce(
|
|
902
|
+
.reduce((a, b) => {
|
|
902
903
|
return a.concat(b);
|
|
903
904
|
}, []);
|
|
904
905
|
return files.concat(getFiles(source));
|
|
905
|
-
} catch
|
|
906
|
+
} catch {
|
|
906
907
|
return [];
|
|
907
908
|
}
|
|
908
909
|
}
|
|
@@ -1159,8 +1160,8 @@ function promiseAll(promises) {
|
|
|
1159
1160
|
const results = [];
|
|
1160
1161
|
|
|
1161
1162
|
// Execute all wrapped Promises
|
|
1162
|
-
return Promise.all(resolvingPromises).then(
|
|
1163
|
-
items.forEach(
|
|
1163
|
+
return Promise.all(resolvingPromises).then((items) => {
|
|
1164
|
+
items.forEach((payload) => {
|
|
1164
1165
|
if (payload[1]) {
|
|
1165
1166
|
errors.push(payload[1]);
|
|
1166
1167
|
results.push(null);
|
|
@@ -1178,10 +1179,10 @@ function promiseAll(promises) {
|
|
|
1178
1179
|
}
|
|
1179
1180
|
|
|
1180
1181
|
function promisify(nodeStyleFunction) {
|
|
1181
|
-
return
|
|
1182
|
+
return () => {
|
|
1182
1183
|
const args = Array.prototype.slice.call(arguments);
|
|
1183
|
-
return new Promise(
|
|
1184
|
-
args.push(
|
|
1184
|
+
return new Promise((resolve, reject) => {
|
|
1185
|
+
args.push((err, data) => {
|
|
1185
1186
|
if (err) {
|
|
1186
1187
|
reject(err);
|
|
1187
1188
|
} else {
|
|
@@ -1194,10 +1195,10 @@ function promisify(nodeStyleFunction) {
|
|
|
1194
1195
|
}
|
|
1195
1196
|
|
|
1196
1197
|
function promisifySave(nodeStyleFunction) {
|
|
1197
|
-
return
|
|
1198
|
+
return () => {
|
|
1198
1199
|
const args = Array.prototype.slice.call(arguments);
|
|
1199
|
-
return new Promise(
|
|
1200
|
-
args.push(
|
|
1200
|
+
return new Promise((resolve) => {
|
|
1201
|
+
args.push((err, data) => {
|
|
1201
1202
|
resolve(data);
|
|
1202
1203
|
});
|
|
1203
1204
|
nodeStyleFunction.apply(null, args);
|
|
@@ -1210,7 +1211,7 @@ function linuxVersion() {
|
|
|
1210
1211
|
if (_linux) {
|
|
1211
1212
|
try {
|
|
1212
1213
|
result = execSync('uname -v', execOptsLinux).toString();
|
|
1213
|
-
} catch
|
|
1214
|
+
} catch {
|
|
1214
1215
|
result = '';
|
|
1215
1216
|
}
|
|
1216
1217
|
}
|
|
@@ -2617,7 +2618,7 @@ function checkWebsite(url, timeout = 5000) {
|
|
|
2617
2618
|
const t = Date.now();
|
|
2618
2619
|
return new Promise((resolve) => {
|
|
2619
2620
|
const request = http
|
|
2620
|
-
.get(url,
|
|
2621
|
+
.get(url, (res) => {
|
|
2621
2622
|
res.on('data', () => {});
|
|
2622
2623
|
res.on('end', () => {
|
|
2623
2624
|
resolve({
|
|
@@ -2628,7 +2629,7 @@ function checkWebsite(url, timeout = 5000) {
|
|
|
2628
2629
|
});
|
|
2629
2630
|
});
|
|
2630
2631
|
})
|
|
2631
|
-
.on('error',
|
|
2632
|
+
.on('error', (e) => {
|
|
2632
2633
|
resolve({
|
|
2633
2634
|
url,
|
|
2634
2635
|
statusCode: 404,
|