systeminformation 5.26.2 → 5.27.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
@@ -31,9 +31,9 @@
31
31
  ## The Systeminformation Project
32
32
 
33
33
  This is amazing. Started as a small project just for myself, it now has > 17,000
34
- lines of code, > 650 versions published, up to 8 mio downloads per month, > 330
35
- mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who
36
- contributed to this project!
34
+ lines of code, > 650 versions published, up to 8 mio downloads per month, > 350
35
+ mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
36
+ who contributed to this project!
37
37
 
38
38
  > **Upcoming Version 6** ⭐️⭐️⭐️
39
39
  >
@@ -163,6 +163,7 @@ si.cpu()
163
163
 
164
164
  (last 7 major and minor version releases)
165
165
 
166
+ - Version 5.27.0: `mem()` added reclaimable memory
166
167
  - Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
167
168
  - Version 5.25.0: `versions()` added homebrew
168
169
  - Version 5.24.0: `versions()` added bun and deno
@@ -338,6 +339,7 @@ Full function reference with examples can be found at
338
339
  | | buffers | X | | | | | used by buffers |
339
340
  | | cached | X | | | | | used by cache |
340
341
  | | slab | X | | | | | used by slab |
342
+ | | reclaimable | X | | X | | | reclaimable (SReclaimable) |
341
343
  | | available | X | X | X | X | X | potentially available (total - active) |
342
344
  | | swaptotal | X | X | X | X | X | |
343
345
  | | swapused | X | X | X | X | X | |
package/lib/filesystem.js CHANGED
@@ -575,7 +575,7 @@ function blockDevices(callback) {
575
575
  if (_linux) {
576
576
  // see https://wiki.ubuntuusers.de/lsblk/
577
577
  // exec("lsblk -bo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,TRAN,SERIAL,LABEL,MODEL,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,SCHED,RQ-SIZE,RA,WSAME", function (error, stdout) {
578
- exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
578
+ const procLsblk1 = exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
579
579
  if (!error) {
580
580
  let lines = blkStdoutToObject(stdout).split('\n');
581
581
  data = parseBlk(lines);
@@ -586,7 +586,7 @@ function blockDevices(callback) {
586
586
  }
587
587
  resolve(data);
588
588
  } else {
589
- exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
589
+ const procLsblk2 = exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
590
590
  if (!error) {
591
591
  let lines = blkStdoutToObject(stdout).split('\n');
592
592
  data = parseBlk(lines);
@@ -597,11 +597,23 @@ function blockDevices(callback) {
597
597
  }
598
598
  resolve(data);
599
599
  });
600
+ procLsblk2.on('error', function () {
601
+ if (callback) {
602
+ callback(data);
603
+ }
604
+ resolve(data);
605
+ });
606
+ }
607
+ });
608
+ procLsblk1.on('error', function () {
609
+ if (callback) {
610
+ callback(data);
600
611
  }
612
+ resolve(data);
601
613
  });
602
614
  }
