systeminformation 5.7.10 → 5.7.14

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/CHANGELOG.md CHANGED
@@ -77,6 +77,10 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
77
77
 
78
78
  | Version | Date | Comment |
79
79
  | -------------- | -------------- | -------- |
80
+ | 5.7.14 | 2021-08-01 | `cpu()` cache calculation fix (linux) |
81
+ | 5.7.13 | 2021-07-28 | `osInfo()` fix uefi detection (win) |
82
+ | 5.7.12 | 2021-07-27 | `osInfo()` fix uefi detection (win) |
83
+ | 5.7.11 | 2021-07-27 | typescript typings fix `bluetoothDevices()` |
80
84
  | 5.7.10 | 2021-07-26 | typescript typings fix `processLoad()` |
81
85
  | 5.7.9 | 2021-07-25 | `uuid()` better regedit path detection (win) |
82
86
  | 5.7.8 | 2021-07-16 | `battery()` fix designedCapacity (win, linux), fix catch error |
package/lib/cpu.js CHANGED
@@ -636,13 +636,13 @@ function getCpu() {
636
636
  result.stepping = util.getValue(lines, 'stepping');
637
637
  result.revision = util.getValue(lines, 'cpu revision');
638
638
  result.cache.l1d = util.getValue(lines, 'l1d cache');
639
- if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1); }
639
+ if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1)); }
640
640
  result.cache.l1i = util.getValue(lines, 'l1i cache');
641
- if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1); }
641
+ if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1)); }
642
642
  result.cache.l2 = util.getValue(lines, 'l2 cache');
643
- if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1); }
643
+ if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1)); }
644
644
  result.cache.l3 = util.getValue(lines, 'l3 cache');
645
- if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1); }
645
+ 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)); }
646
646
 
647
647
  const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
648
648
  // const coresPerSocketInt = parseInt(util.getValue(lines, 'cores(s) per socket') || '1', 10);
@@ -1285,16 +1285,16 @@ function cpuCache(callback) {
1285
1285
  lines.forEach(function (line) {
1286
1286
  let parts = line.split(':');
1287
1287
  if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) {
1288
- result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1288
+ result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1289
1289
  }
1290
1290
  if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) {
1291
- result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1291
+ result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1292
1292
  }
1293
1293
  if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) {
1294
- result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1294
+ result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1295
1295
  }
1296
1296
  if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) {
1297
- result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1297
+ result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
1298
1298
  }
1299
1299
  });
1300
1300
  }
package/lib/index.d.ts CHANGED
@@ -938,7 +938,7 @@ export function usb(cb?: (data: Systeminformation.UsbData[]) => any): Promise<Sy
938
938
 
939
939
  export function audio(cb?: (data: Systeminformation.AudioData[]) => any): Promise<Systeminformation.AudioData[]>;
940
940
 
941
- export function bluetoothDevices(cb?: (data: Systeminformation.BlockDevicesData[]) => any): Promise<Systeminformation.BlockDevicesData[]>;
941
+ export function bluetoothDevices(cb?: (data: Systeminformation.BluetoothDeviceData[]) => any): Promise<Systeminformation.BluetoothDeviceData[]>;
942
942
 
943
943
  export function getStaticData(cb?: (data: Systeminformation.StaticData) => any): Promise<Systeminformation.StaticData>;
944
944
  export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
package/lib/osinfo.js CHANGED
@@ -365,14 +365,14 @@ function isUefiLinux() {
365
365
  process.nextTick(() => {
366
366
  fs.stat('/sys/firmware/efi', function (err) {
367
367
  if (!err) {
368
- resolve(true);
368
+ return resolve(true);
369
369
  } else {
370
370
  exec('dmesg | grep -E "EFI v"', function (error, stdout) {
371
371
  if (!error) {
372
372
  const lines = stdout.toString().split('\n');
373
- resolve(lines.length > 0);
373
+ return resolve(lines.length > 0);
374
374
  }
375
- resolve(false);
375
+ return resolve(false);
376
376
  });
377
377
  }
378
378
  });
@@ -387,21 +387,20 @@ function isUefiWindows() {
387
387
  exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) {
388
388
  if (!error) {
389
389
  const line = stdout.toString().split('\n\r')[0];
390
- resolve(line.toLowerCase().indexOf('efi') >= 0);
391
- return;
390
+ return resolve(line.toLowerCase().indexOf('efi') >= 0);
392
391
  } else {
393
392
  exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) {
394
393
  if (!error) {
395
394
  const line = stdout.toString() || '';
396
- resolve(line.toLowerCase().indexOf('efi') >= 0);
395
+ return resolve(line.toLowerCase().indexOf('efi') >= 0);
396
+ } else {
397
+ return resolve(false);
397
398
  }
398
- resolve(false);
399
399
  });
400
400
  }
401
- resolve(false);
402
401
  });
403
402
  } catch (e) {
404
- resolve(false);
403
+ return resolve(false);
405
404
  }
406
405
  });
407
406
  });
@@ -1015,18 +1014,18 @@ function shell(callback) {
1015
1014
  process.nextTick(() => {
1016
1015
  if (_windows) {
1017
1016
  resolve('cmd');
1017
+ } else {
1018
+ let result = '';
1019
+ exec('echo $SHELL', function (error, stdout) {
1020
+ if (!error) {
1021
+ result = stdout.toString().split('\n')[0];
1022
+ }
1023
+ if (callback) {
1024
+ callback(result);
1025
+ }
1026
+ resolve(result);
1027
+ });
1018
1028
  }
1019
-
1020
- let result = '';
1021
- exec('echo $SHELL', function (error, stdout) {
1022
- if (!error) {
1023
- result = stdout.toString().split('\n')[0];
1024
- }
1025
- if (callback) {
1026
- callback(result);
1027
- }
1028
- resolve(result);
1029
- });
1030
1029
  });
1031
1030
  });
1032
1031
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.7.10",
3
+ "version": "5.7.14",
4
4
  "description": "Simple system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",