From bbd1ce332d1d181991f7d6c6a285baafd6bf7a0c Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 2 Feb 2021 21:13:27 +0100 Subject: [PATCH] fsSize() fixed parsing edge case issue mac OS --- README.md | 4 ++-- docs/gettingstarted.html | 16 +++++++--------- docs/index.html | 4 ++-- lib/filesystem.js | 4 +++- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3305471..af4c769 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Lightweight collection of 50+ functions to retrieve detailed hardware, system an - simple to use - get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes - supports Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support -- no npm dependencies (for production) +- no npm dependencies **Attention**: this is a `node.js` library. It is supposed to be used as a backend/server-side library and will definitely not work within a browser. @@ -116,7 +116,7 @@ You can find all changes here: [detailed changelog][changelog-url] [Node.js][nodejs-url] comes with some basic OS information, but I always wanted a little more. So I came up to write this little library. This library is still work in progress. It is supposed to be used as a backend/server-side library (will definitely not work within a browser). It requires node.js version 4.0 and above. -I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details. +I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave, Catalina, Big Sur) and some Windows 7, Windows 8, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details. If you have comments, suggestions & reports, please feel free to contact me! diff --git a/docs/gettingstarted.html b/docs/gettingstarted.html index 4d04809..8dde2ce 100644 --- a/docs/gettingstarted.html +++ b/docs/gettingstarted.html @@ -52,20 +52,20 @@
  • simple to use
  • get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes
  • supports Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support
  • -
  • no npm dependencies (for production)
  • +
  • no npm dependencies
  • Core Concept

    Node.js comes with some basic OS information, but I always wanted a little more. So I came up to write this little library. This library is still work in progress. It requires node.js version 4.0 and above.

    -

    I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. +

    I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave, Catalina, Big Sur) and some Windows 7, Windows 8, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.

    If you have comments, suggestions & reports, please feel free to contact me on github!

    I also created a nice little command line tool called mmon (micro-monitor) for Linux and macOS, also available via github and npm

    Attention:

    -

    This library is supposed to be used as a node.js backend/server-side library and will definilely not work within a browser.

    +

    This library is supposed to be used as a node.js backend/server-side library and will definitely not work within a browser.

    Installation

    $ npm install systeminformation --save
    @@ -80,7 +80,7 @@ si.cpu()

    Callback, Promises, Async Await

    Remember: all functions (except version and time) are implemented as asynchronous functions! There are now three ways to consume them:

    -

    Callback Style

    +

    Callback Style

    const si = require('systeminformation');
     
     si.cpu(function(data) {
    @@ -92,9 +92,7 @@ si.cpu(function(data) {
         console.log('- physical cores: ' + data.physicalCores);
         console.log('...');
     })

    -

    Promise Style

    -

    Promises style is new since version 3.0. -

    +

    Promise Style

    When omitting callback parameter (cb), then you can use all function in a promise oriented way. All functions (exept of version and time) are returning a promise, that you can consume:

    const si = require('systeminformation');
    @@ -110,7 +108,7 @@ si.cpu()
             console.log('...');
         })
         .catch(error => console.error(error));

    -

    Async/Await Style

    +

    Async/Await Style

    Since node v7.6 you can also use the async / await pattern. The above example would then look like this:

    const si = require('systeminformation');
     
    @@ -129,7 +127,7 @@ async function cpuData() {
         }
     }

    Issues

    -

    If you discover some empty or incorrect values, please be sure to first have a look at the Known issues section.

    +

    If you discover some empty or incorrect values, please be sure to first have a look at the Known Issues section.

    diff --git a/docs/index.html b/docs/index.html index 5e6471f..9f98305 100644 --- a/docs/index.html +++ b/docs/index.html @@ -209,7 +209,7 @@
    Downloads last month
    -
    377
    +
    380
    Dependents
    @@ -396,4 +396,4 @@ - + \ No newline at end of file diff --git a/lib/filesystem.js b/lib/filesystem.js index a833ced..676dc81 100755 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -59,7 +59,9 @@ function fsSize(callback) { const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024; const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024; const use = parseFloat((100.0 * (used / (used + available))).toFixed(2)); - const mount = line[line.length - 1]; + line.splice(0, (_linux || _freebsd || _openbsd || _netbsd) ? 6 : 5); + const mount = line.join(' '); + // const mount = line[line.length - 1]; if (!data.find(el => (el.fs === fs && el.type === fsType))) { data.push({ fs,