systeminformation 5.9.15 → 5.10.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 +2 -1
- package/lib/audio.js +219 -219
- package/lib/battery.js +309 -309
- package/lib/bluetooth.js +183 -183
- package/lib/cli.js +2 -2
- package/lib/cpu.js +2 -2
- package/lib/docker.js +1 -1
- package/lib/dockerSocket.js +1 -1
- package/lib/filesystem.js +2 -2
- package/lib/graphics.js +2 -2
- package/lib/index.js +3 -1
- package/lib/internet.js +2 -2
- package/lib/memory.js +10 -3
- package/lib/network.js +2 -2
- package/lib/osinfo.js +2 -2
- package/lib/printer.js +212 -212
- package/lib/processes.js +1240 -1240
- package/lib/system.js +2 -2
- package/lib/usb.js +305 -305
- package/lib/users.js +2 -2
- package/lib/util.js +237 -119
- package/lib/virtualbox.js +1 -1
- package/lib/wifi.js +74 -43
- package/package.json +3 -2
package/lib/bluetooth.js
CHANGED
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// @ts-check
|
|
3
|
-
// ==================================================================================
|
|
4
|
-
// audio.js
|
|
5
|
-
// ----------------------------------------------------------------------------------
|
|
6
|
-
// Description: System Information - library
|
|
7
|
-
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
9
|
-
// Author: Sebastian Hildebrandt
|
|
10
|
-
// ----------------------------------------------------------------------------------
|
|
11
|
-
// License: MIT
|
|
12
|
-
// ==================================================================================
|
|
13
|
-
// 17. bluetooth
|
|
14
|
-
// ----------------------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
const exec = require('child_process').exec;
|
|
17
|
-
const execSync = require('child_process').execSync;
|
|
18
|
-
const path = require('path');
|
|
19
|
-
const util = require('./util');
|
|
20
|
-
const fs = require('fs');
|
|
21
|
-
|
|
22
|
-
let _platform = process.platform;
|
|
23
|
-
|
|
24
|
-
const _linux = (_platform === 'linux');
|
|
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
|
-
|
|
32
|
-
function parseBluetoothType(str) {
|
|
33
|
-
let result = '';
|
|
34
|
-
|
|
35
|
-
if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
|
36
|
-
if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
|
|
37
|
-
if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
|
|
38
|
-
if (str.indexOf('headset') >= 0) { result = 'Headset'; }
|
|
39
|
-
if (str.indexOf('phone') >= 0) { result = 'Phone'; }
|
|
40
|
-
// to be continued ...
|
|
41
|
-
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) {
|
|
46
|
-
const result = {};
|
|
47
|
-
|
|
48
|
-
result.device = null;
|
|
49
|
-
result.name = util.getValue(lines, 'name', '=');
|
|
50
|
-
result.manufacturer = null;
|
|
51
|
-
result.macDevice = macAddr1;
|
|
52
|
-
result.macHost = macAddr2;
|
|
53
|
-
result.batteryPercent = null;
|
|
54
|
-
result.type = parseBluetoothType(result.name.toLowerCase());
|
|
55
|
-
result.connected = false;
|
|
56
|
-
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) {
|
|
61
|
-
const result = {};
|
|
62
|
-
const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || '') + (bluetoothObject.device_name || '')).toLowerCase();
|
|
63
|
-
|
|
64
|
-
result.device = bluetoothObject.device_services || '';
|
|
65
|
-
result.name = bluetoothObject.device_name || '';
|
|
66
|
-
result.manufacturer = bluetoothObject.device_manufacturer || '';
|
|
67
|
-
result.macDevice = (bluetoothObject.device_addr || '').toLowerCase().replace(/-/g, ':');
|
|
68
|
-
result.macHost = macAddr2;
|
|
69
|
-
result.batteryPercent = bluetoothObject.device_batteryPercent || null;
|
|
70
|
-
result.type = parseBluetoothType(typeStr);
|
|
71
|
-
result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false;
|
|
72
|
-
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function parseWindowsBluetooth(lines) {
|
|
77
|
-
const result = {};
|
|
78
|
-
|
|
79
|
-
result.device = null;
|
|
80
|
-
result.name = util.getValue(lines, 'name', ':');
|
|
81
|
-
result.manufacturer = util.getValue(lines, 'manufacturer', ':');
|
|
82
|
-
result.macDevice = null;
|
|
83
|
-
result.macHost = null;
|
|
84
|
-
result.batteryPercent = null;
|
|
85
|
-
result.type = parseBluetoothType(result.name.toLowerCase());
|
|
86
|
-
result.connected = null;
|
|
87
|
-
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function bluetoothDevices(callback) {
|
|
92
|
-
|
|
93
|
-
return new Promise((resolve) => {
|
|
94
|
-
process.nextTick(() => {
|
|
95
|
-
let result = [];
|
|
96
|
-
if (_linux) {
|
|
97
|
-
// get files in /var/lib/bluetooth/ recursive
|
|
98
|
-
const btFiles = util.getFilesInPath('/var/lib/bluetooth/');
|
|
99
|
-
for (let i = 0; i < btFiles.length; i++) {
|
|
100
|
-
const filename = path.basename(btFiles[i]);
|
|
101
|
-
const pathParts = btFiles[i].split('/');
|
|
102
|
-
const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
|
|
103
|
-
const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
|
|
104
|
-
if (filename === 'info') {
|
|
105
|
-
const infoFile = fs.readFileSync(btFiles[i], { encoding: 'utf8' }).split('\n');
|
|
106
|
-
result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// determine "connected" with hcitool con
|
|
110
|
-
try {
|
|
111
|
-
const hdicon = execSync('hcitool con').toString().toLowerCase();
|
|
112
|
-
for (let i = 0; i < result.length; i++) {
|
|
113
|
-
if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
|
|
114
|
-
result[i].connected = true;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
} catch (e) {
|
|
118
|
-
util.noop();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (callback) {
|
|
122
|
-
callback(result);
|
|
123
|
-
}
|
|
124
|
-
resolve(result);
|
|
125
|
-
}
|
|
126
|
-
if (_darwin) {
|
|
127
|
-
let cmd = 'system_profiler SPBluetoothDataType -json';
|
|
128
|
-
exec(cmd, function (error, stdout) {
|
|
129
|
-
if (!error) {
|
|
130
|
-
try {
|
|
131
|
-
const outObj = JSON.parse(stdout.toString());
|
|
132
|
-
if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
|
|
133
|
-
// missing: host BT Adapter macAddr ()
|
|
134
|
-
let macAddr2 = null;
|
|
135
|
-
if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) {
|
|
136
|
-
macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
for (let i = 0; i < outObj.SPBluetoothDataType[0]['device_title'].length; i++) {
|
|
140
|
-
const obj = outObj.SPBluetoothDataType[0]['device_title'][i];
|
|
141
|
-
const objKey = Object.keys(obj);
|
|
142
|
-
if (objKey && objKey.length === 1) {
|
|
143
|
-
const innerObject = obj[objKey[0]];
|
|
144
|
-
innerObject.device_name = objKey[0];
|
|
145
|
-
const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
|
|
146
|
-
result.push(bluetoothDevice);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
} catch (e) {
|
|
151
|
-
util.noop();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (callback) {
|
|
155
|
-
callback(result);
|
|
156
|
-
}
|
|
157
|
-
resolve(result);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
if (_windows) {
|
|
161
|
-
util.powerShell('Get-WmiObject Win32_PNPEntity | fl *').then((stdout, error) => {
|
|
162
|
-
if (!error) {
|
|
163
|
-
const parts = stdout.toString().split(/\n\s*\n/);
|
|
164
|
-
for (let i = 0; i < parts.length; i++) {
|
|
165
|
-
if (util.getValue(parts[i].split('\n'), 'PNPClass', ':') === 'Bluetooth') {
|
|
166
|
-
result.push(parseWindowsBluetooth(parts[i].split('\n')));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (callback) {
|
|
171
|
-
callback(result);
|
|
172
|
-
}
|
|
173
|
-
resolve(result);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
if (_freebsd || _netbsd || _openbsd || _sunos) {
|
|
177
|
-
resolve(null);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
exports.bluetoothDevices = bluetoothDevices;
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-check
|
|
3
|
+
// ==================================================================================
|
|
4
|
+
// audio.js
|
|
5
|
+
// ----------------------------------------------------------------------------------
|
|
6
|
+
// Description: System Information - library
|
|
7
|
+
// for Node.js
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
|
+
// Author: Sebastian Hildebrandt
|
|
10
|
+
// ----------------------------------------------------------------------------------
|
|
11
|
+
// License: MIT
|
|
12
|
+
// ==================================================================================
|
|
13
|
+
// 17. bluetooth
|
|
14
|
+
// ----------------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
const exec = require('child_process').exec;
|
|
17
|
+
const execSync = require('child_process').execSync;
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const util = require('./util');
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
let _platform = process.platform;
|
|
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');
|
|
31
|
+
|
|
32
|
+
function parseBluetoothType(str) {
|
|
33
|
+
let result = '';
|
|
34
|
+
|
|
35
|
+
if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
|
36
|
+
if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
|
|
37
|
+
if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
|
|
38
|
+
if (str.indexOf('headset') >= 0) { result = 'Headset'; }
|
|
39
|
+
if (str.indexOf('phone') >= 0) { result = 'Phone'; }
|
|
40
|
+
// to be continued ...
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) {
|
|
46
|
+
const result = {};
|
|
47
|
+
|
|
48
|
+
result.device = null;
|
|
49
|
+
result.name = util.getValue(lines, 'name', '=');
|
|
50
|
+
result.manufacturer = null;
|
|
51
|
+
result.macDevice = macAddr1;
|
|
52
|
+
result.macHost = macAddr2;
|
|
53
|
+
result.batteryPercent = null;
|
|
54
|
+
result.type = parseBluetoothType(result.name.toLowerCase());
|
|
55
|
+
result.connected = false;
|
|
56
|
+
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) {
|
|
61
|
+
const result = {};
|
|
62
|
+
const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || '') + (bluetoothObject.device_name || '')).toLowerCase();
|
|
63
|
+
|
|
64
|
+
result.device = bluetoothObject.device_services || '';
|
|
65
|
+
result.name = bluetoothObject.device_name || '';
|
|
66
|
+
result.manufacturer = bluetoothObject.device_manufacturer || '';
|
|
67
|
+
result.macDevice = (bluetoothObject.device_addr || '').toLowerCase().replace(/-/g, ':');
|
|
68
|
+
result.macHost = macAddr2;
|
|
69
|
+
result.batteryPercent = bluetoothObject.device_batteryPercent || null;
|
|
70
|
+
result.type = parseBluetoothType(typeStr);
|
|
71
|
+
result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false;
|
|
72
|
+
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function parseWindowsBluetooth(lines) {
|
|
77
|
+
const result = {};
|
|
78
|
+
|
|
79
|
+
result.device = null;
|
|
80
|
+
result.name = util.getValue(lines, 'name', ':');
|
|
81
|
+
result.manufacturer = util.getValue(lines, 'manufacturer', ':');
|
|
82
|
+
result.macDevice = null;
|
|
83
|
+
result.macHost = null;
|
|
84
|
+
result.batteryPercent = null;
|
|
85
|
+
result.type = parseBluetoothType(result.name.toLowerCase());
|
|
86
|
+
result.connected = null;
|
|
87
|
+
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function bluetoothDevices(callback) {
|
|
92
|
+
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
process.nextTick(() => {
|
|
95
|
+
let result = [];
|
|
96
|
+
if (_linux) {
|
|
97
|
+
// get files in /var/lib/bluetooth/ recursive
|
|
98
|
+
const btFiles = util.getFilesInPath('/var/lib/bluetooth/');
|
|
99
|
+
for (let i = 0; i < btFiles.length; i++) {
|
|
100
|
+
const filename = path.basename(btFiles[i]);
|
|
101
|
+
const pathParts = btFiles[i].split('/');
|
|
102
|
+
const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
|
|
103
|
+
const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
|
|
104
|
+
if (filename === 'info') {
|
|
105
|
+
const infoFile = fs.readFileSync(btFiles[i], { encoding: 'utf8' }).split('\n');
|
|
106
|
+
result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// determine "connected" with hcitool con
|
|
110
|
+
try {
|
|
111
|
+
const hdicon = execSync('hcitool con').toString().toLowerCase();
|
|
112
|
+
for (let i = 0; i < result.length; i++) {
|
|
113
|
+
if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
|
|
114
|
+
result[i].connected = true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
util.noop();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (callback) {
|
|
122
|
+
callback(result);
|
|
123
|
+
}
|
|
124
|
+
resolve(result);
|
|
125
|
+
}
|
|
126
|
+
if (_darwin) {
|
|
127
|
+
let cmd = 'system_profiler SPBluetoothDataType -json';
|
|
128
|
+
exec(cmd, function (error, stdout) {
|
|
129
|
+
if (!error) {
|
|
130
|
+
try {
|
|
131
|
+
const outObj = JSON.parse(stdout.toString());
|
|
132
|
+
if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
|
|
133
|
+
// missing: host BT Adapter macAddr ()
|
|
134
|
+
let macAddr2 = null;
|
|
135
|
+
if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) {
|
|
136
|
+
macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (let i = 0; i < outObj.SPBluetoothDataType[0]['device_title'].length; i++) {
|
|
140
|
+
const obj = outObj.SPBluetoothDataType[0]['device_title'][i];
|
|
141
|
+
const objKey = Object.keys(obj);
|
|
142
|
+
if (objKey && objKey.length === 1) {
|
|
143
|
+
const innerObject = obj[objKey[0]];
|
|
144
|
+
innerObject.device_name = objKey[0];
|
|
145
|
+
const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
|
|
146
|
+
result.push(bluetoothDevice);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
} catch (e) {
|
|
151
|
+
util.noop();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (callback) {
|
|
155
|
+
callback(result);
|
|
156
|
+
}
|
|
157
|
+
resolve(result);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (_windows) {
|
|
161
|
+
util.powerShell('Get-WmiObject Win32_PNPEntity | fl *').then((stdout, error) => {
|
|
162
|
+
if (!error) {
|
|
163
|
+
const parts = stdout.toString().split(/\n\s*\n/);
|
|
164
|
+
for (let i = 0; i < parts.length; i++) {
|
|
165
|
+
if (util.getValue(parts[i].split('\n'), 'PNPClass', ':') === 'Bluetooth') {
|
|
166
|
+
result.push(parseWindowsBluetooth(parts[i].split('\n')));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (callback) {
|
|
171
|
+
callback(result);
|
|
172
|
+
}
|
|
173
|
+
resolve(result);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (_freebsd || _netbsd || _openbsd || _sunos) {
|
|
177
|
+
resolve(null);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
exports.bluetoothDevices = bluetoothDevices;
|
package/lib/cli.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ----------------------------------------------------------------------------------
|
|
8
8
|
// Description: System Information - library
|
|
9
9
|
// for Node.js
|
|
10
|
-
// Copyright: (c) 2014 -
|
|
10
|
+
// Copyright: (c) 2014 - 2022
|
|
11
11
|
// Author: Sebastian Hildebrandt
|
|
12
12
|
// ----------------------------------------------------------------------------------
|
|
13
13
|
// License: MIT
|
|
@@ -21,7 +21,7 @@ const si = require('./index');
|
|
|
21
21
|
// ----------------------------------------------------------------------------------
|
|
22
22
|
// Main
|
|
23
23
|
// ----------------------------------------------------------------------------------
|
|
24
|
-
(function() {
|
|
24
|
+
(function () {
|
|
25
25
|
si.getStaticData().then(
|
|
26
26
|
(data => {
|
|
27
27
|
data.time = si.time();
|
package/lib/cpu.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -21,7 +21,7 @@ const util = require('./util');
|
|
|
21
21
|
|
|
22
22
|
let _platform = process.platform;
|
|
23
23
|
|
|
24
|
-
const _linux = (_platform === 'linux');
|
|
24
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
25
25
|
const _darwin = (_platform === 'darwin');
|
|
26
26
|
const _windows = (_platform === 'win32');
|
|
27
27
|
const _freebsd = (_platform === 'freebsd');
|
package/lib/docker.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
package/lib/dockerSocket.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
package/lib/filesystem.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -22,7 +22,7 @@ const execPromiseSave = util.promisifySave(require('child_process').exec);
|
|
|
22
22
|
|
|
23
23
|
let _platform = process.platform;
|
|
24
24
|
|
|
25
|
-
const _linux = (_platform === 'linux');
|
|
25
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
26
26
|
const _darwin = (_platform === 'darwin');
|
|
27
27
|
const _windows = (_platform === 'win32');
|
|
28
28
|
const _freebsd = (_platform === 'freebsd');
|
package/lib/graphics.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -21,7 +21,7 @@ const util = require('./util');
|
|
|
21
21
|
let _platform = process.platform;
|
|
22
22
|
let _nvidiaSmiPath = '';
|
|
23
23
|
|
|
24
|
-
const _linux = (_platform === 'linux');
|
|
24
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
25
25
|
const _darwin = (_platform === 'darwin');
|
|
26
26
|
const _windows = (_platform === 'win32');
|
|
27
27
|
const _freebsd = (_platform === 'freebsd');
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// Contributors: Guillaume Legrain (https://github.com/glegrain)
|
|
@@ -509,3 +509,5 @@ exports.getAllData = getAllData;
|
|
|
509
509
|
exports.get = get;
|
|
510
510
|
exports.observe = observe;
|
|
511
511
|
|
|
512
|
+
exports.powerShellStart = util.powerShellStart;
|
|
513
|
+
exports.powerShellRelease = util.powerShellRelease;
|
package/lib/internet.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -18,7 +18,7 @@ const util = require('./util');
|
|
|
18
18
|
|
|
19
19
|
let _platform = process.platform;
|
|
20
20
|
|
|
21
|
-
const _linux = (_platform === 'linux');
|
|
21
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
22
22
|
const _darwin = (_platform === 'darwin');
|
|
23
23
|
const _windows = (_platform === 'win32');
|
|
24
24
|
const _freebsd = (_platform === 'freebsd');
|
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 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -21,7 +21,7 @@ const fs = require('fs');
|
|
|
21
21
|
|
|
22
22
|
let _platform = process.platform;
|
|
23
23
|
|
|
24
|
-
const _linux = (_platform === 'linux');
|
|
24
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
25
25
|
const _darwin = (_platform === 'darwin');
|
|
26
26
|
const _windows = (_platform === 'win32');
|
|
27
27
|
const _freebsd = (_platform === 'freebsd');
|
|
@@ -226,11 +226,18 @@ function mem(callback) {
|
|
|
226
226
|
resolve(result);
|
|
227
227
|
}
|
|
228
228
|
if (_darwin) {
|
|
229
|
+
let pageSize = 4096;
|
|
230
|
+
try {
|
|
231
|
+
let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString());
|
|
232
|
+
pageSize = sysPpageSize || pageSize;
|
|
233
|
+
} catch (e) {
|
|
234
|
+
util.noop();
|
|
235
|
+
}
|
|
229
236
|
exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) {
|
|
230
237
|
if (!error) {
|
|
231
238
|
let lines = stdout.toString().split('\n');
|
|
232
239
|
|
|
233
|
-
result.active = parseInt(lines[0].split(':')[1], 10) *
|
|
240
|
+
result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
|
|
234
241
|
result.buffcache = result.used - result.active;
|
|
235
242
|
result.available = result.free + result.buffcache;
|
|
236
243
|
}
|
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 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -21,7 +21,7 @@ const util = require('./util');
|
|
|
21
21
|
|
|
22
22
|
let _platform = process.platform;
|
|
23
23
|
|
|
24
|
-
const _linux = (_platform === 'linux');
|
|
24
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
25
25
|
const _darwin = (_platform === 'darwin');
|
|
26
26
|
const _windows = (_platform === 'win32');
|
|
27
27
|
const _freebsd = (_platform === 'freebsd');
|
package/lib/osinfo.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2022
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -22,7 +22,7 @@ const execSync = require('child_process').execSync;
|
|
|
22
22
|
|
|
23
23
|
let _platform = process.platform;
|
|
24
24
|
|
|
25
|
-
const _linux = (_platform === 'linux');
|
|
25
|
+
const _linux = (_platform === 'linux' || _platform === 'android');
|
|
26
26
|
const _darwin = (_platform === 'darwin');
|
|
27
27
|
const _windows = (_platform === 'win32');
|
|
28
28
|
const _freebsd = (_platform === 'freebsd');
|