@depup/systeminformation 5.31.4-depup.0 → 5.33.1-depup.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 CHANGED
@@ -13,8 +13,8 @@ npm install @depup/systeminformation
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [systeminformation](https://www.npmjs.com/package/systeminformation) @ 5.31.4 |
17
- | Processed | 2026-03-17 |
16
+ | Original | [systeminformation](https://www.npmjs.com/package/systeminformation) @ 5.33.1 |
17
+ | Processed | 2026-07-26 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-03-17T19:31:46.220Z",
3
+ "timestamp": "2026-07-26T00:59:22.841Z",
4
4
  "totalUpdated": 0
5
5
  }
package/lib/audio.js CHANGED
@@ -103,16 +103,17 @@ function getLinuxAudioPci() {
103
103
  }
104
104
 
105
105
  function parseWinAudioStatus(n) {
106
+ const num = parseInt(n, 10);
106
107
  let status = n;
107
- if (n === 1) {
108
+ if (num === 1) {
108
109
  status = 'other';
109
- } else if (n === 2) {
110
+ } else if (num === 2) {
110
111
  status = 'unknown';
111
- } else if (n === 3) {
112
+ } else if (num === 3) {
112
113
  status = 'enabled';
113
- } else if (n === 4) {
114
+ } else if (num === 4) {
114
115
  status = 'disabled';
115
- } else if (n === 5) {
116
+ } else if (num === 5) {
116
117
  status = 'not applicable';
117
118
  }
118
119
  return status;
package/lib/battery.js CHANGED
@@ -100,8 +100,12 @@ module.exports = (callback) =>
100
100
  }
101
101
 
102
102
  if (acPath) {
103
- const file = fs.readFileSync(acPath);
104
- acConnected = file.toString().trim() === '1';
103
+ try {
104
+ const file = fs.readFileSync(acPath);
105
+ acConnected = file.toString().trim() === '1';
106
+ } catch {
107
+ util.noop();
108
+ }
105
109
  }
106
110
 
107
111
  if (battery_path) {
package/lib/bluetooth.js CHANGED
@@ -175,8 +175,12 @@ function bluetoothDevices(callback) {
175
175
  const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
176
176
  const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
177
177
  if (filename === 'info') {
178
- const infoFile = fs.readFileSync(element, { encoding: 'utf8' }).split('\n');
179
- result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
178
+ try {
179
+ const infoFile = fs.readFileSync(element, { encoding: 'utf8' }).split('\n');
180
+ result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
181
+ } catch {
182
+ util.noop();
183
+ }
180
184
  }
181
185
  });
182
186
  // determine "connected" with hcitool con
package/lib/cpu.js CHANGED
@@ -929,7 +929,7 @@ function getCpu() {
929
929
  result.socket = 'SOC';
930
930
  try {
931
931
  const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n');
932
- const efficiencyCores = clusters.filter((line) => line.indexOf('"E"') >= 0).length;
932
+ const efficiencyCores = clusters.filter((line) => line.indexOf('"E"') >= 0).length + clusters.filter((line) => line.indexOf('"M"') >= 0).length;
933
933
  const performanceCores = clusters.filter((line) => line.indexOf('"P"') >= 0).length;
934
934
  result.efficiencyCores = efficiencyCores;
935
935
  result.performanceCores = performanceCores;
@@ -979,8 +979,8 @@ function getCpu() {
979
979
  }
980
980
  }
981
981
  _cpu_speed = result.speed;
982
- result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100;
983
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
982
+ result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100 || result.speedMin;
983
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100 || result.speedMax;
984
984
 
985
985
  result = cpuBrandManufacturer(result);
986
986
  result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
@@ -1029,18 +1029,22 @@ function getCpu() {
1029
1029
 
1030
1030
  // Test RISC-V
1031
1031
  if (util.getValue(lines, 'architecture') === 'riscv64') {
1032
- const linesRiscV = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
1033
- const uarch = util.getValue(linesRiscV, 'uarch') || '';
1034
- if (uarch.indexOf(',') > -1) {
1035
- const split = uarch.split(',');
1036
- result.manufacturer = cpuManufacturer(split[0]);
1037
- result.brand = split[1];
1032
+ try {
1033
+ const linesRiscV = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
1034
+ const uarch = util.getValue(linesRiscV, 'uarch') || '';
1035
+ if (uarch.indexOf(',') > -1) {
1036
+ const split = uarch.split(',');
1037
+ result.manufacturer = cpuManufacturer(split[0]);
1038
+ result.brand = split[1];
1039
+ }
1040
+ } catch {
1041
+ util.noop();
1038
1042
  }
1039
1043
  }
1040
1044
 
1041
1045
  // socket type
1042
1046
  let lines2 = [];
1043
- exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', (error2, stdout2) => {
1047
+ exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', (error2, stdout2) => {
1044
1048
  lines2 = stdout2.toString().split('\n');
1045
1049
  if (lines2 && lines2.length) {
1046
1050
  result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket;
@@ -1055,7 +1059,7 @@ function getCpu() {
1055
1059
  if (os.cpus()[0] && os.cpus()[0].model) {
1056
1060
  modelline = os.cpus()[0].model;
1057
1061
  }
1058
- exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', (error, stdout) => {
1062
+ exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7; unset LC_ALL', (error, stdout) => {
1059
1063
  let cache = [];
1060
1064
  if (!error) {
1061
1065
  const data = stdout.toString().split('# dmidecode');
@@ -1077,7 +1081,7 @@ function getCpu() {
1077
1081
  }
1078
1082
  _cpu_speed = result.speed;
1079
1083
  result.speedMin = result.speed;
1080
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
1084
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100 || result.speed;
1081
1085
 
1082
1086
  result = cpuBrandManufacturer(result);
1083
1087
  result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
@@ -1149,7 +1153,7 @@ function getCpu() {
1149
1153
  result = cpuBrandManufacturer(result);
1150
1154
  result.revision = util.getValue(lines, 'revision', ':');
1151
1155
  result.vendor = util.getValue(lines, 'manufacturer', ':');
1152
- result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100;
1156
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100 || result.speedMax;
1153
1157
  if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
1154
1158
  result.speed = getAMDSpeed(result.brand);
1155
1159
  }
@@ -1332,6 +1336,7 @@ function cpuTemperature(callback) {
1332
1336
  };
1333
1337
  if (_linux) {
1334
1338
  // CPU Chipset, Socket
1339
+ let cpuThermal = null;
1335
1340
  try {
1336
1341
  const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;';
1337
1342
  const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n');
@@ -1346,6 +1351,10 @@ function cpuTemperature(callback) {
1346
1351
  if (line.startsWith('pch') && lines2[i]) {
1347
1352
  result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1348
1353
  }
1354
+ // CPU thermal zone (e.g. cpu-thermal on Raspberry Pi)
1355
+ if (cpuThermal === null && line.indexOf('cpu') !== -1 && lines2[i]) {
1356
+ cpuThermal = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1357
+ }
1349
1358
  }
1350
1359
  }
1351
1360
  } catch (e) {
@@ -1397,62 +1406,79 @@ function cpuTemperature(callback) {
1397
1406
  resolve(result);
1398
1407
  return;
1399
1408
  }
1409
+ if (cpuThermal !== null) {
1410
+ result.main = cpuThermal;
1411
+ result.max = cpuThermal;
1412
+ if (callback) {
1413
+ callback(result);
1414
+ }
1415
+ resolve(result);
1416
+ return;
1417
+ }
1400
1418
  exec('sensors', (error, stdout) => {
1401
1419
  if (!error) {
1402
1420
  const lines = stdout.toString().split('\n');
1403
1421
  let tdieTemp = null;
1422
+ let cpuThermalTemp = null;
1404
1423
  let newSectionStarts = true;
1405
1424
  let section = '';
1425
+
1406
1426
  lines.forEach((line) => {
1407
- // determine section
1427
+ // Section bestimmen
1408
1428
  if (line.trim() === '') {
1409
1429
  newSectionStarts = true;
1410
1430
  } else if (newSectionStarts) {
1411
- if (line.trim().toLowerCase().startsWith('acpi')) {
1412
- section = 'acpi';
1413
- }
1414
- if (line.trim().toLowerCase().startsWith('pch')) {
1415
- section = 'pch';
1416
- }
1417
- if (line.trim().toLowerCase().startsWith('core')) {
1418
- section = 'core';
1419
- }
1420
- if (line.trim().toLowerCase().startsWith('k10temp')) {
1421
- section = 'coreAMD';
1422
- }
1431
+ const s = line.trim().toLowerCase();
1432
+ if (s.startsWith('acpi')) section = 'acpi';
1433
+ else if (s.startsWith('pch')) section = 'pch';
1434
+ else if (s.startsWith('coretemp') || s.startsWith('core')) section = 'core';
1435
+ else if (s.startsWith('k10temp')) section = 'coreAMD';
1436
+ else if (s.startsWith('cpu_thermal') || s.startsWith('cpu-thermal') || s.startsWith('soc_thermal') || s.startsWith('cpu')) section = 'cpuThermal';
1437
+ else section = 'other';
1423
1438
  newSectionStarts = false;
1424
1439
  }
1440
+
1425
1441
  const regex = /[+-]([^°]*)/g;
1426
1442
  const temps = line.match(regex);
1427
1443
  const firstPart = line.split(':')[0].toUpperCase();
1444
+
1428
1445
  if (section === 'acpi') {
1429
1446
  // socket temp
1430
- if (firstPart.indexOf('TEMP') !== -1) {
1447
+ if (firstPart.indexOf('TEMP') !== -1 && temps) {
1431
1448
  result.socket.push(parseFloat(temps));
1432
1449
  }
1433
1450
  } else if (section === 'pch') {
1434
1451
  // chipset temp
1435
- if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) {
1452
+ if (firstPart.indexOf('TEMP') !== -1 && !result.chipset && temps) {
1436
1453
  result.chipset = parseFloat(temps);
1437
1454
  }
1438
1455
  }
1439
1456
  // cpu temp
1440
- if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1) || firstPart.indexOf('TEMP') !== -1) {
1457
+ if ((firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1)) && temps) {
1441
1458
  result.main = parseFloat(temps);
1442
1459
  }
1443
- if (firstPart.indexOf('CORE ') !== -1) {
1460
+ if (firstPart.indexOf('CORE ') !== -1 && temps) {
1444
1461
  result.cores.push(parseFloat(temps));
1445
1462
  }
1446
- if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null) {
1463
+ if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null && temps) {
1447
1464
  tdieTemp = parseFloat(temps);
1448
1465
  }
1466
+
1467
+ // generic temp value from cpuThermal
1468
+ if (section === 'cpuThermal' && firstPart.indexOf('TEMP') !== -1 && cpuThermalTemp === null && temps) {
1469
+ cpuThermalTemp = parseFloat(temps);
1470
+ }
1449
1471
  });
1450
1472
  if (result.cores.length > 0) {
1451
1473
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1452
1474
  const maxtmp = Math.max.apply(Math, result.cores);
1453
1475
  result.max = maxtmp > result.main ? maxtmp : result.main;
1454
1476
  } else {
1455
- if (result.main === null && tdieTemp !== null) {
1477
+ // fallback order: cpu_thermal before tdie
1478
+ if (result.main === null && cpuThermalTemp !== null) {
1479
+ result.main = cpuThermalTemp;
1480
+ result.max = cpuThermalTemp;
1481
+ } else if (result.main === null && tdieTemp !== null) {
1456
1482
  result.main = tdieTemp;
1457
1483
  result.max = tdieTemp;
1458
1484
  }
@@ -1487,7 +1513,7 @@ function cpuTemperature(callback) {
1487
1513
  exec('/opt/vc/bin/vcgencmd measure_temp', (error, stdout) => {
1488
1514
  if (!error) {
1489
1515
  const lines = stdout.toString().split('\n');
1490
- if (lines.length > 0 && lines[0].indexOf('=')) {
1516
+ if (lines.length > 0 && lines[0].indexOf('=') !== -1) {
1491
1517
  result.main = parseFloat(lines[0].split('=')[1]);
1492
1518
  result.max = result.main;
1493
1519
  }
@@ -1841,10 +1867,10 @@ function cpuCache(callback) {
1841
1867
  size = size * (unit === 'kb' ? 1024 : unit === 'mb' ? 1024 * 1024 : unit === 'gb' ? 1024 * 1024 * 1024 : 1);
1842
1868
  if (cacheType) {
1843
1869
  if (cacheType === 'l1') {
1844
- result.cache[cacheType + 'd'] = size / 2;
1845
- result.cache[cacheType + 'i'] = size / 2;
1870
+ result[cacheType + 'd'] = size / 2;
1871
+ result[cacheType + 'i'] = size / 2;
1846
1872
  } else {
1847
- result.cache[cacheType] = size;
1873
+ result[cacheType] = size;
1848
1874
  }
1849
1875
  }
1850
1876
  }
@@ -1861,10 +1887,10 @@ function cpuCache(callback) {
1861
1887
  lines.forEach((line) => {
1862
1888
  let parts = line.split(':');
1863
1889
  if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) {
1864
- result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1890
+ result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1865
1891
  }
1866
1892
  if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) {
1867
- result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1893
+ result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
1868
1894
  }
1869
1895
  if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) {
1870
1896
  result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
@@ -1994,6 +2020,9 @@ function getLoad() {
1994
2020
  const cpus = os.cpus().map((cpu) => {
1995
2021
  cpu.times.steal = 0;
1996
2022
  cpu.times.guest = 0;
2023
+ if (_windows) {
2024
+ cpu.times.sys = Math.max(0, cpu.times.sys - cpu.times.irq);
2025
+ }
1997
2026
  return cpu;
1998
2027
  });
1999
2028
  let totalUser = 0;
@@ -2060,14 +2089,15 @@ function getLoad() {
2060
2089
  _cpus[i].loadSteal = _cpus[i].steal - tmpSteal;
2061
2090
  _cpus[i].loadGuest = _cpus[i].guest - tmpGuest;
2062
2091
  cores[i] = {};
2063
- cores[i].load = (_cpus[i].load / _cpus[i].currentTick) * 100;
2064
- cores[i].loadUser = (_cpus[i].loadUser / _cpus[i].currentTick) * 100;
2065
- cores[i].loadSystem = (_cpus[i].loadSystem / _cpus[i].currentTick) * 100;
2066
- cores[i].loadNice = (_cpus[i].loadNice / _cpus[i].currentTick) * 100;
2067
- cores[i].loadIdle = (_cpus[i].loadIdle / _cpus[i].currentTick) * 100;
2068
- cores[i].loadIrq = (_cpus[i].loadIrq / _cpus[i].currentTick) * 100;
2069
- cores[i].loadSteal = (_cpus[i].loadSteal / _cpus[i].currentTick) * 100;
2070
- cores[i].loadGuest = (_cpus[i].loadGuest / _cpus[i].currentTick) * 100;
2092
+ const coreTick = _cpus[i].currentTick || 1;
2093
+ cores[i].load = (_cpus[i].load / coreTick) * 100;
2094
+ cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
2095
+ cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
2096
+ cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
2097
+ cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
2098
+ cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
2099
+ cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
2100
+ cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
2071
2101
  cores[i].rawLoad = _cpus[i].load;
2072
2102
  cores[i].rawLoadUser = _cpus[i].loadUser;
2073
2103
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
@@ -2079,7 +2109,7 @@ function getLoad() {
2079
2109
  }
2080
2110
  const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle;
2081
2111
  const totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest;
2082
- const currentTick = totalTick - _current_cpu.tick;
2112
+ const currentTick = totalTick - _current_cpu.tick || 1;
2083
2113
  result = {
2084
2114
  avgLoad: avgLoad,
2085
2115
  currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
@@ -2132,12 +2162,15 @@ function getLoad() {
2132
2162
  const cores = [];
2133
2163
  for (let i = 0; i < _corecount; i++) {
2134
2164
  cores[i] = {};
2135
- cores[i].load = (_cpus[i].load / _cpus[i].currentTick) * 100;
2136
- cores[i].loadUser = (_cpus[i].loadUser / _cpus[i].currentTick) * 100;
2137
- cores[i].loadSystem = (_cpus[i].loadSystem / _cpus[i].currentTick) * 100;
2138
- cores[i].loadNice = (_cpus[i].loadNice / _cpus[i].currentTick) * 100;
2139
- cores[i].loadIdle = (_cpus[i].loadIdle / _cpus[i].currentTick) * 100;
2140
- cores[i].loadIrq = (_cpus[i].loadIrq / _cpus[i].currentTick) * 100;
2165
+ const coreTick = _cpus[i].currentTick || 1;
2166
+ cores[i].load = (_cpus[i].load / coreTick) * 100;
2167
+ cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
2168
+ cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
2169
+ cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
2170
+ cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
2171
+ cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
2172
+ cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
2173
+ cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
2141
2174
  cores[i].rawLoad = _cpus[i].load;
2142
2175
  cores[i].rawLoadUser = _cpus[i].loadUser;
2143
2176
  cores[i].rawLoadSystem = _cpus[i].loadSystem;
@@ -2176,12 +2209,27 @@ function getLoad() {
2176
2209
  function currentLoad(callback) {
2177
2210
  return new Promise((resolve) => {
2178
2211
  process.nextTick(() => {
2179
- getLoad().then((result) => {
2180
- if (callback) {
2181
- callback(result);
2182
- }
2183
- resolve(result);
2184
- });
2212
+ if (_current_cpu.ms === 0) {
2213
+ // no baseline yet (first call): prime the counters, then measure over a
2214
+ // short interval instead of returning the average load since boot
2215
+ getLoad().then(() => {
2216
+ setTimeout(() => {
2217
+ getLoad().then((result) => {
2218
+ if (callback) {
2219
+ callback(result);
2220
+ }
2221
+ resolve(result);
2222
+ });
2223
+ }, 500);
2224
+ });
2225
+ } else {
2226
+ getLoad().then((result) => {
2227
+ if (callback) {
2228
+ callback(result);
2229
+ }
2230
+ resolve(result);
2231
+ });
2232
+ }
2185
2233
  });
2186
2234
  });
2187
2235
  }
@@ -2208,7 +2256,7 @@ function getFullLoad() {
2208
2256
  for (let i = 0, len = cpus.length; i < len; i++) {
2209
2257
  const cpu = cpus[i].times;
2210
2258
  totalUser += cpu.user;
2211
- totalSystem += cpu.sys;
2259
+ totalSystem += _windows ? Math.max(0, cpu.sys - cpu.irq) : cpu.sys;
2212
2260
  totalNice += cpu.nice;
2213
2261
  totalIrq += cpu.irq;
2214
2262
  totalIdle += cpu.idle;