systeminformation 5.26.1 → 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 +5 -3
- package/lib/filesystem.js +43 -6
- package/lib/index.d.ts +1 -0
- package/lib/memory.js +30 -41
- package/package.json +1 -1
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, >
|
|
35
|
-
mio downloads overall.
|
|
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
package/lib/memory.js
CHANGED
|
@@ -29,41 +29,34 @@ const _openbsd = (_platform === 'openbsd');
|
|
|
29
29
|
const _netbsd = (_platform === 'netbsd');
|
|
30
30
|
const _sunos = (_platform === 'sunos');
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'0x80AD': 'Hynix Semiconductor Inc.',
|
|
37
|
-
'0x80CE': 'Samsung Electronics Inc.',
|
|
38
|
-
'0xAD00': 'Hynix Semiconductor Inc.',
|
|
39
|
-
'0xCE00': 'Samsung Electronics Inc.',
|
|
40
|
-
'0x02FE': 'Elpida',
|
|
41
|
-
'0x5105': 'Qimonda AG i. In.',
|
|
42
|
-
'0x8551': 'Qimonda AG i. In.',
|
|
43
|
-
'0x859B': 'Crucial',
|
|
44
|
-
'0x04CD': 'G-Skill'
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const LINUX_RAM_manufacturers = {
|
|
48
|
-
'017A': 'Apacer',
|
|
32
|
+
const RAM_manufacturers = {
|
|
33
|
+
'00CE': 'Samsung Electronics Inc',
|
|
34
|
+
'014F': 'Transcend Information Inc.',
|
|
35
|
+
'017A': 'Apacer Technology Inc.',
|
|
49
36
|
'0198': 'HyperX',
|
|
50
37
|
'029E': 'Corsair',
|
|
38
|
+
'02FE': 'Elpida',
|
|
51
39
|
'04CB': 'A-DATA',
|
|
52
|
-
'04CD': 'G
|
|
40
|
+
'04CD': 'G.Skill International Enterprise',
|
|
53
41
|
'059B': 'Crucial',
|
|
54
|
-
'00CE': 'Samsung',
|
|
55
42
|
'1315': 'Crucial',
|
|
56
|
-
'014F': 'Transcend Information',
|
|
57
43
|
'2C00': 'Micron Technology Inc.',
|
|
44
|
+
'5105': 'Qimonda AG i. In.',
|
|
58
45
|
'802C': 'Micron Technology Inc.',
|
|
59
46
|
'80AD': 'Hynix Semiconductor Inc.',
|
|
60
47
|
'80CE': 'Samsung Electronics Inc.',
|
|
48
|
+
'8551': 'Qimonda AG i. In.',
|
|
49
|
+
'859B': 'Crucial',
|
|
61
50
|
'AD00': 'Hynix Semiconductor Inc.',
|
|
62
51
|
'CE00': 'Samsung Electronics Inc.',
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
52
|
+
'SAMSUNG': 'Samsung Electronics Inc.',
|
|
53
|
+
'HYNIX': 'Hynix Semiconductor Inc.',
|
|
54
|
+
'G-SKILL': 'G-Skill International Enterprise',
|
|
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.',
|
|
67
60
|
};
|
|
68
61
|
|
|
69
62
|
// _______________________________________________________________________________________
|
|
@@ -159,6 +152,7 @@ function mem(callback) {
|
|
|
159
152
|
cached: 0,
|
|
160
153
|
slab: 0,
|
|
161
154
|
buffcache: 0,
|
|
155
|
+
reclaimable: 0,
|
|
162
156
|
|
|
163
157
|
swaptotal: 0,
|
|
164
158
|
swapused: 0,
|
|
@@ -199,6 +193,8 @@ function mem(callback) {
|
|
|
199
193
|
result.writeback = result.writeback ? result.writeback * 1024 : 0;
|
|
200
194
|
result.dirty = parseInt(util.getValue(lines, 'dirty'), 10);
|
|
201
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;
|
|
202
198
|
}
|
|
203
199
|
if (callback) { callback(result); }
|
|
204
200
|
resolve(result);
|
|
@@ -250,11 +246,11 @@ function mem(callback) {
|
|
|
250
246
|
util.noop();
|
|
251
247
|
}
|
|
252
248
|
try {
|
|
253
|
-
exec('vm_stat 2>/dev/null |
|
|
249
|
+
exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', function (error, stdout) {
|
|
254
250
|
if (!error) {
|
|
255
251
|
let lines = stdout.toString().split('\n');
|
|
256
|
-
|
|
257
|
-
result.
|
|
252
|
+
result.active = (parseInt(util.getValue(lines, 'Pages active'), 10) || 0) * pageSize;
|
|
253
|
+
result.reclaimable = (parseInt(util.getValue(lines, 'Pages inactive'), 10) || 0) * pageSize;
|
|
258
254
|
result.buffcache = result.used - result.active;
|
|
259
255
|
result.available = result.free + result.buffcache;
|
|
260
256
|
}
|
|
@@ -315,17 +311,10 @@ exports.mem = mem;
|
|
|
315
311
|
|
|
316
312
|
function memLayout(callback) {
|
|
317
313
|
|
|
318
|
-
function
|
|
319
|
-
if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) {
|
|
320
|
-
return (OSX_RAM_manufacturers[manId]);
|
|
321
|
-
}
|
|
322
|
-
return manId;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function getManufacturerLinux(manId) {
|
|
314
|
+
function getManufacturer(manId) {
|
|
326
315
|
const manIdSearch = manId.replace('0x', '').toUpperCase();
|
|
327
|
-
if (manIdSearch.length
|
|
328
|
-
return (
|
|
316
|
+
if (manIdSearch.length >= 4 && {}.hasOwnProperty.call(RAM_manufacturers, manIdSearch)) {
|
|
317
|
+
return (RAM_manufacturers[manIdSearch]);
|
|
329
318
|
}
|
|
330
319
|
return manId;
|
|
331
320
|
}
|
|
@@ -358,7 +347,7 @@ function memLayout(callback) {
|
|
|
358
347
|
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
|
359
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)),
|
|
360
349
|
formFactor: util.getValue(lines, 'Form Factor:'),
|
|
361
|
-
manufacturer:
|
|
350
|
+
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer:')),
|
|
362
351
|
partNum: util.getValue(lines, 'Part Number:'),
|
|
363
352
|
serialNum: util.getValue(lines, 'Serial Number:'),
|
|
364
353
|
voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
|
|
@@ -470,7 +459,7 @@ function memLayout(callback) {
|
|
|
470
459
|
ecc: eccStatus ? eccStatus === 'enabled' : null,
|
|
471
460
|
clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10),
|
|
472
461
|
formFactor: '',
|
|
473
|
-
manufacturer:
|
|
462
|
+
manufacturer: getManufacturer(util.getValue(lines, ' Manufacturer:')),
|
|
474
463
|
partNum: util.getValue(lines, ' Part Number:'),
|
|
475
464
|
serialNum: util.getValue(lines, ' Serial Number:'),
|
|
476
465
|
voltageConfigured: null,
|
|
@@ -508,7 +497,7 @@ function memLayout(callback) {
|
|
|
508
497
|
ecc: false,
|
|
509
498
|
clockSpeed: null,
|
|
510
499
|
formFactor: 'SOC',
|
|
511
|
-
manufacturer:
|
|
500
|
+
manufacturer: getManufacturer(manufacturerId),
|
|
512
501
|
partNum: '',
|
|
513
502
|
serialNum: '',
|
|
514
503
|
voltageConfigured: null,
|
|
@@ -551,7 +540,7 @@ function memLayout(callback) {
|
|
|
551
540
|
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
|
552
541
|
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
|
|
553
542
|
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
|
|
554
|
-
manufacturer: util.getValue(lines, 'Manufacturer', ':'),
|
|
543
|
+
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer', ':')),
|
|
555
544
|
partNum: util.getValue(lines, 'PartNumber', ':'),
|
|
556
545
|
serialNum: util.getValue(lines, 'SerialNumber', ':'),
|
|
557
546
|
voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.
|
|
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)",
|