systeminformation 5.12.6 → 5.12.7

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 CHANGED
@@ -30,7 +30,7 @@
30
30
  [![Sponsoring][sponsor-badge]][sponsor-url]
31
31
  [![MIT license][license-img]][license-url]
32
32
 
33
- This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, > 4 mio downloads per month, > 90 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
33
+ This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
34
34
 
35
35
  ## New Version 5.0
36
36
 
@@ -208,7 +208,7 @@ Full function reference with examples can be found at [https://systeminformation
208
208
  | | governor | X | | | | | e.g. 'powersave' |
209
209
  | | cores | X | X | X | X | | # cores |
210
210
  | | physicalCores | X | X | X | X | | # physical cores |
211
- | | efficiencyCores | X | | X | | | # efficiancy cores |
211
+ | | efficiencyCores | X | | X | | | # efficiency cores |
212
212
  | | performanceCores | X | | X | | | # performance cores |
213
213
  | | processors | X | X | X | X | | # processors |
214
214
  | | socket | X | X | | X | | socket type e.g. "LGA1356" |
package/lib/audio.js CHANGED
@@ -16,7 +16,6 @@
16
16
  const exec = require('child_process').exec;
17
17
  const execSync = require('child_process').execSync;
18
18
  const util = require('./util');
19
- // const fs = require('fs');
20
19
 
21
20
  let _platform = process.platform;
22
21
 
@@ -79,7 +78,6 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
79
78
 
80
79
  result.id = slotId;
81
80
  result.name = util.getValue(lines, 'SDevice');
82
- // result.type = util.getValue(lines, 'Class');
83
81
  result.manufacturer = util.getValue(lines, 'SVendor');
84
82
  result.revision = util.getValue(lines, 'Rev');
85
83
  result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
@@ -128,7 +126,6 @@ function parseDarwinAudio(audioObject, id) {
128
126
  function parseWindowsAudio(lines) {
129
127
  const result = {};
130
128
  const status = util.getValue(lines, 'StatusInfo', ':');
131
- // const description = util.getValue(lines, 'Description', ':');
132
129
 
133
130
  result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
134
131
  result.name = util.getValue(lines, 'name', ':');
package/lib/battery.js CHANGED
@@ -51,7 +51,7 @@ function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
51
51
  result.capacityUnit = 'mWh';
52
52
  result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0);
53
53
  result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100);
54
- result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || (!(statusValue === 3) && !(statusValue === 1) && result.percent < 100);
54
+ result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100);
55
55
  result.acConnected = result.isCharging || statusValue === 2;
56
56
  result.model = util.getValue(lines, 'DeviceID', ':');
