systeminformation 5.28.0 → 5.28.2

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
@@ -185,7 +185,7 @@ si.cpu()
185
185
 
186
186
  (last 7 major and minor version releases)
187
187
 
188
- - Version 5.28.0: `mem()` added suppurt for macos-temperature-sensor (macOS)
188
+ - Version 5.28.0: `cpuTemperature()` added suppurt for macos-temperature-sensor (macOS)
189
189
  - Version 5.27.0: `mem()` added reclaimable memory
190
190
  - Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
191
191
  - Version 5.25.0: `versions()` added homebrew
@@ -235,10 +235,10 @@ and above.
235
235
 
236
236
  I was able to test it on several Debian, Raspbian, Ubuntu distributions as well
237
237
  as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave,
238
- Catalina, Big Sur) and some Windows 7, Windows 8, Windows 10, FreeBSD, OpenBSD,
239
- NetBSD and SunOS machines. Not all functions are supported on all operating
240
- systems. Have a look at the function reference in the docs to get further
241
- details.
238
+ Catalina, Big Sur, Monterey, Ventura, Sonoma, Sequoia, Tahoe) and some Windows 7,
239
+ Windows 8, Windows 10, Windows 11, FreeBSD, OpenBSD, NetBSD and SunOS machines.
240
+ Not all functions are supported on all operating systems. Have a look at the
241
+ function reference in the docs to get further details.
242
242
 
243
243
  If you have comments, suggestions & reports, please feel free to contact me!
244
244
 
