systeminformation 5.28.9 → 5.29.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/lib/memory.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT
@@ -21,13 +21,13 @@ const fs = require('fs');
21
21
 
22
22
  let _platform = process.platform;
23
23
 
24
- const _linux = (_platform === 'linux' || _platform === 'android');
25
- const _darwin = (_platform === 'darwin');
26
- const _windows = (_platform === 'win32');
27
- const _freebsd = (_platform === 'freebsd');
28
- const _openbsd = (_platform === 'openbsd');
29
- const _netbsd = (_platform === 'netbsd');
30
- const _sunos = (_platform === 'sunos');
24
+ const _linux = _platform === 'linux' || _platform === 'android';
25
+ const _darwin = _platform === 'darwin';
26
+ const _windows = _platform === 'win32';
27
+ const _freebsd = _platform === 'freebsd';
28
+ const _openbsd = _platform === 'openbsd';
29
+ const _netbsd = _platform === 'netbsd';
30
+ const _sunos = _platform === 'sunos';
31
31
 
32
32
  const RAM_manufacturers = {
33
33
  '00CE': 'Samsung Electronics Inc',
@@ -39,24 +39,24 @@ const RAM_manufacturers = {
39
39
  '04CB': 'A-DATA',
40
40
  '04CD': 'G.Skill International Enterprise',
41
41
  '059B': 'Crucial',
42
- '1315': 'Crucial',
42
+ 1315: 'Crucial',
43
43
  '2C00': 'Micron Technology Inc.',
44
- '5105': 'Qimonda AG i. In.',
44
+ 5105: 'Qimonda AG i. In.',
45
45
  '802C': 'Micron Technology Inc.',
46
46
  '80AD': 'Hynix Semiconductor Inc.',
47
47
  '80CE': 'Samsung Electronics Inc.',
48
- '8551': 'Qimonda AG i. In.',
48
+ 8551: 'Qimonda AG i. In.',
49
49
  '859B': 'Crucial',
50
- 'AD00': 'Hynix Semiconductor Inc.',
51
- 'CE00': 'Samsung Electronics Inc.',
52
- 'SAMSUNG': 'Samsung Electronics Inc.',
53
- 'HYNIX': 'Hynix Semiconductor Inc.',
50
+ AD00: 'Hynix Semiconductor Inc.',
51
+ CE00: 'Samsung Electronics Inc.',
52
+ SAMSUNG: 'Samsung Electronics Inc.',
53
+ HYNIX: 'Hynix Semiconductor Inc.',
54
54
  'G-SKILL': 'G-Skill International Enterprise',
55
55
  'G.SKILL': 'G-Skill International Enterprise',
56
- 'TRANSCEND': 'Transcend Information',
57
- 'APACER': 'Apacer Technology Inc',
58
- 'MICRON': 'Micron Technology Inc.',
59
- 'QIMONDA': 'Qimonda AG i. In.',
56
+ TRANSCEND: 'Transcend Information',
57
+ APACER: 'Apacer Technology Inc',
58
+ MICRON: 'Micron Technology Inc.',
59
+ QIMONDA: 'Qimonda AG i. In.'
60
60
  };
61
61
 
62
62
  // _______________________________________________________________________________________
@@ -137,17 +137,15 @@ const RAM_manufacturers = {
137
137
  // SUnreclaim: 79352 kB
138
138
 
139
139
  function mem(callback) {
140
-
141
140
  return new Promise((resolve) => {
142
141
  process.nextTick(() => {
143
-
144
142
  let result = {
145
143
  total: os.totalmem(),
146
144
  free: os.freemem(),
147
145
  used: os.totalmem() - os.freemem(),
148
146
 
149
- active: os.totalmem() - os.freemem(), // temporarily (fallback)
150
- available: os.freemem(), // temporarily (fallback)
147
+ active: os.totalmem() - os.freemem(), // temporarily (fallback)
148
+ available: os.freemem(), // temporarily (fallback)
151
149
  buffers: 0,
152
150
  cached: 0,
153
151
  slab: 0,
@@ -196,45 +194,59 @@ function mem(callback) {
196
194
  result.reclaimable = parseInt(util.getValue(lines, 'sreclaimable'), 10);
197
195
  result.reclaimable = result.reclaimable ? result.reclaimable * 1024 : 0;
198
196
  }
199
- if (callback) { callback(result); }
197
+ if (callback) {
198
+ callback(result);
199
+ }
200
200
  resolve(result);
201
201
  });
202
202
  } catch (e) {
203
- if (callback) { callback(result); }
203
+ if (callback) {
204
+ callback(result);
205
+ }
204
206
  resolve(result);
205
207
  }
206
208
  }
207
209
  if (_freebsd || _openbsd || _netbsd) {
208
210
  try {
209
- exec('/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', function (error, stdout) {
210
- if (!error) {
211
- let lines = stdout.toString().split('\n');
212
- const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
213
- const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
214
- const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
215
-
216
- result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
217
- if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
218
- result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
219
- result.buffcache = inactive + cache;
220
- result.available = result.buffcache + result.free;
221
- result.active = result.total - result.free - result.buffcache;
222
-
223
- result.swaptotal = 0;
224
- result.swapfree = 0;
225
- result.swapused = 0;
211
+ exec(
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) {
214
+ if (!error) {
215
+ let lines = stdout.toString().split('\n');
216
+ const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
217
+ const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
218
+ const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
226
219
 
220
+ result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
221
+ if (isNaN(result.total)) {
222
+ result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10);
223
+ }
224
+ result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
225
+ result.buffcache = inactive + cache;
226
+ result.available = result.buffcache + result.free;
227
+ result.active = result.total - result.free - result.buffcache;
228
+
229
+ result.swaptotal = 0;
230
+ result.swapfree = 0;
231
+ result.swapused = 0;
232
+ }
233
+ if (callback) {
234
+ callback(result);
235
+ }
236
+ resolve(result);
227
237
  }
228
- if (callback) { callback(result); }
229
- resolve(result);
230
- });
238
+ );
231
239
  } catch (e) {
232
- if (callback) { callback(result); }
240
+ if (callback) {
241
+ callback(result);
242
+ }
233
243
  resolve(result);
234
244
  }
235
245
  }
236
246
  if (_sunos) {
237
- if (callback) { callback(result); }
247
+ if (callback) {
248
+ callback(result);
249
+ }
238
250
  resolve(result);
239
251
  }
240
252
  if (_darwin) {
@@ -260,19 +272,29 @@ function mem(callback) {
260
272
  if (lines.length > 0) {
261
273
  let firstline = lines[0].replace(/,/g, '.').replace(/M/g, '');
262
274
  let lineArray = firstline.trim().split(' ');
263
- lineArray.forEach(line => {
264
- if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
265
- if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
266
- if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
275
+ lineArray.forEach((line) => {
276
+ if (line.toLowerCase().indexOf('total') !== -1) {
277
+ result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
278
+ }
279
+ if (line.toLowerCase().indexOf('used') !== -1) {
280
+ result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
281
+ }
282
+ if (line.toLowerCase().indexOf('free') !== -1) {
283
+ result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
284
+ }
267
285
  });
268
286
  }
269
287
  }
270
- if (callback) { callback(result); }
288
+ if (callback) {
289
+ callback(result);
290
+ }
271
291
  resolve(result);
272
292
  });
273
293
  });
274
294
  } catch (e) {
275
- if (callback) { callback(result); }
295
+ if (callback) {
296
+ callback(result);
297
+ }
276
298
  resolve(result);
277
299
  }
278
300
  }