603
615
  if (_darwin) {
604
- exec('diskutil info -all', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
616
+ const procDskutil = exec('diskutil info -all', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
605
617
  if (!error) {
606
618
  let lines = stdout.toString().split('\n');
607
619
  // parse lines into temp array of devices
@@ -613,6 +625,12 @@ function blockDevices(callback) {
613
625
  }
614
626
  resolve(data);
615
627
  });
628
+ procDskutil.on('error', function () {
629
+ if (callback) {
630
+ callback(data);
631
+ }
632
+ resolve(data);
633
+ });
616
634
  }
617
635
  if (_sunos) {
618
636
  if (callback) { callback(data); }
@@ -747,7 +765,7 @@ function fsStats(callback) {
747
765
  if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
748
766
  if (_linux) {
749
767
  // exec("df -k | grep /dev/", function(error, stdout) {
750
- exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
768
+ const procLsblk = exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
751
769
  if (!error) {
752
770
  let lines = stdout.toString().split('\n');
753
771
  let fs_filter = [];
@@ -759,7 +777,7 @@ function fsStats(callback) {
759
777
  });
760
778
 
761
779
  let output = fs_filter.join('|');
762
- exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
780
+ const procCat = exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
763
781
  if (!error) {
764
782
  let lines = stdout.toString().split('\n');
765
783
  lines.forEach(function (line) {
@@ -778,6 +796,12 @@ function fsStats(callback) {
778
796
  }
779
797
  resolve(result);
780
798
  });
799
+ procCat.on('error', function () {
800
+ if (callback) {
801
+ callback(result);
802
+ }
803
+ resolve(result);
804
+ });
781
805
  } else {
782
806
  if (callback) {
783
807
  callback(result);
@@ -785,9 +809,16 @@ function fsStats(callback) {
785
809
  resolve(result);
786
810
  }
787
811
  });
812
+ procLsblk.on('error', function () {
813
+ if (callback) {
814
+ callback(result);
815
+ }
816
+ resolve(result);
817
+ });
818
+
788
819
  }
789
820
  if (_darwin) {
790
- exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
821
+ const procIoreg = exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
791
822
  if (!error) {
792
823
  let lines = stdout.toString().split('\n');
793
824
  lines.forEach(function (line) {
@@ -806,6 +837,12 @@ function fsStats(callback) {
806
837
  }
807
838
  resolve(result);
808
839
  });
840
+ procIoreg.on('error', function () {
841
+ if (callback) {
842
+ callback(result);
843
+ }
844
+ resolve(result);
845
+ });
809
846
  }
810
847
  } else {
811
848
  result.ms = _fs_speed.last_ms;
package/lib/index.d.ts CHANGED
@@ -123,6 +123,7 @@ export namespace Systeminformation {
123
123
  buffers: number;
124
124
  cached: number;
125
125
  slab: number;
126
+ reclaimable: number;
126
127
  swaptotal: number;
127
128
  swapused: number;
128
129
  swapfree: number;
package/lib/memory.js CHANGED
@@ -31,13 +31,13 @@ const _sunos = (_platform === 'sunos');
31
31
 
32
32
  const RAM_manufacturers = {
33
33
  '00CE': 'Samsung Electronics Inc',
34
- '014F': 'Transcend Information',
35
- '017A': 'Apacer Technology Inc',
34
+ '014F': 'Transcend Information Inc.',
35
+ '017A': 'Apacer Technology Inc.',
36
36
  '0198': 'HyperX',
37
37
  '029E': 'Corsair',
38
38
  '02FE': 'Elpida',
39
39
  '04CB': 'A-DATA',
40
- '04CD': 'G-Skill International Enterprise',
40
+ '04CD': 'G.Skill International Enterprise',
41
41
  '059B': 'Crucial',
42
42
  '1315': 'Crucial',
43
43
  '2C00': 'Micron Technology Inc.',
@@ -52,6 +52,7 @@ const RAM_manufacturers = {
52
52
  'SAMSUNG': 'Samsung Electronics Inc.',
53
53
  'HYNIX': 'Hynix Semiconductor Inc.',
54
54
  'G-SKILL': 'G-Skill International Enterprise',
55
+ 'G.SKILL': 'G-Skill International Enterprise',
55
56
  'TRANSCEND': 'Transcend Information',
56
57
  'APACER': 'Apacer Technology Inc',
57
58
  'MICRON': 'Micron Technology Inc.',
@@ -151,6 +152,7 @@ function mem(callback) {
151
152
  cached: 0,
152
153
  slab: 0,
153
154
  buffcache: 0,
155
+ reclaimable: 0,
154
156
 
155
157
  swaptotal: 0,
156
158
  swapused: 0,
@@ -191,6 +193,8 @@ function mem(callback) {
191
193
  result.writeback = result.writeback ? result.writeback * 1024 : 0;
192
194
  result.dirty = parseInt(util.getValue(lines, 'dirty'), 10);
193
195
  result.dirty = result.dirty ? result.dirty * 1024 : 0;
196
+ result.reclaimable = parseInt(util.getValue(lines, 'sreclaimable'), 10);
197
+ result.reclaimable = result.reclaimable ? result.reclaimable * 1024 : 0;
194
198
  }
195
199
  if (callback) { callback(result); }
196
200
  resolve(result);
@@ -242,11 +246,11 @@ function mem(callback) {
242
246
  util.noop();
243
247
  }
244
248
  try {
245
- exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) {
249
+ exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', function (error, stdout) {
246
250
  if (!error) {
247
251
  let lines = stdout.toString().split('\n');
248
-
249
- result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
252
+ result.active = (parseInt(util.getValue(lines, 'Pages active'), 10) || 0) * pageSize;
253
+ result.reclaimable = (parseInt(util.getValue(lines, 'Pages inactive'), 10) || 0) * pageSize;
250
254
  result.buffcache = result.used - result.active;
251
255
  result.available = result.free + result.buffcache;
252
256
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.26.2",
3
+ "version": "5.27.0",
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)",