57
57
  } else {
@@ -232,7 +232,6 @@ module.exports = function (callback) {
232
232
  workload
233
233
  ).then(data => {
234
234
  if (data) {
235
- // let parts = data.results[0].split(/\n\s*\n/);
236
235
  let parts = data.results[0].split(/\n\s*\n/);
237
236
  let batteries = [];
238
237
  const hasValue = value => /\S/.test(value);
package/lib/cpu.js CHANGED
@@ -617,14 +617,6 @@ function getCpu() {
617
617
  cpuFlags().then(flags => {
618
618
  result.flags = flags;
619
619
  result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
620
- // if (_windows) {
621
- // try {
622
- // const systeminfo = execSync('systeminfo', util.execOptsWin).toString();
623
- // result.virtualization = result.virtualization || (systeminfo.indexOf('Virtualization Enabled In Firmware: Yes') !== -1) || (systeminfo.indexOf('Virtualisierung in Firmware aktiviert: Ja') !== -1) || (systeminfo.indexOf('Virtualisation activée dans le microprogramme : Qiu') !== -1);
624
- // } catch (e) {
625
- // util.noop();
626
- // }
627
- // }
628
620
  if (_darwin) {
629
621
  exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) {
630
622
  let lines = stdout.toString().split('\n');
@@ -695,12 +687,9 @@ function getCpu() {
695
687
 
696
688
  result = cpuBrandManufacturer(result);
697
689
  result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
698
- // if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
699
690
 
700
691
  result.family = util.getValue(lines, 'cpu family');
701
- // if (!result.family) { result.family = util.getValue(lines, 'prozessorfamilie'); }
702
692
  result.model = util.getValue(lines, 'model:');
703
- // if (!result.model) { result.model = util.getValue(lines, 'modell:'); }
704
693
  result.stepping = util.getValue(lines, 'stepping');
705
694
  result.revision = util.getValue(lines, 'cpu revision');
706
695
  result.cache.l1d = util.getValue(lines, 'l1d cache');
@@ -713,11 +702,9 @@ function getCpu() {
713
702
  if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); }
714
703
 
715
704
  const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
716
- // const coresPerSocketInt = parseInt(util.getValue(lines, 'cores(s) per socket') || '1', 10);
717
705
  const processors = util.getValue(lines, 'socket(s)') || '1';
718
706
  let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
719
707
  let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
720
- // const cpus = (parseInt(util.getValue(lines, 'cpu(s)'), 10) || 1); // overall number of cores (e.g. 24 on i12900)
721
708
  const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
722
709
  result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
723
710
  result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
@@ -779,7 +766,7 @@ function getCpu() {
779
766
  result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
780
767
  let sig = util.getValue(lines, 'signature');
781
768
  sig = sig.split(',');
782
- for (var i = 0; i < sig.length; i++) {
769
+ for (let i = 0; i < sig.length; i++) {
783
770
  sig[i] = sig[i].trim();
784
771
  }
785
772
  result.family = util.getValue(sig, 'Family', ' ', true);
@@ -825,7 +812,6 @@ function getCpu() {
825
812
  const workload = [];
826
813
  workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
827
814
  workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
828
- // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
829
815
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
830
816
 
831
817
  Promise.all(
@@ -915,9 +901,6 @@ function getCpu() {
915
901
  result.cache.l1d = parseInt(installedSize, 10) / 2;
916
902
  }
917
903
  });
918
- // lines = data[2].split('\r\n');
919
- // result.virtualization = (util.getValue(lines, 'HyperVRequirementVirtualizationFirmwareEnabled').toLowerCase() === 'true');
920
- // result.virtualization = (util.getValue(lines, 'HyperVisorPresent').toLowerCase() === 'true');
921
904
  const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
922
905
  result.virtualization = hyperv.indexOf('true') !== -1;
923
906
 
@@ -1067,9 +1050,7 @@ function cpuTemperature(callback) {
1067
1050
  });
1068
1051
 
1069
1052
  if (result.cores.length > 0) {
1070
- // if (result.main === null) {
1071
1053
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1072
- // }
1073
1054
  let maxtmp = Math.max.apply(Math, result.cores);
1074
1055
  result.max = (maxtmp > result.main) ? maxtmp : result.main;
1075
1056
  }
@@ -1123,9 +1104,7 @@ function cpuTemperature(callback) {
1123
1104
  }
1124
1105
  });
1125
1106
  if (result.cores.length > 0) {
1126
- // if (result.main === null) {
1127
1107
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1128
- // }
1129
1108
  let maxtmp = Math.max.apply(Math, result.cores);
1130
1109
  result.max = (maxtmp > result.main) ? maxtmp : result.main;
1131
1110
  } else {
@@ -1702,8 +1681,6 @@ function getFullLoad() {
1702
1681
  let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
1703
1682
  result = (totalTicks - totalIdle) / totalTicks * 100.0;
1704
1683
 
1705
- } else {
1706
- result = 0;
1707
1684
  }
1708
1685
  resolve(result);
1709
1686
  });
package/lib/network.js CHANGED
@@ -108,7 +108,6 @@ function getDefaultNetworkInterface() {
108
108
  if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
109
109
  if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
110
110
  if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
111
- // console.log('SYNC - default darwin 3');
112
111
  let result = execSync(cmd);
113
112
  ifacename = result.toString().split('\n')[0];
114
113
  if (ifacename.indexOf(':') > -1) {
@@ -173,7 +172,6 @@ function getMacAddresses() {
173
172
  if (_darwin) {
174
173
  try {
175
174
  const cmd = '/sbin/ifconfig';
176
- // console.log('SYNC - macAde darwin 6');
177
175
  let res = execSync(cmd);
178
176
  const lines = res.toString().split('\n');
179
177
  for (let i = 0; i < lines.length; i++) {
@@ -247,8 +245,6 @@ function parseLinesWindowsNics(sections, nconfigsections) {
247
245
  }
248
246
 
249
247
  function getWindowsNics() {
250
- // const cmd = util.getWmic() + ' nic get /value';
251
- // const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
252
248
  return new Promise((resolve) => {
253
249
  process.nextTick(() => {
254
250
  let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
@@ -394,7 +390,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
394
390
  i8021x.state = 'Enabled';
395
391
  }
396
392
  } catch (error) {
397
- // console.log('Error getting wired information:', error);
398
393
  return i8021x;
399
394
  }
400
395
  } else if (connectionType == 'wireless') {
@@ -416,7 +411,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
416
411
  i8021x.protocol = i8021xProtocol.split(':').pop();
417
412
  }
418
413
  } catch (error) {
419
- // console.log('Error getting wireless information:', error);
420
414
  if (error.status === 1 && error.stdout.includes('AutoConfig')) {
421
415
  i8021x.state = 'Disabled';
422
416
  i8021x.protocol = 'Not defined';
@@ -1409,7 +1403,6 @@ function networkConnections(callback) {
1409
1403
  peerip = peeraddress.join(':');
1410
1404
  }
1411
1405
  let connstate = line[5];
1412
- // if (connstate === 'VERBUNDEN') connstate = 'ESTABLISHED';
1413
1406
  let proc = line[6].split('/');
1414
1407
 
1415
1408
  if (connstate) {
package/lib/osinfo.js CHANGED
@@ -18,7 +18,6 @@ const fs = require('fs');
18
18
  const util = require('./util');
19
19
  const exec = require('child_process').exec;
20
20
  const execSync = require('child_process').execSync;
21
- // const execPromise = util.promisify(require('child_process').exec);
22
21
 
23
22
  let _platform = process.platform;
24
23
 
@@ -332,8 +331,6 @@ function osInfo(callback) {
332
331
  try {
333
332
  const workload = [];
334
333
  workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
335
- // workload.push(execPromise('systeminfo', util.execOptsWin));
336
- // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
337
334
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
338
335
  workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
339
336
  util.promiseAll(
@@ -345,10 +342,6 @@ function osInfo(callback) {
345
342
  result.build = util.getValue(lines, 'BuildNumber', ':').trim();
346
343
  result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
347
344
  result.codepage = util.getCodepage();
348
- // const systeminfo = data.results[1] ? data.results[1].toString() : '';
349
- // result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1);
350
- // const hyperv = data.results[1] ? data.results[1].toString().split('\r\n') : [];
351
- // result.hypervisor = (util.getValue(hyperv, 'HyperVisorPresent').toLowerCase() === 'true');
352
345
  const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
353
346
  result.hypervisor = hyperv.indexOf('true') !== -1;
354
347
  const term = data.results[2] ? data.results[2].toString() : '';
@@ -741,7 +734,6 @@ function versions(apps, callback) {
741
734
  }
742
735
  functionProcessed();
743
736
  });
744
- functionProcessed();
745
737
  }
746
738
  });
747
739
  } else {
@@ -1004,17 +996,21 @@ function versions(apps, callback) {
1004
996
  }
1005
997
  }
1006
998
  if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
1007
- util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => {
1008
- const lines = stdout.toString().split('\r\n');
1009
- let dotnet = '';
1010
- lines.forEach(line => {
1011
- line = line.replace(/ +/g, ' ');
1012
- const parts = line.split(' ');
1013
- dotnet = dotnet || ((parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '')));
999
+ if (_windows) {
1000
+ util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => {
1001
+ const lines = stdout.toString().split('\r\n');
1002
+ let dotnet = '';
1003
+ lines.forEach(line => {
1004
+ line = line.replace(/ +/g, ' ');
1005
+ const parts = line.split(' ');
1006
+ dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : ''));
1007
+ });
1008
+ appsObj.versions.dotnet = dotnet.trim();
1009
+ functionProcessed();
1014
1010
  });
1015
- appsObj.versions.dotnet = dotnet.trim();
1011
+ } else {
1016
1012
  functionProcessed();
1017
- });
1013
+ }
1018
1014
  }
1019
1015
  } catch (e) {
1020
1016
  if (callback) { callback(appsObj.versions); }
@@ -1090,7 +1086,6 @@ function uuid(callback) {
1090
1086
  const jsonObj = JSON.parse(stdout.toString());
1091
1087
  if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
1092
1088
  const spHardware = jsonObj.SPHardwareDataType[0];
1093
- // result.os = parts.length > 1 ? parts[1].trim().toLowerCase() : '';
1094
1089
  result.os = spHardware.platform_UUID.toLowerCase();
1095
1090
  result.hardware = spHardware.serial_number;
1096
1091
  }
@@ -1142,7 +1137,6 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
1142
1137
  sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
1143
1138
  }
1144
1139
  util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
1145
- // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
1146
1140
  let lines = stdout.split('\r\n');
1147
1141
  result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
1148
1142
  exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
package/lib/printer.js CHANGED
@@ -14,9 +14,7 @@
14
14
  // ----------------------------------------------------------------------------------
15
15
 
16
16
  const exec = require('child_process').exec;
17
- // const execSync = require('child_process').execSync;
18
17
  const util = require('./util');
19
- // const fs = require('fs');
20
18
 
21
19
  let _platform = process.platform;
22
20
 
package/lib/processes.js CHANGED
@@ -150,7 +150,6 @@ function services(srv, callback) {
150
150
  let srvs = srvString.split('|');
151
151
  let result = [];
152
152
  let dataSrv = [];
153
- // let allSrv = [];
154
153
 
155
154
  if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
156
155
  if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
@@ -1166,18 +1165,13 @@ function processLoad(proc, callback) {
1166
1165
  listPos = j;
1167
1166
  }
1168
1167
  }
1169
- // console.log(listPos);
1170
1168
  processes.forEach(function (proc) {
1171
- // console.log(proc)
1172
- // console.log(item)
1173
- // inList = inList || item.name.toLowerCase() === proc.toLowerCase();
1169
+
1174
1170
  if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
1175
1171
  inList = true;
1176
1172
  name = proc;
1177
1173
  }
1178
1174
  });
1179
- // console.log(item);
1180
- // console.log(listPos);
1181
1175
  if ((processesString === '*') || inList) {
1182
1176
  if (listPos < 0) {
1183
1177
  result.push({
@@ -1265,10 +1259,8 @@ function processLoad(proc, callback) {
1265
1259
  });
1266
1260
 
1267
1261
  _process_cpu.all = all;
1268
- // _process_cpu.list = list_new;
1269
1262
  _process_cpu.list = Object.assign({}, list_new);
1270
1263
  _process_cpu.ms = Date.now() - _process_cpu.ms;
1271
- // _process_cpu.result = result;
1272
1264
  _process_cpu.result = Object.assign({}, result);
1273
1265
  if (callback) { callback(result); }
1274
1266
  resolve(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.12.6",
3
+ "version": "5.12.7",
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)",