systeminformation 5.18.11 → 5.18.13
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/filesystem.js +4 -1
- package/lib/memory.js +83 -68
- package/lib/osinfo.js +2 -1
- package/lib/system.js +3 -2
- package/package.json +1 -1
package/lib/filesystem.js
CHANGED
|
@@ -142,7 +142,10 @@ function fsSize(drive, callback) {
|
|
|
142
142
|
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
|
143
143
|
return line.startsWith('/');
|
|
144
144
|
}).forEach((line) => {
|
|
145
|
-
osMounts[line.split(' ')[0]] = line.
|
|
145
|
+
osMounts[line.split(' ')[0]] = osMounts[line.split(' ')[0]] ?? false;
|
|
146
|
+
if (line.toLowerCase().indexOf('/snap/') === -1) {
|
|
147
|
+
osMounts[line.split(' ')[0]] = ((line.toLowerCase().indexOf('rw,') >= 0 || line.toLowerCase().indexOf(' rw ') >= 0));
|
|
148
|
+
}
|
|
146
149
|
});
|
|
147
150
|
} catch (e) {
|
|
148
151
|
util.noop();
|
package/lib/memory.js
CHANGED
|
@@ -166,60 +166,70 @@ function mem(callback) {
|
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
if (_linux) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
169
|
+
try {
|
|
170
|
+
fs.readFile('/proc/meminfo', function (error, stdout) {
|
|
171
|
+
if (!error) {
|
|
172
|
+
const lines = stdout.toString().split('\n');
|
|
173
|
+
result.total = parseInt(util.getValue(lines, 'memtotal'), 10);
|
|
174
|
+
result.total = result.total ? result.total * 1024 : os.totalmem();
|
|
175
|
+
result.free = parseInt(util.getValue(lines, 'memfree'), 10);
|
|
176
|
+
result.free = result.free ? result.free * 1024 : os.freemem();
|
|
177
|
+
result.used = result.total - result.free;
|
|
178
|
+
|
|
179
|
+
result.buffers = parseInt(util.getValue(lines, 'buffers'), 10);
|
|
180
|
+
result.buffers = result.buffers ? result.buffers * 1024 : 0;
|
|
181
|
+
result.cached = parseInt(util.getValue(lines, 'cached'), 10);
|
|
182
|
+
result.cached = result.cached ? result.cached * 1024 : 0;
|
|
183
|
+
result.slab = parseInt(util.getValue(lines, 'slab'), 10);
|
|
184
|
+
result.slab = result.slab ? result.slab * 1024 : 0;
|
|
185
|
+
result.buffcache = result.buffers + result.cached + result.slab;
|
|
186
|
+
|
|
187
|
+
let available = parseInt(util.getValue(lines, 'memavailable'), 10);
|
|
188
|
+
result.available = available ? available * 1024 : result.free + result.buffcache;
|
|
189
|
+
result.active = result.total - result.available;
|
|
190
|
+
|
|
191
|
+
result.swaptotal = parseInt(util.getValue(lines, 'swaptotal'), 10);
|
|
192
|
+
result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0;
|
|
193
|
+
result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10);
|
|
194
|
+
result.swapfree = result.swapfree ? result.swapfree * 1024 : 0;
|
|
195
|
+
result.swapused = result.swaptotal - result.swapfree;
|
|
196
|
+
}
|
|
197
|
+
if (callback) { callback(result); }
|
|
198
|
+
resolve(result);
|
|
199
|
+
});
|
|
200
|
+
} catch (e) {
|
|
196
201
|
if (callback) { callback(result); }
|
|
197
202
|
resolve(result);
|
|
198
|
-
}
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
if (_freebsd || _openbsd || _netbsd) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
|
|
209
|
-
if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
|
|
210
|
-
result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
|
|
211
|
-
result.buffcache = inactive + cache;
|
|
212
|
-
result.available = result.buffcache + result.free;
|
|
213
|
-
result.active = result.total - result.free - result.buffcache;
|
|
214
|
-
|
|
215
|
-
result.swaptotal = 0;
|
|
216
|
-
result.swapfree = 0;
|
|
217
|
-
result.swapused = 0;
|
|
206
|
+
try {
|
|
207
|
+
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) {
|
|
208
|
+
if (!error) {
|
|
209
|
+
let lines = stdout.toString().split('\n');
|
|
210
|
+
const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
|
|
211
|
+
const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
|
|
212
|
+
const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
|
|
218
213
|
|
|
219
|
-
|
|
214
|
+
result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
|
|
215
|
+
if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
|
|
216
|
+
result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
|
|
217
|
+
result.buffcache = inactive + cache;
|
|
218
|
+
result.available = result.buffcache + result.free;
|
|
219
|
+
result.active = result.total - result.free - result.buffcache;
|
|
220
|
+
|
|
221
|
+
result.swaptotal = 0;
|
|
222
|
+
result.swapfree = 0;
|
|
223
|
+
result.swapused = 0;
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
if (callback) { callback(result); }
|
|
227
|
+
resolve(result);
|
|
228
|
+
});
|
|
229
|
+
} catch (e) {
|
|
220
230
|
if (callback) { callback(result); }
|
|
221
231
|
resolve(result);
|
|
222
|
-
}
|
|
232
|
+
}
|
|
223
233
|
}
|
|
224
234
|
if (_sunos) {
|
|
225
235
|
if (callback) { callback(result); }
|
|
@@ -233,31 +243,36 @@ function mem(callback) {
|
|
|
233
243
|
} catch (e) {
|
|
234
244
|
util.noop();
|
|
235
245
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
let lines = stdout.toString().split('\n');
|
|
239
|
-
|
|
240
|
-
result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
|
|
241
|
-
result.buffcache = result.used - result.active;
|
|
242
|
-
result.available = result.free + result.buffcache;
|
|
243
|
-
}
|
|
244
|
-
exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) {
|
|
246
|
+
try {
|
|
247
|
+
exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) {
|
|
245
248
|
if (!error) {
|
|
246
249
|
let lines = stdout.toString().split('\n');
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
252
|
-
if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
253
|
-
if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
254
|
-
});
|
|
255
|
-
}
|
|
250
|
+
|
|
251
|
+
result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
|
|
252
|
+
result.buffcache = result.used - result.active;
|
|
253
|
+
result.available = result.free + result.buffcache;
|
|
256
254
|
}
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) {
|
|
256
|
+
if (!error) {
|
|
257
|
+
let lines = stdout.toString().split('\n');
|
|
258
|
+
if (lines.length > 0) {
|
|
259
|
+
let firstline = lines[0].replace(/,/g, '.').replace(/M/g, '');
|
|
260
|
+
let lineArray = firstline.trim().split(' ');
|
|
261
|
+
lineArray.forEach(line => {
|
|
262
|
+
if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
263
|
+
if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
264
|
+
if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (callback) { callback(result); }
|
|
269
|
+
resolve(result);
|
|
270
|
+
});
|
|
259
271
|
});
|
|
260
|
-
})
|
|
272
|
+
} catch (e) {
|
|
273
|
+
if (callback) { callback(result); }
|
|
274
|
+
resolve(result);
|
|
275
|
+
}
|
|
261
276
|
}
|
|
262
277
|
if (_windows) {
|
|
263
278
|
let swaptotal = 0;
|
package/lib/osinfo.js
CHANGED
|
@@ -180,7 +180,8 @@ function getFQDN() {
|
|
|
180
180
|
util.noop();
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
}
|
|
183
|
+
}
|
|
184
|
+
if (_freebsd || _openbsd || _netbsd) {
|
|
184
185
|
try {
|
|
185
186
|
const stdout = execSync('hostname 2>/dev/null');
|
|
186
187
|
fqdn = stdout.toString().split(os.EOL)[0];
|
package/lib/system.js
CHANGED
|
@@ -399,10 +399,11 @@ function bios(callback) {
|
|
|
399
399
|
}
|
|
400
400
|
if (_windows) {
|
|
401
401
|
try {
|
|
402
|
-
util.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber | fl').then((stdout, error) => {
|
|
402
|
+
util.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber,SMBIOSBIOSVersion | fl').then((stdout, error) => {
|
|
403
403
|
if (!error) {
|
|
404
404
|
let lines = stdout.toString().split('\r\n');
|
|
405
405
|
const description = util.getValue(lines, 'description', ':');
|
|
406
|
+
const version = util.getValue(lines, 'SMBIOSBIOSVersion', ':');
|
|
406
407
|
if (description.indexOf(' Version ') !== -1) {
|
|
407
408
|
// ... Phoenix ROM BIOS PLUS Version 1.10 A04
|
|
408
409
|
result.vendor = description.split(' Version ')[0].trim();
|
|
@@ -413,7 +414,7 @@ function bios(callback) {
|
|
|
413
414
|
result.version = description.split(' Ver: ')[1].trim();
|
|
414
415
|
} else {
|
|
415
416
|
result.vendor = util.getValue(lines, 'manufacturer', ':');
|
|
416
|
-
result.version = util.getValue(lines, 'version', ':');
|
|
417
|
+
result.version = version || util.getValue(lines, 'version', ':');
|
|
417
418
|
}
|
|
418
419
|
result.releaseDate = util.getValue(lines, 'releasedate', ':');
|
|
419
420
|
result.revision = util.getValue(lines, 'buildnumber', ':');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.13",
|
|
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)",
|