systeminformation 5.24.9 → 5.25.1

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
@@ -71,7 +71,7 @@ add new features and support more platforms. Thank you in advance!
71
71
 
72
72
  I tested this library with Node.js, Bun and Deno (V2.x) with no issues. There is
73
73
  currently only one problem on Denos side: os.freemem() pollyfill is currently
74
- not correct (version 2.1.4) bus there is already a fix (not yet published).
74
+ not correct (version 2.1.4) but there is already a fix (not yet published).
75
75
 
76
76
  **Attention**: This library is supposed to be used as a backend/server-side
77
77
  library and **will definitely not work within a browser**.
@@ -178,6 +178,7 @@ si.cpu()
178
178
 
179
179
  (last 7 major and minor version releases)
180
180
 
181
+ - Version 5.24.0: `versions()` added homebrew
181
182
  - Version 5.24.0: `versions()` added bun and deno
182
183
  - Version 5.23.0: `usb()` added serial number (linux)
183
184
  - Version 5.22.0: `wifiConnections()` added signal quality
package/lib/cpu.js CHANGED
@@ -995,16 +995,29 @@ function getCpuCurrentSpeedSync() {
995
995
  let maxFreq = 0;
996
996
  let avgFreq = 0;
997
997
  let cores = [];
998
+ let speeds = [];
998
999
 
999
- if (cpus && cpus.length) {
1000
+ if (cpus && cpus.length && cpus[0].speed) {
1000
1001
  for (let i in cpus) {
1001
- if ({}.hasOwnProperty.call(cpus, i)) {
1002
- let freq = cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10;
1003
- avgFreq = avgFreq + freq;
1004
- if (freq > maxFreq) { maxFreq = freq; }
1005
- if (freq < minFreq) { minFreq = freq; }
1006
- cores.push(parseFloat(freq.toFixed(2)));
1002
+ speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
1003
+ }
1004
+ } else if (_linux) {
1005
+ try {
1006
+ const speedStrings = execSync('cat /proc/cpuinfo | grep "cpu MHz" | cut -d " " -f 3', util.execOptsLinux).toString().split('\n').filter((line) => line.length > 0);
1007
+ for (let i in speedStrings) {
1008
+ speeds.push(Math.floor(parseInt(speedStrings[i], 10) / 10) / 100);
1007
1009
  }
1010
+ } catch {
1011
+ util.noop();
1012
+ }
1013
+ }
1014
+
1015
+ if (speeds && speeds.length) {
1016
+ for (let i in speeds) {
1017
+ avgFreq = avgFreq + speeds[i];
1018
+ if (speeds[i] > maxFreq) { maxFreq = speeds[i]; }
1019
+ if (speeds[i] < minFreq) { minFreq = speeds[i]; }
1020
+ cores.push(parseFloat(speeds[i].toFixed(2)));
1008
1021
  }
1009
1022
  avgFreq = avgFreq / cpus.length;
1010
1023
  return {
package/lib/osinfo.js CHANGED
@@ -463,6 +463,7 @@ function versions(apps, callback) {
463
463
  git: '',
464
464
  grunt: '',
465
465
  gulp: '',
466
+ homebrew: '',
466
467
  java: '',
467
468
  mongodb: '',
468
469
  mysql: '',
@@ -494,7 +495,7 @@ function versions(apps, callback) {
494
495
  if (apps === '*') {
495
496
  return {
496
497
  versions: versionObject,
497
- counter: 32
498
+ counter: 34
498
499
  };
499
500
  }
500
501
  if (!Array.isArray(apps)) {
@@ -609,6 +610,16 @@ function versions(apps, callback) {
609
610
  functionProcessed();
610
611
  });
611
612
  }
613
+ if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
614
+ cmd = 'brew';
615
+ exec(`${cmd} --version`, function (error, stdout) {
616
+ if (!error) {
617
+ const brew = stdout.toString().split('\n')[0] || '';
618
+ appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
619
+ }
620
+ functionProcessed();
621
+ });
622
+ }
612
623
  if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) {
613
624
  cmd = 'tsc';
614
625
  if (_windows) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.24.9",
3
+ "version": "5.25.1",
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)",