systeminformation 5.11.22 → 5.11.25

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/cpu.js CHANGED
@@ -1039,7 +1039,7 @@ function cpuTemperature(callback) {
1039
1039
  util.noop();
1040
1040
  }
1041
1041
 
1042
- const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=$(echo $label | rev | cut -c 7- | rev)_input; if [ -f "$value" ]; then echo $(cat "$label")___$(cat "$value"); fi; fi; done; done;';
1042
+ const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
1043
1043
  try {
1044
1044
  exec(cmd, function (error, stdout) {
1045
1045
  stdout = stdout.toString();
package/lib/filesystem.js CHANGED
@@ -50,8 +50,28 @@ function fsSize(callback) {
50
50
  }
51
51
 
52
52
  function isLinuxTmpFs(fs) {
53
- const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type'];
54
- return (linuxTmpFileSystems.includes(fs.toLowerCase()));
53
+ const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged'];
54
+ let result = false;
55
+ linuxTmpFileSystems.forEach(linuxFs => {
56
+ if (fs.toLowerCase().indexOf(linuxFs) >= 0) result = true;
57
+ });
58
+ return result;
59
+ }
60
+
61
+ function filterLines(stdout) {
62
+ let lines = stdout.toString().split('\n');
63
+ if (stdout.toString().toLowerCase().indexOf('filesystem')) {
64
+ let removeLines = 0;
65
+ for (let i = 0; i < lines.length; i++) {
66
+ if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) {
67
+ removeLines = i;
68
+ }
69
+ }
70
+ for (let i = 0; i < removeLines; i++) {
71
+ lines.shift();
72
+ }
73
+ }
74
+ return lines;
55
75
  }
56
76
 
57
77
  function parseDf(lines) {
@@ -104,10 +124,9 @@ function fsSize(callback) {
104
124
  if (_linux) { cmd = 'df -lkPTx squashfs'; } // cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"';
105
125
  if (_freebsd || _openbsd || _netbsd) { cmd = 'df -lkPT'; }
106
126
  exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
107
- if (!error) {
108
- let lines = stdout.toString().split('\n');
109
- if (lines && lines[0] && lines[0].toLowerCase().startsWith('filesystem')) { lines.shift(); }
110
- data = parseDf(lines);
127
+ let lines = filterLines(stdout);
128
+ data = parseDf(lines);
129
+ if (!error || data.length) {
111
130
  if (callback) {
112
131
  callback(data);
113
132
  }
@@ -115,8 +134,7 @@ function fsSize(callback) {
115
134
  } else {
116
135
  exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
117
136
  if (!error) {
118
- let lines = stdout.toString().split('\n');
119
- if (lines && lines[0] && lines[0].toLowerCase().startsWith('filesystem')) { lines.shift(); }
137
+ let lines = filterLines(stdout);
120
138
  data = parseDf(lines);
121
139
  }
122
140
  if (callback) {
package/lib/graphics.js CHANGED
@@ -429,7 +429,7 @@ function graphics(callback) {
429
429
  }
430
430
 
431
431
  const gpus = stdout.split('\n').filter(Boolean);
432
- const results = gpus.map(gpu => {
432
+ let results = gpus.map(gpu => {
433
433
  const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value);
434
434
  if (splittedData.length === 16) {
435
435
  return {
@@ -450,9 +450,13 @@ function graphics(callback) {
450
450
  clockCore: safeParseNumber(splittedData[14]),
451
451
  clockMemory: safeParseNumber(splittedData[15]),
452
452
  };
453
+ } else {
454
+ return {};
453
455
  }
454
456
  });
455
-
457
+ results = results.filter((item) => {
458
+ return ('pciBus' in item);
459
+ });
456
460
  return results;
457
461
  }
458
462
 
package/lib/index.d.ts CHANGED
@@ -7,8 +7,8 @@ export namespace Systeminformation {
7
7
  // 1. General
8
8
 
9
9
  interface TimeData {
10
- current: string;
11
- uptime: string;
10
+ current: number;
11
+ uptime: number;
12
12
  timezone: string;
13
13
  timezoneName: string;
14
14
  }
@@ -988,3 +988,6 @@ export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) =>
988
988
  export function getAllData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
989
989
  export function get(valuesObject: any, cb?: (data: any) => any): Promise<any>;
990
990
  export function observe(valuesObject: any, interval: number, cb?: (data: any) => any): number;
991
+
992
+ export function powerShellStart(): void;
993
+ export function powerShellRelease(): void;
package/lib/osinfo.js CHANGED
@@ -307,6 +307,7 @@ function osInfo(callback) {
307
307
  result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
308
308
  result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
309
309
  result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
310
+ result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
310
311
  result.uefi = true;
311
312
  result.codepage = util.getCodepage();
312
313
  if (callback) {
package/lib/system.js CHANGED
@@ -662,8 +662,10 @@ function baseboard(callback) {
662
662
  if (_windows) {
663
663
  try {
664
664
  const workload = [];
665
+ const win10plus = parseInt(os.release()) >= 10;
666
+ const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity';
665
667
  workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
666
- workload.push(util.powerShell('Get-WmiObject Win32_physicalmemoryarray | select MaxCapacity, MemoryDevices | fl'));
668
+ workload.push(util.powerShell(`Get-WmiObject Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`));
667
669
  util.promiseAll(
668
670
  workload
669
671
  ).then(data => {
@@ -683,7 +685,7 @@ function baseboard(callback) {
683
685
 
684
686
  // memphysical
685
687
  lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];
686
- result.memMax = util.toInt(util.getValue(lines, 'MaxCapacity', ':')) || null;
688
+ result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null;
687
689
  result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null;
688
690
 
689
691
  if (callback) { callback(result); }
package/lib/util.js CHANGED
@@ -396,42 +396,47 @@ function powerShellProceedResults(data) {
396
396
  }
397
397
 
398
398
  function powerShellStart() {
399
- _psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
400
- stdio: 'pipe',
401
- windowsHide: true,
402
- maxBuffer: 1024 * 20000,
403
- encoding: 'UTF-8',
404
- env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
405
- });
406
- if (_psChild && _psChild.pid) {
407
- _psPersistent = true;
408
- _psChild.stdout.on('data', function (data) {
409
- _psResult = _psResult + data.toString('utf8');
410
- if (data.indexOf(_psCmdSeperator) >= 0) {
411
- powerShellProceedResults(_psResult);
412
- _psResult = '';
413
- }
414
- });
415
- _psChild.stderr.on('data', function () {
416
- powerShellProceedResults(_psResult + _psError);
417
- });
418
- _psChild.on('error', function () {
419
- powerShellProceedResults(_psResult + _psError);
420
- });
421
- _psChild.on('close', function () {
422
- _psChild.kill();
399
+ if (!_psChild) {
400
+ _psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
401
+ stdio: 'pipe',
402
+ windowsHide: true,
403
+ maxBuffer: 1024 * 20000,
404
+ encoding: 'UTF-8',
405
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
423
406
  });
407
+ if (_psChild && _psChild.pid) {
408
+ _psPersistent = true;
409
+ _psChild.stdout.on('data', function (data) {
410
+ _psResult = _psResult + data.toString('utf8');
411
+ if (data.indexOf(_psCmdSeperator) >= 0) {
412
+ powerShellProceedResults(_psResult);
413
+ _psResult = '';
414
+ }
415
+ });
416
+ _psChild.stderr.on('data', function () {
417
+ powerShellProceedResults(_psResult + _psError);
418
+ });
419
+ _psChild.on('error', function () {
420
+ powerShellProceedResults(_psResult + _psError);
421
+ });
422
+ _psChild.on('close', function () {
423
+ _psChild.kill();
424
+ });
425
+ }
424
426
  }
425
427
  }
426
428
 
427
429
  function powerShellRelease() {
428
430
  try {
429
- _psChild.stdin.write('exit' + os.EOL);
430
- _psChild.stdin.end();
431
- _psPersistent = false;
431
+ if (_psChild) {
432
+ _psChild.stdin.write('exit' + os.EOL);
433
+ _psChild.stdin.end();
434
+ _psPersistent = false;
435
+ }
432
436
  } catch (e) {
433
437
  _psChild.kill();
434
438
  }
439
+ _psChild = null;
435
440
  }
436
441
 
437
442
  function powerShell(cmd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.11.22",
3
+ "version": "5.11.25",
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)",