diff --git a/CHANGELOG.md b/CHANGELOG.md index 874f99e..d27b320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.10.2 | 2016-11-14 | bug fix fsSize on OSX | | 3.10.1 | 2016-11-14 | optimization fsStats, disksIO, networkStats | | 3.10.0 | 2016-11-12 | added blockDevices, fixed fsSize, added file system type | | 3.9.0 | 2016-11-11 | added MAC address to networkInterfaces, fixed currentLoad | diff --git a/lib/filesystem.js b/lib/filesystem.js index 49551b5..789539f 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -40,7 +40,8 @@ function fsSize(callback) { reject(error); } - exec("df -lkPT | grep ^/", function (error, stdout) { + let cmd = (_darwin ? "df -lkP | grep ^/" : "df -lkPT | grep ^/"); + exec(cmd, function (error, stdout) { let data = []; if (!error) { let lines = stdout.toString().split('\n'); @@ -50,10 +51,10 @@ function fsSize(callback) { line = line.replace(/ +/g, " ").split(' '); data.push({ 'fs': line[0], - 'type': line[1], - 'size': parseInt(line[2]) * 1024, - 'used': parseInt(line[3]) * 1024, - 'use': parseFloat((100.0 * line[3] / line[2]).toFixed(2)), + 'type': (_linux ? line[1] : 'HFS'), + 'size': parseInt((_linux ? line[2] : line[1])) * 1024, + 'used': parseInt((_linux ? line[3] : line[2])) * 1024, + 'use': parseFloat((100.0 * (_linux ? line[3] : line[2]) / (_linux ? line[2] : line[1])).toFixed(2)), 'mount': line[line.length - 1] }) } diff --git a/lib/index.js b/lib/index.js index 1b27d6c..8faa714 100644 --- a/lib/index.js +++ b/lib/index.js @@ -81,6 +81,7 @@ // -------------------------------- // // version date comment +// 3.10.2 2016-11-14 bug fix fsSize on OSX // 3.10.1 2016-11-14 optimization fsStats, disksIO, networkStats // 3.10.0 2016-11-12 added blockDevices, fixed fsSize, added file system type // 3.9.0 2016-11-11 added MAC address to networkInterfaces, fixed currentLoad