systeminformation 6.0.0-beta.14 → 6.0.0-beta.16
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 +9 -4
- package/dist/bsd/mem.js +8 -3
- package/dist/bsd/network-stats.d.ts +1 -1
- package/dist/bsd/network-stats.js +11 -5
- package/dist/bsd/os-info.d.ts +1 -0
- package/dist/common/defaults.js +9 -1
- package/dist/common/exec.js +28 -12
- package/dist/common/filesys.js +3 -3
- package/dist/common/network.d.ts +15 -2
- package/dist/common/network.js +18 -22
- package/dist/common/security.js +9 -3
- package/dist/common/types.d.ts +9 -0
- package/dist/darwin/network-interfaces.js +2 -5
- package/dist/darwin/network-stats.d.ts +1 -1
- package/dist/darwin/network-stats.js +8 -2
- package/dist/darwin/os-info.d.ts +2 -0
- package/dist/darwin/os-info.js +24 -2
- package/dist/darwin/users.js +1 -1
- package/dist/linux/cpu-temperature.js +1 -1
- package/dist/linux/disk-layout.js +2 -2
- package/dist/linux/fs-size.d.ts +1 -1
- package/dist/linux/fs-size.js +3 -3
- package/dist/linux/gpu.d.ts +2 -0
- package/dist/linux/gpu.js +82 -7
- package/dist/linux/mem-layout.js +1 -5
- package/dist/linux/mem.d.ts +1 -0
- package/dist/linux/mem.js +21 -1
- package/dist/linux/network-interfaces.js +68 -94
- package/dist/linux/network-stats.d.ts +1 -1
- package/dist/linux/network-stats.js +9 -7
- package/dist/linux/os-info.js +37 -1
- package/dist/linux/printer.js +1 -1
- package/dist/linux/processes.js +2 -2
- package/dist/linux/users.js +1 -1
- package/dist/linux/wifi-networks.js +2 -2
- package/dist/windows/network-interfaces.js +2 -11
- package/dist/windows/network-stats.js +16 -4
- package/package.json +1 -1
|
@@ -229,7 +229,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
229
229
|
await (0, common_1.nextTick)();
|
|
230
230
|
const interfaces = (0, node_os_1.networkInterfaces)();
|
|
231
231
|
if (JSON.stringify(interfaces) === JSON.stringify(_interfaces) && !rescan) {
|
|
232
|
-
return _networkInterfaces;
|
|
232
|
+
return (0, network_1.filterDefaultInterface)(_networkInterfaces, defaultString);
|
|
233
233
|
}
|
|
234
234
|
_interfaces = (0, index_1.cloneObj)(interfaces);
|
|
235
235
|
let result = [];
|
|
@@ -336,15 +336,6 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
336
336
|
}
|
|
337
337
|
catch { }
|
|
338
338
|
_networkInterfaces = result;
|
|
339
|
-
|
|
340
|
-
result = result.filter((item) => item.default);
|
|
341
|
-
if (result.length > 0) {
|
|
342
|
-
return [result[0]];
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
return [];
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return result;
|
|
339
|
+
return (0, network_1.filterDefaultInterface)(result, defaultString);
|
|
349
340
|
};
|
|
350
341
|
exports.networkInterfaces = networkInterfaces;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.networkStats = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
4
|
const common_1 = require("../common");
|
|
6
5
|
const defaults_1 = require("../common/defaults");
|
|
7
6
|
const network_1 = require("../common/network");
|
|
8
7
|
const security_1 = require("../common/security");
|
|
9
8
|
const windows_1 = require("../common/windows");
|
|
10
|
-
const
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
const _network = Object.create(null);
|
|
11
11
|
const parseLinesWindowsPerfData = (sections) => {
|
|
12
12
|
const perfData = [];
|
|
13
13
|
for (const i in sections) {
|
|
@@ -20,9 +20,11 @@ const parseLinesWindowsPerfData = (sections) => {
|
|
|
20
20
|
.replace(/#|\//g, '_')
|
|
21
21
|
.toLowerCase(),
|
|
22
22
|
rx_bytes: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedBytes', ':')),
|
|
23
|
+
rx_packets: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedUnicastPackets', ':')) + (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedMulticastPackets', ':')) + (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedBroadcastPackets', ':')),
|
|
23
24
|
rx_errors: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedPacketErrors', ':')),
|
|
24
25
|
rx_dropped: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedDiscardedPackets', ':')),
|
|
25
26
|
tx_bytes: (0, common_1.toInt)((0, common_1.getValue)(lines, 'SentBytes', ':')),
|
|
27
|
+
tx_packets: (0, common_1.toInt)((0, common_1.getValue)(lines, 'SentUnicastPackets', ':')) + (0, common_1.toInt)((0, common_1.getValue)(lines, 'SentMulticastPackets', ':')) + (0, common_1.toInt)((0, common_1.getValue)(lines, 'SentBroadcastPackets', ':')),
|
|
26
28
|
tx_errors: (0, common_1.toInt)((0, common_1.getValue)(lines, 'OutboundPacketErrors', ':')),
|
|
27
29
|
tx_dropped: (0, common_1.toInt)((0, common_1.getValue)(lines, 'OutboundDiscardedPackets', ':'))
|
|
28
30
|
});
|
|
@@ -37,6 +39,8 @@ const networkStatsSingle = async (iface) => {
|
|
|
37
39
|
let operstate = 'unknown';
|
|
38
40
|
let rx_bytes = 0;
|
|
39
41
|
let tx_bytes = 0;
|
|
42
|
+
let rx_packets = 0;
|
|
43
|
+
let tx_packets = 0;
|
|
40
44
|
let rx_dropped = 0;
|
|
41
45
|
let rx_errors = 0;
|
|
42
46
|
let tx_dropped = 0;
|
|
@@ -45,7 +49,7 @@ const networkStatsSingle = async (iface) => {
|
|
|
45
49
|
let ifaceName = iface;
|
|
46
50
|
let found = false;
|
|
47
51
|
try {
|
|
48
|
-
const stdout = String((await windows_1.ps.exec('Get-NetAdapterStatistics | select Name,InterfaceDescription,ReceivedBytes,ReceivedPacketErrors,ReceivedDiscardedPackets,SentBytes,OutboundPacketErrors,OutboundDiscardedPackets | fl')) || '');
|
|
52
|
+
const stdout = String((await windows_1.ps.exec('Get-NetAdapterStatistics | select Name,InterfaceDescription,ReceivedBytes,ReceivedUnicastPackets,ReceivedMulticastPackets,ReceivedBroadcastPackets,ReceivedPacketErrors,ReceivedDiscardedPackets,SentBytes,SentUnicastPackets,SentMulticastPackets,SentBroadcastPackets,OutboundPacketErrors,OutboundDiscardedPackets | fl')) || '');
|
|
49
53
|
if (stdout) {
|
|
50
54
|
const psections = stdout.split(/\n\s*\n/);
|
|
51
55
|
perfData = parseLinesWindowsPerfData(psections);
|
|
@@ -77,9 +81,11 @@ const networkStatsSingle = async (iface) => {
|
|
|
77
81
|
found = true;
|
|
78
82
|
ifaceName = det.iface;
|
|
79
83
|
rx_bytes = detail.rx_bytes;
|
|
84
|
+
rx_packets = detail.rx_packets;
|
|
80
85
|
rx_dropped = detail.rx_dropped;
|
|
81
86
|
rx_errors = detail.rx_errors;
|
|
82
87
|
tx_bytes = detail.tx_bytes;
|
|
88
|
+
tx_packets = detail.tx_packets;
|
|
83
89
|
tx_dropped = detail.tx_dropped;
|
|
84
90
|
tx_errors = detail.tx_errors;
|
|
85
91
|
operstate = det.operstate;
|
|
@@ -87,7 +93,11 @@ const networkStatsSingle = async (iface) => {
|
|
|
87
93
|
});
|
|
88
94
|
});
|
|
89
95
|
if (found) {
|
|
90
|
-
|
|
96
|
+
const stats = (0, network_1.calcNetworkSpeed)({ iface: ifaceName, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate }, _network);
|
|
97
|
+
if (ifaceName !== iface) {
|
|
98
|
+
_network[iface] = _network[ifaceName];
|
|
99
|
+
}
|
|
100
|
+
return stats;
|
|
91
101
|
}
|
|
92
102
|
return defaults;
|
|
93
103
|
}
|
|
@@ -96,6 +106,8 @@ const networkStatsSingle = async (iface) => {
|
|
|
96
106
|
...defaults,
|
|
97
107
|
rx_bytes: _network[iface].rx_bytes,
|
|
98
108
|
tx_bytes: _network[iface].tx_bytes,
|
|
109
|
+
rx_packets: _network[iface].rx_packets,
|
|
110
|
+
tx_packets: _network[iface].tx_packets,
|
|
99
111
|
rx_sec: _network[iface].rx_sec,
|
|
100
112
|
tx_sec: _network[iface].tx_sec,
|
|
101
113
|
rx_dropped: _network[iface].rx_dropped,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.16",
|
|
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)",
|