@@ -282,7 +304,10 @@ function mem(callback) {
282
304
  try {
283
305
  util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
284
306
  if (!error) {
285
- let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
307
+ let lines = stdout
308
+ .split('\r\n')
309
+ .filter((line) => line.trim() !== '')
310
+ .filter((line, idx) => idx > 0);
286
311
  lines.forEach(function (line) {
287
312
  if (line !== '') {
288
313
  line = line.trim().split(/\s\s+/);
@@ -295,11 +320,15 @@ function mem(callback) {
295
320
  result.swapused = swapused * 1024 * 1024;
296
321
  result.swapfree = result.swaptotal - result.swapused;
297
322
 
298
- if (callback) { callback(result); }
323
+ if (callback) {
324
+ callback(result);
325
+ }
299
326
  resolve(result);
300
327
  });
301
328
  } catch (e) {
302
- if (callback) { callback(result); }
329
+ if (callback) {
330
+ callback(result);
331
+ }
303
332
  resolve(result);
304
333
  }
305
334
  }
@@ -310,129 +339,134 @@ function mem(callback) {
310
339
  exports.mem = mem;
311
340
 
312
341
  function memLayout(callback) {
313
-
314
342
  function getManufacturer(manId) {
315
343
  const manIdSearch = manId.replace('0x', '').toUpperCase();
316
344
  if (manIdSearch.length >= 4 && {}.hasOwnProperty.call(RAM_manufacturers, manIdSearch)) {
317
- return (RAM_manufacturers[manIdSearch]);
345
+ return RAM_manufacturers[manIdSearch];
318
346
  }
319
347
  return manId;
320
348
  }
321
349
 
322
350
  return new Promise((resolve) => {
323
351
  process.nextTick(() => {
324
-
325
352
  let result = [];
326
353
 
327
354
  if (_linux || _freebsd || _openbsd || _netbsd) {
328
- exec('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', function (error, stdout) {
329
- if (!error) {
330
- let devices = stdout.toString().split('Memory Device');
331
- devices.shift();
332
- devices.forEach(function (device) {
333
- let lines = device.split('\n');
334
- const sizeString = util.getValue(lines, 'Size');
335
- const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
336
- let bank = util.getValue(lines, 'Bank Locator');
337
- if (bank.toLowerCase().indexOf('bad') >= 0) {
338
- bank = '';
339
- }
340
- if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
341
- const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
342
- const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
343
- result.push({
344
- size,
345
- bank,
346
- type: util.getValue(lines, 'Type:'),
347
- ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
348
- clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)),
349
- formFactor: util.getValue(lines, 'Form Factor:'),
350
- manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer:')),
351
- partNum: util.getValue(lines, 'Part Number:'),
352
- serialNum: util.getValue(lines, 'Serial Number:'),
353
- voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
354
- voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
355
- voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null,
356
- });
357
- } else {
358
- result.push({
359
- size: 0,
360
- bank,
361
- type: 'Empty',
362
- ecc: null,
363
- clockSpeed: 0,
364
- formFactor: util.getValue(lines, 'Form Factor:'),
365
- partNum: '',
366
- serialNum: '',
367
- voltageConfigured: null,
368
- voltageMin: null,
369
- voltageMax: null,
370
- });
371
- }
372
- });
373
- }
374
- if (!result.length) {
375
- result.push({
376
- size: os.totalmem(),
377
- bank: '',
378
- type: '',
379
- ecc: null,
380
- clockSpeed: 0,
381
- formFactor: '',
382
- partNum: '',
383
- serialNum: '',
384
- voltageConfigured: null,
385
- voltageMin: null,
386
- voltageMax: null,
387
- });
388
-
389
- // Try Raspberry PI
390
- try {
391
- let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
392
- let lines = stdout.toString().split('\n');
393
- let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
394
-
395
- if (util.isRaspberry(lines)) {
396
-
397
- const clockSpeed = {
398
- '0': 400,
399
- '1': 450,
400
- '2': 450,
401
- '3': 3200,
402
- '4': 4267
403
- };
404
- result[0].type = 'LPDDR2';
405
- result[0].type = version && version[2] && (version[2] === '3') ? 'LPDDR4' : result[0].type;
406
- result[0].type = version && version[2] && (version[2] === '4') ? 'LPDDR4X' : result[0].type;
407
- result[0].ecc = false;
408
- result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
409
- result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
410
- result[0].formFactor = 'SoC';
411
-
412
- stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux);
413
- lines = stdout.toString().split('\n');
414
- let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
415
- if (freq) {
416
- result[0].clockSpeed = freq;
355
+ exec(
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) {
358
+ if (!error) {
359
+ let devices = stdout.toString().split('Memory Device');
360
+ devices.shift();
361
+ devices.forEach(function (device) {
362
+ let lines = device.split('\n');
363
+ const sizeString = util.getValue(lines, 'Size');
364
+ const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
365
+ let bank = util.getValue(lines, 'Bank Locator');
366
+ if (bank.toLowerCase().indexOf('bad') >= 0) {
367
+ bank = '';
417
368
  }
369
+ if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
370
+ const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
371
+ const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
372
+ result.push({
373
+ size,
374
+ bank,
375
+ type: util.getValue(lines, 'Type:'),
376
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
377
+ clockSpeed: util.getValue(lines, 'Configured Clock Speed:')
378
+ ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10)
379
+ : util.getValue(lines, 'Speed:')
380
+ ? parseInt(util.getValue(lines, 'Speed:'), 10)
381
+ : null,
382
+ formFactor: util.getValue(lines, 'Form Factor:'),
383
+ manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer:')),
384
+ partNum: util.getValue(lines, 'Part Number:'),
385
+ serialNum: util.getValue(lines, 'Serial Number:'),
386
+ voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
387
+ voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
388
+ voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null
389
+ });
390
+ } else {
391
+ result.push({
392
+ size: 0,
393
+ bank,
394
+ type: 'Empty',
395
+ ecc: null,
396
+ clockSpeed: 0,
397
+ formFactor: util.getValue(lines, 'Form Factor:'),
398
+ partNum: '',
399
+ serialNum: '',
400
+ voltageConfigured: null,
401
+ voltageMin: null,
402
+ voltageMax: null
403
+ });
404
+ }
405
+ });
406
+ }
407
+ if (!result.length) {
408
+ result.push({
409
+ size: os.totalmem(),
410
+ bank: '',
411
+ type: '',
412
+ ecc: null,
413
+ clockSpeed: 0,
414
+ formFactor: '',
415
+ partNum: '',
416
+ serialNum: '',
417
+ voltageConfigured: null,
418
+ voltageMin: null,
419
+ voltageMax: null
420
+ });
418
421
 
419
- stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux);
420
- lines = stdout.toString().split('\n');
421
- let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
422
- if (voltage) {
423
- result[0].voltageConfigured = voltage;
424
- result[0].voltageMin = voltage;
425
- result[0].voltageMax = voltage;
422
+ // Try Raspberry PI
423
+ try {
424
+ let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
425
+ let lines = stdout.toString().split('\n');
426
+ let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
427
+
428
+ if (util.isRaspberry(lines)) {
429
+ const clockSpeed = {
430
+ 0: 400,
431
+ 1: 450,
432
+ 2: 450,
433
+ 3: 3200,
434
+ 4: 4267
435
+ };
436
+ result[0].type = 'LPDDR2';
437
+ result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
438
+ result[0].type = version && version[2] && version[2] === '4' ? 'LPDDR4X' : result[0].type;
439
+ result[0].ecc = false;
440
+ result[0].clockSpeed = (version && version[2] && clockSpeed[version[2]]) || 400;
441
+ result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
442
+ result[0].formFactor = 'SoC';
443
+
444
+ stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux);
445
+ lines = stdout.toString().split('\n');
446
+ let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
447
+ if (freq) {
448
+ result[0].clockSpeed = freq;
449
+ }
450
+
451
+ stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux);
452
+ lines = stdout.toString().split('\n');
453
+ let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
454
+ if (voltage) {
455
+ result[0].voltageConfigured = voltage;
456
+ result[0].voltageMin = voltage;
457
+ result[0].voltageMax = voltage;
458
+ }
426
459
  }
460
+ } catch (e) {
461
+ util.noop();
427
462
  }
428
- } catch (e) {
429
- util.noop();
430
463
  }
431
-
464
+ if (callback) {
465
+ callback(result);
466
+ }
467
+ resolve(result);
432
468
  }
433
- if (callback) { callback(result); }
434
- resolve(result);
435
- });
469
+ );
436
470
  }
437
471
 
438
472
  if (_darwin) {
@@ -464,7 +498,7 @@ function memLayout(callback) {
464
498
  serialNum: util.getValue(lines, ' Serial Number:'),
465
499
  voltageConfigured: null,
466
500
  voltageMin: null,
467
- voltageMax: null,
501
+ voltageMax: null
468
502
  });
469
503
  } else {
470
504
  result.push({
@@ -479,7 +513,7 @@ function memLayout(callback) {
479
513
  serialNum: '',
480
514
  voltageConfigured: null,
481
515
  voltageMin: null,
482
- voltageMax: null,
516
+ voltageMax: null
483
517
  });
484
518
  }
485
519
  });
@@ -502,59 +536,73 @@ function memLayout(callback) {
502
536
  serialNum: '',
503
537
  voltageConfigured: null,
504
538
  voltageMin: null,
505
- voltageMax: null,
539
+ voltageMax: null
506
540
  });
507
-
508
541
  }