@@ -1018,21 +1018,27 @@ async function cpuData() {
1018
1018
 
1019
1019
  #### macOS - Temperature Sensor
1020
1020
 
1021
- To be able to measure temperature on macOS I created a little additional
1022
- package. Due to some difficulties in NPM with `optionalDependencies` I
1021
+ To be able to measure temperature on macOS I created two little additional
1022
+ packages. Due to some difficulties in NPM with `optionalDependencies` I
1023
1023
  unfortunately was getting unexpected warnings on other platforms. So I decided
1024
1024
  to drop this optional dependency for macOS - so by default, you will not get
1025
1025
  correct values.
1026
1026
 
1027
- This additional package is now also supporting Apple Silicon M1/M2/M3 machines.
1028
-
1029
1027
  But if you need to detect macOS temperature just run the following additional
1030
1028
  installation command:
1031
1029
 
1030
+ For Intel based machines (deprecated lib) install
1031
+
1032
1032
  ```bash
1033
1033
  $ npm install osx-temperature-sensor --save
1034
1034
  ```
1035
1035
 
1036
+ For Apple Silicon (ARM) based machines install
1037
+
1038
+ ```bash
1039
+ $ npm install macos-temperature-sensor --save
1040
+ ```
1041
+
1036
1042
  `systeminformation` will then detect this additional library and return the
1037
1043
  temperature when calling systeminformations standard function `cpuTemperature()`
1038
1044
 
@@ -1163,7 +1169,7 @@ trademark of Fabrice Bellard, bochs is a trademark of The Bochs Project, USB and
1163
1169
  USB Logo are trademarks of USB Implementation Forum, Bluetooth and Bluetooth
1164
1170
  Logo are trademarks of Bluetooth SIG, Android is a trademark of Google LLC,
1165
1171
  Parallels is a trademarks of Parallels International GmbH. Bun is a trademark of
1166
- Codeblog Corp. Deno is a trademark of Deno Land Inc.
1172
+ Codeblog Corp. Deno is a trademark of Deno Land Inc. Arm is a trademark of Arm Limited.
1167
1173
 
1168
1174
  All other trademarks are the property of their respective owners.
1169
1175
 
package/lib/graphics.js CHANGED
@@ -779,7 +779,7 @@ function graphics(callback) {
779
779
  try {
780
780
  stdout = execSync(
781
781
  'defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""',
782
- { maxBuffer: 1024 * 20000 }
782
+ { maxBuffer: 1024 * 102400 }
783
783
  );
784
784
  const output = (stdout || '').toString();
785
785
  const obj = util.plistReader(output);
package/lib/index.js CHANGED
@@ -42,12 +42,12 @@ const usb = require('./usb');
42
42
  const audio = require('./audio');
43
43
  const bluetooth = require('./bluetooth');
44
44
 
45
- let _platform = process.platform;
46
- const _windows = (_platform === 'win32');
47
- const _freebsd = (_platform === 'freebsd');
48
- const _openbsd = (_platform === 'openbsd');
49
- const _netbsd = (_platform === 'netbsd');
50
- const _sunos = (_platform === 'sunos');
45
+ const _platform = process.platform;
46
+ const _windows = _platform === 'win32';
47
+ const _freebsd = _platform === 'freebsd';
48
+ const _openbsd = _platform === 'openbsd';
49
+ const _netbsd = _platform === 'netbsd';
50
+ const _sunos = _platform === 'sunos';
51
51
 
52
52
  // ----------------------------------------------------------------------------------
53
53
  // init
@@ -74,11 +74,9 @@ function version() {
74
74
  // get static data - they should not change until restarted
75
75
 
76
76
  function getStaticData(callback) {
77
-
78
77
  return new Promise((resolve) => {
79
78
  process.nextTick(() => {
80
-
81
- let data = {};
79
+ const data = {};
82
80
 
83
81
  data.version = version();
84
82
 
@@ -99,7 +97,7 @@ function getStaticData(callback) {
99
97
  audio.audio(),
100
98
  bluetooth.bluetoothDevices(),
101
99
  usb.usb(),
102
- printer.printer(),
100
+ printer.printer()
103
101
  ]).then((res) => {
104
102
  data.system = res[0];
105
103
  data.bios = res[1];
@@ -118,14 +116,15 @@ function getStaticData(callback) {
118
116
  data.bluetooth = res[14];
119
117
  data.usb = res[15];
120
118
  data.printer = res[16];
121
- if (callback) { callback(data); }
119
+ if (callback) {
120
+ callback(data);
121
+ }
122
122
  resolve(data);
123
123
  });
124
124
  });
125
125
  });
126
126
  }
127
127
 
128
-
129
128
  // --------------------------
130
129
  // get all dynamic data - e.g. for monitoring agents
131
130
  // may take some seconds to get all data
@@ -135,7 +134,6 @@ function getStaticData(callback) {
135
134
  // - iface: define network interface for which you like to monitor network speed e.g. "eth0"
136
135
 
137
136
  function getDynamicData(srv, iface, callback) {
138
-
139
137
  if (util.isFunction(iface)) {
140
138
  callback = iface;
141
139
  iface = '';
@@ -147,16 +145,21 @@ function getDynamicData(srv, iface, callback) {
147
145
 
148
146
  return new Promise((resolve) => {
149
147
  process.nextTick(() => {
150
-
151
148
  iface = iface || network.getDefaultNetworkInterface();
152
149
  srv = srv || '';
153
150
 
154
151
  // use closure to track ƒ completion
155
- let functionProcessed = (function () {
152
+ let functionProcessed = (() => {
156
153
  let totalFunctions = 15;
157
- if (_windows) { totalFunctions = 13; }
158
- if (_freebsd || _openbsd || _netbsd) { totalFunctions = 11; }
159
- if (_sunos) { totalFunctions = 6; }
154
+ if (_windows) {
155
+ totalFunctions = 13;
156
+ }
157
+ if (_freebsd || _openbsd || _netbsd) {
158
+ totalFunctions = 11;
159
+ }
160
+ if (_sunos) {
161
+ totalFunctions = 6;
162
+ }
160
163
 
161
164
  return function () {
162
165
  if (--totalFunctions === 0) {
@@ -168,7 +171,7 @@ function getDynamicData(srv, iface, callback) {
168
171
  };
169
172
  })();
170
173
 
171
- let data = {};
174
+ const data = {};
172
175
 
173
176
  // get time
174
177
  data.time = osInfo.time();
@@ -286,7 +289,6 @@ function getDynamicData(srv, iface, callback) {
286
289
  // - iface: define network interface for which you like to monitor network speed e.g. "eth0"
287
290
 
288
291
  function getAllData(srv, iface, callback) {
289
-
290
292
  return new Promise((resolve) => {
291
293
  process.nextTick(() => {
292
294
  let data = {};
@@ -310,7 +312,9 @@ function getAllData(srv, iface, callback) {
310
312
  data[key] = res[key];
311
313
  }
312
314
  }
313
- if (callback) { callback(data); }
315
+ if (callback) {
316
+ callback(data);
317
+ }
314
318
  resolve(data);
315
319
  });
316
320
  });
@@ -322,8 +326,8 @@ function get(valueObject, callback) {
322
326
  return new Promise((resolve) => {
323
327
  process.nextTick(() => {
324
328
  const allPromises = Object.keys(valueObject)
325
- .filter(func => ({}.hasOwnProperty.call(exports, func)))
326
- .map(func => {
329
+ .filter((func) => ({}).hasOwnProperty.call(exports, func))
330
+ .map((func) => {
327
331
  const params = valueObject[func].substring(valueObject[func].lastIndexOf('(') + 1, valueObject[func].lastIndexOf(')'));
328
332
  let funcWithoutParams = func.indexOf(')') >= 0 ? func.split(')')[1].trim() : func;
329
333
  funcWithoutParams = func.indexOf('|') >= 0 ? func.split('|')[0].trim() : funcWithoutParams;
@@ -361,12 +365,12 @@ function get(valueObject, callback) {
361
365
  if (Array.isArray(data[i])) {
362
366
  // result is in an array, go through all elements of array and pick only the right ones
363
367
  const partialArray = [];
364
- data[i].forEach(element => {
368
+ data[i].forEach((element) => {
365
369
  let partialRes = {};
366
370
  if (keys.length === 1 && (keys[0] === '*' || keys[0] === 'all')) {
367
371
  partialRes = element;
368
372
  } else {
369
- keys.forEach(k => {
373
+ keys.forEach((k) => {
370
374
  if ({}.hasOwnProperty.call(element, k)) {
371
375
  partialRes[k] = element[k];
372
376
  }
@@ -376,11 +380,11 @@ function get(valueObject, callback) {
376
380
  if (filter && filterParts.length === 2) {
377
381
  if ({}.hasOwnProperty.call(partialRes, filterParts[0].trim())) {
378
382
  const val = partialRes[filterParts[0].trim()];
379
- if (typeof val == 'number') {
383
+ if (typeof val === 'number') {
380
384
  if (val === parseFloat(filterParts[1].trim())) {
381
385
  partialArray.push(partialRes);
382
386
  }
383
- } else if (typeof val == 'string') {
387
+ } else if (typeof val === 'string') {
384
388
  if (val.toLowerCase() === filterParts[1].trim().toLowerCase()) {
385
389
  partialArray.push(partialRes);
386
390
  }
@@ -389,12 +393,11 @@ function get(valueObject, callback) {
389
393
  } else {
390
394
  partialArray.push(partialRes);
391
395
  }
392
-
393
396
  });
394
397
  result[key] = partialArray;
395
398
  } else {
396
399
  const partialRes = {};
397
- keys.forEach(k => {
400
+ keys.forEach((k) => {
398
401
  if ({}.hasOwnProperty.call(data[i], k)) {
399
402
  partialRes[k] = data[i][k];
400
403
  }
@@ -408,7 +411,9 @@ function get(valueObject, callback) {
408
411
  i++;
409
412
  }
410
413
  }
411
- if (callback) { callback(result); }
414
+ if (callback) {
415
+ callback(result);
416
+ }
412
417
  resolve(result);
413
418
  });
414
419
  });