fsSize() correct fs type detection macOS (HFS, APFS, NFS)
This commit is contained in:
parent
eb724e6b29
commit
657e159cca
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 4.29.0 | 2020-11-08 | `fsSize()` correct fs type detection macOS (HFS, APFS, NFS) |
|
||||||
| 4.28.1 | 2020-11-05 | code cleanup, removing debug console.log() |
|
| 4.28.1 | 2020-11-05 | code cleanup, removing debug console.log() |
|
||||||
| 4.28.0 | 2020-11-04 | `graphics()` added deviceName (windows) |
|
| 4.28.0 | 2020-11-04 | `graphics()` added deviceName (windows) |
|
||||||
| 4.27.11 | 2020-10-26 | `inetChecksite()` fixed vulnerability: command injection |
|
| 4.27.11 | 2020-10-26 | `inetChecksite()` fixed vulnerability: command injection |
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
[![Sponsoring][sponsor-badge]][sponsor-url]
|
[![Sponsoring][sponsor-badge]][sponsor-url]
|
||||||
[![MIT license][license-img]][license-url]
|
[![MIT license][license-img]][license-url]
|
||||||
|
|
||||||
This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, up to 2 mio downloads per month, > 18 mio downloads overall. Thank you to all who contributed to this project!
|
This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, up to 2 mio downloads per month, > 20 mio downloads overall. Thank you to all who contributed to this project!
|
||||||
|
|
||||||
## New Version 4.0
|
## New Version 4.0
|
||||||
|
|
||||||
@ -87,13 +87,13 @@ si.cpu()
|
|||||||
|
|
||||||
(last 7 major and minor version releases)
|
(last 7 major and minor version releases)
|
||||||
|
|
||||||
|
- Version 4.29.0: `fsSize()` correct fs type detection macOS (HFS, APFS, NFS)
|
||||||
- Version 4.28.0: `graphics()` added deviceName (Windows)
|
- Version 4.28.0: `graphics()` added deviceName (Windows)
|
||||||
- Version 4.27.0: `observe()` added observe / watch function
|
- Version 4.27.0: `observe()` added observe / watch function
|
||||||
- Version 4.26.0: `diskLayout()` added full S.M.A.R.T data (Linux)
|
- Version 4.26.0: `diskLayout()` added full S.M.A.R.T data (Linux)
|
||||||
- Version 4.25.0: `get()` added function to get partial system info
|
- Version 4.25.0: `get()` added function to get partial system info
|
||||||
- Version 4.24.0: `networkInterfaces()` added subnet mask ip4 and ip6
|
- Version 4.24.0: `networkInterfaces()` added subnet mask ip4 and ip6
|
||||||
- Version 4.23.0: `versions()` added param to specify which program/lib versions to detect
|
- Version 4.23.0: `versions()` added param to specify which program/lib versions to detect
|
||||||
- Version 4.22.0: `services()` added pids (windows)
|
|
||||||
- ...
|
- ...
|
||||||
|
|
||||||
You can find all changes here: [detailed changelog][changelog-url]
|
You can find all changes here: [detailed changelog][changelog-url]
|
||||||
|
|||||||
@ -83,6 +83,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">4.29.0</th>
|
||||||
|
<td>2020-11-08</td>
|
||||||
|
<td><span class="code">fsSize()</span> correct fs type detection macOS (HFS, APFS, NFS)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">4.28.1</th>
|
<th scope="row">4.28.1</th>
|
||||||
<td>2020-11-05</td>
|
<td>2020-11-05</td>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></div>
|
<div class="subtitle"><span id="typed"></span></div>
|
||||||
<div class="version">Current Version: <span id="version">4.28.1</span></div>
|
<div class="version">Current Version: <span id="version">4.29.0</span></div>
|
||||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
@ -207,7 +207,7 @@
|
|||||||
<div class="title">Downloads last month</div>
|
<div class="title">Downloads last month</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||||
<div class="numbers">356</div>
|
<div class="numbers">359</div>
|
||||||
<div class="title">Dependends</div>
|
<div class="title">Dependends</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -38,6 +38,17 @@ let _disk_io = {};
|
|||||||
|
|
||||||
function fsSize(callback) {
|
function fsSize(callback) {
|
||||||
|
|
||||||
|
let macOsDisks = [];
|
||||||
|
|
||||||
|
function getmacOsFsType(fs) {
|
||||||
|
if (!fs.startsWith('/')) { return 'NFS' };
|
||||||
|
const parts = fs.split('/');
|
||||||
|
const fsShort = parts[parts.length - 1];
|
||||||
|
const macOsDisksSingle = macOsDisks.filter(item => item.indexOf(fsShort) >= 0)
|
||||||
|
if (macOsDisksSingle.length === 1 && macOsDisksSingle[0].indexOf('APFS') >= 0) { return 'APFS' }
|
||||||
|
return 'HFS';
|
||||||
|
}
|
||||||
|
|
||||||
function parseDf(lines) {
|
function parseDf(lines) {
|
||||||
let data = [];
|
let data = [];
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
@ -45,7 +56,7 @@ function fsSize(callback) {
|
|||||||
line = line.replace(/ +/g, ' ').split(' ');
|
line = line.replace(/ +/g, ' ').split(' ');
|
||||||
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0))) {
|
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0))) {
|
||||||
const fs = line[0];
|
const fs = line[0];
|
||||||
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : (line[0].startsWith('/')) ? 'HFS' : 'NFS');
|
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
|
||||||
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
||||||
const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
|
const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
|
||||||
const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2));
|
const use = parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2));
|
||||||
@ -71,7 +82,12 @@ function fsSize(callback) {
|
|||||||
let data = [];
|
let data = [];
|
||||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||||
let cmd = '';
|
let cmd = '';
|
||||||
if (_darwin) cmd = 'df -kP';
|
if (_darwin) {
|
||||||
|
cmd = 'df -kP';
|
||||||
|
macOsDisks = execSync('diskutil list').toString().split('\n').filter(line => {
|
||||||
|
return !line.startsWith('/') && line.indexOf(':') > 0
|
||||||
|
});
|
||||||
|
}
|
||||||
if (_linux) cmd = 'df -lkPTx squashfs | grep ^/';
|
if (_linux) cmd = 'df -lkPTx squashfs | grep ^/';
|
||||||
if (_freebsd || _openbsd || _netbsd) cmd = 'df -lkPT';
|
if (_freebsd || _openbsd || _netbsd) cmd = 'df -lkPT';
|
||||||
exec(cmd, function (error, stdout) {
|
exec(cmd, function (error, stdout) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user