509
542
  }
510
- if (callback) { callback(result); }
543
+ if (callback) {
544
+ callback(result);
545
+ }
511
546
  resolve(result);
512
547
  });
513
548
  }
514
549
  if (_sunos) {
515
- if (callback) { callback(result); }
550
+ if (callback) {
551
+ callback(result);
552
+ }
516
553
  resolve(result);
517
554
  }
518
555
  if (_windows) {
519
556
  // https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf
520
- const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split('|');
557
+ const memoryTypes =
558
+ 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split(
559
+ '|'
560
+ );
521
561
  const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
522
562
 
523
563
  try {
524
- util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,Speed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl').then((stdout, error) => {
525
- if (!error) {
526
- let devices = stdout.toString().split(/\n\s*\n/);
527
- devices.shift();
528
- devices.forEach(function (device) {
529
- let lines = device.split('\r\n');
530
- const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
531
- const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
532
- const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
533
- const tag = util.getValue(lines, 'Tag', ':');
534
- const tagInt = util.splitByNumber(tag);
535
- if (size) {
536
- result.push({
537
- size,
538
- bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel
539
- type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
540
- ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
541
- clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
542
- formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
543
- manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer', ':')),
544
- partNum: util.getValue(lines, 'PartNumber', ':'),
545
- serialNum: util.getValue(lines, 'SerialNumber', ':'),
546
- voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
547
- voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
548
- voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
549
- });
550
- }
551
- });
552
- }
553
- if (callback) { callback(result); }
554
- resolve(result);
555
- });
564
+ util
565
+ .powerShell(
566
+ 'Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,Speed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl'
567
+ )
568
+ .then((stdout, error) => {
569
+ if (!error) {
570
+ let devices = stdout.toString().split(/\n\s*\n/);
571
+ devices.shift();
572
+ devices.forEach(function (device) {
573
+ let lines = device.split('\r\n');
574
+ const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
575
+ const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
576
+ const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
577
+ const tag = util.getValue(lines, 'Tag', ':');
578
+ const tagInt = util.splitByNumber(tag);
579
+ if (size) {
580
+ result.push({
581
+ size,
582
+ bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel
583
+ type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
584
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
585
+ clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
586
+ formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
587
+ manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer', ':')),
588
+ partNum: util.getValue(lines, 'PartNumber', ':'),
589
+ serialNum: util.getValue(lines, 'SerialNumber', ':'),
590
+ voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
591
+ voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
592
+ voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0
593
+ });
594
+ }
595
+ });
596
+ }
597
+ if (callback) {
598
+ callback(result);
599
+ }
600
+ resolve(result);
601
+ });
556
602
  } catch (e) {
557
- if (callback) { callback(result); }
603
+ if (callback) {
604
+ callback(result);
605
+ }
558
606
  resolve(result);
559
607
  }
560
608
  }
@@ -563,4 +611,3 @@ function memLayout(callback) {
563
611
  }
564
612
 
565
613
  exports.memLayout = memLayout;
566
-
package/lib/network.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // ----------------------------------------------------------------------------------
6
6
  // Description: System Information - library
7
7
  // for Node.js
8
- // Copyright: (c) 2014 - 2025
8
+ // Copyright: (c) 2014 - 2026
9
9
  // Author: Sebastian Hildebrandt
10
10
  // ----------------------------------------------------------------------------------
11
11
  // License: MIT