From 199a887c6ebd0d443d1e10750c28cfdd713e6500 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 13 Jun 2022 22:45:53 +0200 Subject: [PATCH] diskLayout() optimized parsing linux (JSON) --- CHANGELOG.md | 1 + docs/history.html | 7 ++++++- docs/index.html | 4 ++-- lib/filesystem.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abcefd4..9a271c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 5.11.19 | 2022-06-13 | `diskLayout()` optimized parsing linux (JSON) | | 5.11.18 | 2022-06-13 | `diskLayout()` fix parsing linux (JSON) | | 5.11.17 | 2022-06-13 | `diskLayout()` fix parsing linux (JSON) | | 5.11.16 | 2022-05-30 | `docs` updated, `tests` added node 18 | diff --git a/docs/history.html b/docs/history.html index 6945a9d..a4df672 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.11.19 + 2022-06-13 + diskLayout() optimized parsing linux (JSON) + 5.11.18 2022-06-13 @@ -2684,4 +2689,4 @@ - + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7de609f..ef21a18 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.11.18
+
New Version: 5.11.19
@@ -403,4 +403,4 @@ - + \ No newline at end of file diff --git a/lib/filesystem.js b/lib/filesystem.js index dd478c7..6675361 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -852,7 +852,7 @@ function diskLayout(callback) { try { const outJSON = JSON.parse(out); if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) { - devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fsType === null && item.parttype === null && item.name.indexOf('ram') !== 0)); }); + devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fsType === null && item.parttype === null && item.path && item.path.indexOf('/ram') !== 0 && item.path.indexOf('/loop') !== 0 && item['disc-max'] && item['disc-max'] !== 0)); }); } } catch (e) { // fallback to older version of lsblk