systeminformation 5.30.3 → 5.30.4

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/memory.js CHANGED
@@ -161,7 +161,7 @@ function mem(callback) {
161
161
 
162
162
  if (_linux) {
163
163
  try {
164
- fs.readFile('/proc/meminfo', function (error, stdout) {
164
+ fs.readFile('/proc/meminfo', (error, stdout) => {
165
165
  if (!error) {
166
166
  const lines = stdout.toString().split('\n');
167
167
  result.total = parseInt(util.getValue(lines, 'memtotal'), 10);
@@ -199,7 +199,7 @@ function mem(callback) {
199
199
  }
200
200
  resolve(result);
201
201
  });
202
- } catch (e) {
202
+ } catch {
203
203
  if (callback) {
204
204
  callback(result);
205
205
  }
@@ -210,9 +210,9 @@ function mem(callback) {
210
210
  try {
211
211
  exec(
212
212
  '/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size',
213
- function (error, stdout) {
213
+ (error, stdout) => {
214
214
  if (!error) {
215
- let lines = stdout.toString().split('\n');
215
+ const lines = stdout.toString().split('\n');
216
216
  const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
217
217
  const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
218
218
  const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
@@ -236,7 +236,7 @@ function mem(callback) {
236
236
  resolve(result);
237
237
  }
238
238
  );
239
- } catch (e) {
239
+ } catch {
240
240
  if (callback) {
241
241
  callback(result);
242
242
  }
@@ -254,11 +254,11 @@ function mem(callback) {
254
254
  try {
255
255
  let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString());
256
256
  pageSize = sysPpageSize || pageSize;
257
- } catch (e) {
257
+ } catch {
258
258
  util.noop();
259
259
  }
260
260
  try {
261
- exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', function (error, stdout) {
261
+ exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', (error, stdout) => {
262
262
  if (!error) {
263
263
  let lines = stdout.toString().split('\n');
264
264
  result.active = (parseInt(util.getValue(lines, 'Pages active'), 10) || 0) * pageSize;
@@ -266,7 +266,7 @@ function mem(callback) {
266
266
  result.buffcache = result.used - result.active;
267
267
  result.available = result.free + result.buffcache;
268
268
  }
269
- exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) {
269
+ exec('sysctl -n vm.swapusage 2>/dev/null', (error, stdout) => {
270
270
  if (!error) {
271
271
  let lines = stdout.toString().split('\n');
272
272
  if (lines.length > 0) {
@@ -291,7 +291,7 @@ function mem(callback) {
291
291
  resolve(result);
292
292
  });
293
293
  });
294
- } catch (e) {
294
+ } catch {
295
295
  if (callback) {
296
296
  callback(result);
297
297
  }
@@ -308,7 +308,7 @@ function mem(callback) {
308
308
  .split('\r\n')
309
309
  .filter((line) => line.trim() !== '')
310
310
  .filter((line, idx) => idx > 0);
311
- lines.forEach(function (line) {
311
+ lines.forEach((line) => {
312
312
  if (line !== '') {
313
313
  line = line.trim().split(/\s\s+/);
314
314
  swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
@@ -325,7 +325,7 @@ function mem(callback) {
325
325
  }
326
326
  resolve(result);
327
327
  });
328
- } catch (e) {
328
+ } catch {
329
329
  if (callback) {
330
330
  callback(result);
331
331
  }
@@ -354,12 +354,12 @@ function memLayout(callback) {
354
354
  if (_linux || _freebsd || _openbsd || _netbsd) {
355
355
  exec(
356
356
  'export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',
357
- function (error, stdout) {
357
+ (error, stdout) => {
358
358
  if (!error) {
359
- let devices = stdout.toString().split('Memory Device');
359
+ const devices = stdout.toString().split('Memory Device');
360
360
  devices.shift();
361
- devices.forEach(function (device) {
362
- let lines = device.split('\n');
361
+ devices.forEach((device) => {
362
+ const lines = device.split('\n');
363
363
  const sizeString = util.getValue(lines, 'Size');
364
364
  const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
365
365
  let bank = util.getValue(lines, 'Bank Locator');
@@ -457,7 +457,7 @@ function memLayout(callback) {
457
457
  result[0].voltageMax = voltage;
458
458
  }
459
459
  }
460
- } catch (e) {
460
+ } catch {
461
461
  util.noop();
462
462
  }
463
463
  }
@@ -470,7 +470,7 @@ function memLayout(callback) {
470
470
  }
471
471
 
472
472
  if (_darwin) {
473
- exec('system_profiler SPMemoryDataType', function (error, stdout) {
473
+ exec('system_profiler SPMemoryDataType', (error, stdout) => {
474
474
  if (!error) {
475
475
  const allLines = stdout.toString().split('\n');
476
476
  const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
@@ -481,8 +481,8 @@ function memLayout(callback) {
481
481
  hasBank = false;
482
482
  }
483
483
  devices.shift();
484
- devices.forEach(function (device) {
485
- let lines = device.split('\n');
484
+ devices.forEach((device) => {
485
+ const lines = device.split('\n');
486
486
  const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0];
487
487
  const size = parseInt(util.getValue(lines, ' Size'));
488
488
  if (size) {
@@ -567,10 +567,10 @@ function memLayout(callback) {
567
567
  )
568
568
  .then((stdout, error) => {
569
569
  if (!error) {
570
- let devices = stdout.toString().split(/\n\s*\n/);
570
+ const devices = stdout.toString().split(/\n\s*\n/);
571
571
  devices.shift();
572
- devices.forEach(function (device) {
573
- let lines = device.split('\r\n');
572
+ devices.forEach((device) => {
573
+ const lines = device.split('\r\n');
574
574
  const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
575
575
  const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
576
576
  const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
@@ -599,7 +599,7 @@ function memLayout(callback) {
599
599
  }
600
600
  resolve(result);
601
601
  });
602
- } catch (e) {
602
+ } catch {
603
603
  if (callback) {
604
604
  callback(result);
605
605
  }
package/lib/network.js CHANGED
@@ -119,7 +119,7 @@ function getDefaultNetworkInterface() {
119
119
  ifacename = ifacename.split(':')[1].trim();
120
120
  }
121
121
  }
122
- } catch (e) {
122
+ } catch {
123
123
  util.noop();
124
124
  }
125
125
  if (ifacename) {
@@ -143,7 +143,7 @@ function getMacAddresses() {
143
143
  } else {
144
144
  pathToIp = '';
145
145
  }
146
- } catch (e) {
146
+ } catch {
147
147
  pathToIp = '';
148
148
  }
149
149
  }
@@ -172,14 +172,14 @@ function getMacAddresses() {
172
172
  }
173
173
  }
174
174
  }
175
- } catch (e) {
175
+ } catch {
176
176
  util.noop();
177
177
  }
178
178
  }
179
179
  if (_darwin) {
180
180
  try {
181
181
  const cmd = '/sbin/ifconfig';
182
- let res = execSync(cmd);
182
+ const res = execSync(cmd);
183
183
  const lines = res.toString().split('\n');
184
184
  for (let i = 0; i < lines.length; i++) {
185
185
  if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) {
@@ -193,7 +193,7 @@ function getMacAddresses() {
193
193
  }
194
194
  }
195
195
  }
196
- } catch (e) {
196
+ } catch {
197
197
  util.noop();
198
198
  }
199
199
  }
@@ -223,11 +223,11 @@ function parseLinesWindowsNics(sections, nconfigsections) {
223
223
  try {
224
224
  if ({}.hasOwnProperty.call(sections, i)) {
225
225
  if (sections[i].trim() !== '') {
226
- let lines = sections[i].trim().split('\r\n');
226
+ const lines = sections[i].trim().split('\r\n');
227
227
  let linesNicConfig = null;
228
228
  try {
229
229
  linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : [];
230
- } catch (e) {
230
+ } catch {
231
231
  util.noop();
232
232
  }
233
233
  const netEnabled = util.getValue(lines, 'NetEnabled', ':');
@@ -252,7 +252,7 @@ function parseLinesWindowsNics(sections, nconfigsections) {
252
252
  }
253
253
  }
254
254
  }
255
- } catch (e) {
255
+ } catch {
256
256
  util.noop();
257
257
  }
258
258
  }
@@ -271,7 +271,7 @@ function getWindowsNics() {
271
271
  const nconfigsections = (data[1] || '').split(/\n\s*\n/);
272
272
  resolve(parseLinesWindowsNics(nsections, nconfigsections));
273
273
  });
274
- } catch (e) {
274
+ } catch {
275
275
  resolve([]);
276
276
  }
277
277
  });
@@ -319,7 +319,7 @@ function getWindowsDNSsuffixes() {
319
319
  });
320
320
 
321
321
  return dnsSuffixes;
322
- } catch (error) {
322
+ } catch {
323
323
  return {
324
324
  primaryDNS: '',
325
325
  exitCode: 0,
@@ -345,7 +345,7 @@ function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
345
345
  dnsSuffix = '';
346
346
  }
347
347
  return dnsSuffix;
348
- } catch (error) {
348
+ } catch {
349
349
  return 'Unknown';
350
350
  }
351
351
  }
@@ -369,7 +369,7 @@ function getWindowsWirelessIfaceSSID(interfaceName) {
369
369
  const SSID = result.split('\r\n').shift();
370
370
  const parseSSID = SSID.split(':').pop().trim();
371
371
  return parseSSID;
372
- } catch (error) {
372
+ } catch {
373
373
  return 'Unknown';
374
374
  }
375
375
  }
@@ -406,7 +406,7 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
406
406
  i8021x.protocol = protocol8021x.split(':').pop();
407
407
  i8021x.state = 'Enabled';
408
408
  }
409
- } catch (error) {
409
+ } catch {
410
410
  return i8021x;
411
411
  }
412
412
  } else if (connectionType === 'wireless') {
@@ -434,7 +434,7 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
434
434
  i8021x.state = i8021xState.split(':').pop();
435
435
  i8021x.protocol = i8021xProtocol.split(':').pop();
436
436
  }
437
- } catch (error) {
437
+ } catch {
438
438
  if (error.status === 1 && error.stdout.includes('AutoConfig')) {
439
439
  i8021x.state = 'Disabled';
440
440
  i8021x.protocol = 'Not defined';
@@ -465,9 +465,9 @@ function splitSectionsNics(lines) {
465
465
  }
466
466
 
467
467
  function parseLinesDarwinNics(sections) {
468
- let nics = [];
468
+ const nics = [];
469
469
  sections.forEach((section) => {
470
- let nic = {
470
+ const nic = {
471
471
  iface: '',
472
472
  mtu: null,
473
473
  mac: '',
@@ -1477,7 +1477,7 @@ function networkStatsSingle(iface) {
1477
1477
  result.operstate = (result.operstate || '').toLowerCase();
1478
1478
  result.operstate = result.operstate === 'active' ? 'up' : result.operstate === 'inactive' ? 'down' : 'unknown';
1479
1479
  cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input]
1480
- exec(cmd, function (error, stdout) {
1480
+ exec(cmd, (error, stdout) => {
1481
1481
  if (!error) {
1482
1482
  lines = stdout.toString().split('\n');
1483
1483
  // if there is less than 2 lines, no information for this interface was found
package/lib/printer.js CHANGED
@@ -117,7 +117,7 @@ function printer(callback) {
117
117
  let result = [];
118
118
  if (_linux || _freebsd || _openbsd || _netbsd) {
119
119
  let cmd = 'cat /etc/cups/printers.conf 2>/dev/null';
120
- exec(cmd, function (error, stdout) {
120
+ exec(cmd, (error, stdout) => {
121
121
  // printers.conf
122
122
  if (!error) {
123
123
  const parts = stdout.toString().split('<Printer ');
@@ -135,7 +135,7 @@ function printer(callback) {
135
135
  if (_linux) {
136
136
  cmd = 'export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL';
137
137
  // lpstat
138
- exec(cmd, function (error, stdout) {
138
+ exec(cmd, (error, stdout) => {
139
139
  const parts = ('\n' + stdout.toString()).split('\nprinter ');
140
140
  for (let i = 1; i < parts.length; i++) {
141
141
  const printers = parseLinuxLpstatPrinter(parts[i].split('\n'), i);
@@ -162,7 +162,7 @@ function printer(callback) {
162
162
  }
163
163
  if (_darwin) {
164
164
  let cmd = 'system_profiler SPPrintersDataType -json';
165
- exec(cmd, function (error, stdout) {
165
+ exec(cmd, (error, stdout) => {
166
166
  if (!error) {
167
167
  try {
168
168
  const outObj = JSON.parse(stdout.toString());
@@ -172,7 +172,7 @@ function printer(callback) {
172
172
  result.push(printer);
173
173
  }
174
174
  }
175
- } catch (e) {
175
+ } catch {
176
176
  util.noop();
177
177
  }
178
178
  }
package/lib/users.js CHANGED
@@ -290,7 +290,7 @@ function users(callback) {
290
290
  }
291
291
  resolve(result);
292
292
  });
293
- } catch (e) {
293
+ } catch {
294
294
  if (callback) {
295
295
  callback(result);
296
296
  }
package/lib/util.js CHANGED
@@ -479,7 +479,7 @@ function powerShell(cmd) {
479
479
  const spanOptions =
480
480
  osVersion[0] < 10
481
481
  ? ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-']
482
- : ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', cmd];
482
+ : ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', _psToUTF8 + cmd];
483
483
  const child = spawn(_powerShell, spanOptions, {
484
484
  stdio: 'pipe',
485
485
  windowsHide: true,
package/lib/virtualbox.js CHANGED
@@ -23,7 +23,7 @@ function vboxInfo(callback) {
23
23
  return new Promise((resolve) => {
24
24
  process.nextTick(() => {
25
25
  try {
26
- exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) {
26
+ exec(util.getVboxmanage() + ' list vms --long', (error, stdout) => {
27
27
  let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
28
28
  parts.shift();
29
29
  parts.forEach((part) => {
@@ -38,7 +38,7 @@ function vboxInfo(callback) {
38
38
  const offset = sinceDateObj.getTimezoneOffset();
39
39
  runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
40
40
  }
41
- } catch (e) {
41
+ } catch {
42
42
  util.noop();
43
43
  }
44
44
  const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : '';
@@ -49,7 +49,7 @@ function vboxInfo(callback) {
49
49
  const offset = sinceDateObj.getTimezoneOffset();
50
50
  stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
51
51
  }
52
- } catch (e) {
52
+ } catch {
53
53
  util.noop();
54
54
  }
55
55
  result.push({
@@ -97,7 +97,7 @@ function vboxInfo(callback) {
97
97
  }
98
98
  resolve(result);
99
99
  });
100
- } catch (e) {
100
+ } catch {
101
101
  if (callback) {
102
102
  callback(result);
103
103
  }
package/lib/wifi.js CHANGED
@@ -157,7 +157,7 @@ function ifaceListLinux() {
157
157
  });
158
158
  });
159
159
  return result;
160
- } catch (e) {
160
+ } catch {
161
161
  try {
162
162
  const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString();
163
163
  const parts = all.split('\n\n');
@@ -179,7 +179,7 @@ function ifaceListLinux() {
179
179
  }
180
180
  });
181
181
  return result;
182
- } catch (e) {
182
+ } catch {
183
183
  return [];
184
184
  }
185
185
  }
@@ -198,7 +198,7 @@ function nmiDeviceLinux(iface) {
198
198
  mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(),
199
199
  ssid: ssid !== '--' ? ssid : null
200
200
  };
201
- } catch (e) {
201
+ } catch {
202
202
  return {};
203
203
  }
204
204
  }
@@ -216,7 +216,7 @@ function nmiConnectionLinux(ssid) {
216
216
  security: util.getValue(lines, '802-11-wireless-security.key-mgmt'),
217
217
  bssid: bssid !== '--' ? bssid : null
218
218
  };
219
- } catch (e) {
219
+ } catch {
220
220
  return {};
221
221
  }
222
222
  }
@@ -237,7 +237,7 @@ function wpaConnectionLinux(iface) {
237
237
  channel: wifiChannelFromFrequencs(freq),
238
238
  bssid: util.getValue(lines, 'bssid', '=').toLowerCase()
239
239
  };
240
- } catch (e) {
240
+ } catch {
241
241
  return {};
242
242
  }
243
243
  }
@@ -272,7 +272,7 @@ function getWifiNetworkListNmi() {
272
272
  });
273
273
  });
274
274
  return result;
275
- } catch (e) {
275
+ } catch {
276
276
  return [];
277
277
  }
278
278
  }
@@ -363,7 +363,7 @@ function getWifiNetworkListIw(iface) {
363
363
  });
364
364
  }
365
365
  return result;
366
- } catch (e) {
366
+ } catch {
367
367
  return -1;
368
368
  }
369
369
  }
@@ -404,7 +404,7 @@ function parseWifiDarwin(wifiStr) {
404
404
  });
405
405
  });
406
406
  return result;
407
- } catch (e) {
407
+ } catch {
408
408
  return result;
409
409
  }
410
410
  }
@@ -460,7 +460,7 @@ function wifiNetworks(callback) {
460
460
  }
461
461
  resolve(result);
462
462
  }
463
- } catch (e) {
463
+ } catch {
464
464
  if (callback) {
465
465
  callback(result);
466
466
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.30.3",
3
+ "version": "5.30.4",
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)",