summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-21 16:18:36 +0200
committerRaindropsSys <contact@minteck.org>2023-06-21 16:18:36 +0200
commitc67e72c95d5fb6afef6b0b72800ea3eae4310fa1 (patch)
tree7c0a0f3209e6663fc9166004c6f55666da890156
parentb0d3eeb6edc4f7caf4b372cd176cd657c25d0846 (diff)
downloadkirinos-c67e72c95d5fb6afef6b0b72800ea3eae4310fa1.tar.gz
kirinos-c67e72c95d5fb6afef6b0b72800ea3eae4310fa1.tar.bz2
kirinos-c67e72c95d5fb6afef6b0b72800ea3eae4310fa1.zip
Updated 9 files and added 281 files (automated)
-rw-r--r--ROADMAP.md6
-rw-r--r--core/desktop/index.html7
-rw-r--r--core/status/icons/battery-0-charging.svg9
-rw-r--r--core/status/icons/battery-0.svg1
-rw-r--r--core/status/icons/battery-1-charging.svg9
-rw-r--r--core/status/icons/battery-1.svg1
-rw-r--r--core/status/icons/battery-2-charging.svg9
-rw-r--r--core/status/icons/battery-2.svg1
-rw-r--r--core/status/icons/battery-3-charging.svg9
-rw-r--r--core/status/icons/battery-3.svg1
-rw-r--r--core/status/icons/battery-4-charging.svg9
-rw-r--r--core/status/icons/battery-4.svg1
-rw-r--r--core/status/icons/battery-5-charging.svg9
-rw-r--r--core/status/icons/battery-5.svg1
-rw-r--r--core/status/icons/battery-6-charging.svg9
-rw-r--r--core/status/icons/battery-6.svg1
-rw-r--r--core/status/icons/battery-7-charging.svg8
-rw-r--r--core/status/icons/battery-7.svg1
-rw-r--r--core/status/icons/battery-8-charging.svg7
-rw-r--r--core/status/icons/battery-8.svg1
-rw-r--r--core/status/icons/battery-error.svg1
-rw-r--r--core/status/icons/network-ethernet.svg1
-rw-r--r--core/status/icons/network-none.svg1
-rw-r--r--core/status/icons/network-wifi-0.svg1
-rw-r--r--core/status/icons/network-wifi-1.svg1
-rw-r--r--core/status/icons/network-wifi-2.svg1
-rw-r--r--core/status/icons/network-wifi-3.svg1
-rw-r--r--core/status/icons/network-wifi-4.svg1
-rw-r--r--core/status/icons/network-wifi-offline.svg1
-rw-r--r--core/status/icons/volume-0.svg1
-rw-r--r--core/status/icons/volume-1.svg1
-rw-r--r--core/status/icons/volume-2.svg1
-rw-r--r--core/status/icons/volume-3.svg1
-rw-r--r--core/status/icons/volume-none.svg1
-rw-r--r--core/status/index.html137
-rw-r--r--init.sh1
-rw-r--r--logo-symbolic.svg9
-rw-r--r--main.js63
l---------node_modules/.bin/systeminformation1
l---------node_modules/.bin/wifi1
-rw-r--r--node_modules/.package-lock.json246
-rw-r--r--node_modules/ansi-styles/index.js165
-rw-r--r--node_modules/ansi-styles/license9
-rw-r--r--node_modules/ansi-styles/package.json56
-rw-r--r--node_modules/ansi-styles/readme.md147
-rw-r--r--node_modules/array-back/LICENSE21
-rw-r--r--node_modules/array-back/README.hbs40
-rw-r--r--node_modules/array-back/README.md81
-rw-r--r--node_modules/array-back/dist/index.js70
-rw-r--r--node_modules/array-back/index.mjs62
-rw-r--r--node_modules/array-back/package.json46
-rw-r--r--node_modules/chalk/index.js228
-rw-r--r--node_modules/chalk/index.js.flow93
-rw-r--r--node_modules/chalk/license9
-rw-r--r--node_modules/chalk/node_modules/escape-string-regexp/index.js11
-rw-r--r--node_modules/chalk/node_modules/escape-string-regexp/license21
-rw-r--r--node_modules/chalk/node_modules/escape-string-regexp/package.json41
-rw-r--r--node_modules/chalk/node_modules/escape-string-regexp/readme.md27
-rw-r--r--node_modules/chalk/package.json71
-rw-r--r--node_modules/chalk/readme.md314
-rw-r--r--node_modules/chalk/templates.js128
-rw-r--r--node_modules/chalk/types/index.d.ts97
-rw-r--r--node_modules/color-convert/CHANGELOG.md54
-rw-r--r--node_modules/color-convert/LICENSE21
-rw-r--r--node_modules/color-convert/README.md68
-rw-r--r--node_modules/color-convert/conversions.js868
-rw-r--r--node_modules/color-convert/index.js78
-rw-r--r--node_modules/color-convert/package.json46
-rw-r--r--node_modules/color-convert/route.js97
-rw-r--r--node_modules/color-name/.eslintrc.json43
-rw-r--r--node_modules/color-name/.npmignore107
-rw-r--r--node_modules/color-name/LICENSE8
-rw-r--r--node_modules/color-name/README.md11
-rw-r--r--node_modules/color-name/index.js152
-rw-r--r--node_modules/color-name/package.json25
-rw-r--r--node_modules/color-name/test.js7
-rw-r--r--node_modules/command-line-args/LICENSE21
-rw-r--r--node_modules/command-line-args/README.md105
-rw-r--r--node_modules/command-line-args/dist/index.js1399
-rw-r--r--node_modules/command-line-args/dist/index.mjs1395
-rw-r--r--node_modules/command-line-args/index.mjs86
-rw-r--r--node_modules/command-line-args/lib/argv-parser.mjs139
-rw-r--r--node_modules/command-line-args/lib/argv-tools.mjs173
-rw-r--r--node_modules/command-line-args/lib/option-definition.mjs265
-rw-r--r--node_modules/command-line-args/lib/option-definitions.mjs187
-rw-r--r--node_modules/command-line-args/lib/option-flag.mjs13
-rw-r--r--node_modules/command-line-args/lib/option.mjs92
-rw-r--r--node_modules/command-line-args/lib/output-grouped.mjs40
-rw-r--r--node_modules/command-line-args/lib/output.mjs38
-rw-r--r--node_modules/command-line-args/package.json58
-rw-r--r--node_modules/command-line-usage/LICENSE21
-rw-r--r--node_modules/command-line-usage/README.md120
-rw-r--r--node_modules/command-line-usage/index.js30
-rw-r--r--node_modules/command-line-usage/lib/chalk-format.js11
-rw-r--r--node_modules/command-line-usage/lib/section.js29
-rw-r--r--node_modules/command-line-usage/lib/section/content.js154
-rw-r--r--node_modules/command-line-usage/lib/section/option-list.js128
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/LICENSE21
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/README.hbs40
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/README.md81
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/dist/index.js70
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/index.mjs62
-rw-r--r--node_modules/command-line-usage/node_modules/array-back/package.json46
-rw-r--r--node_modules/command-line-usage/node_modules/typical/LICENSE22
-rw-r--r--node_modules/command-line-usage/node_modules/typical/README.hbs40
-rw-r--r--node_modules/command-line-usage/node_modules/typical/README.md302
-rw-r--r--node_modules/command-line-usage/node_modules/typical/dist/index.js295
-rw-r--r--node_modules/command-line-usage/node_modules/typical/index.mjs269
-rw-r--r--node_modules/command-line-usage/node_modules/typical/package.json63
-rw-r--r--node_modules/command-line-usage/package.json41
-rw-r--r--node_modules/deep-extend/CHANGELOG.md46
-rw-r--r--node_modules/deep-extend/LICENSE20
-rw-r--r--node_modules/deep-extend/README.md91
-rw-r--r--node_modules/deep-extend/index.js1
-rw-r--r--node_modules/deep-extend/lib/deep-extend.js150
-rw-r--r--node_modules/deep-extend/package.json62
-rw-r--r--node_modules/find-replace/LICENSE21
-rw-r--r--node_modules/find-replace/README.hbs11
-rw-r--r--node_modules/find-replace/README.md43
-rw-r--r--node_modules/find-replace/dist/index.js124
-rw-r--r--node_modules/find-replace/dist/index.mjs116
-rw-r--r--node_modules/find-replace/index.mjs62
-rw-r--r--node_modules/find-replace/package.json36
-rw-r--r--node_modules/has-flag/index.js8
-rw-r--r--node_modules/has-flag/license9
-rw-r--r--node_modules/has-flag/package.json44
-rw-r--r--node_modules/has-flag/readme.md70
-rw-r--r--node_modules/lodash.camelcase/LICENSE47
-rw-r--r--node_modules/lodash.camelcase/README.md18
-rw-r--r--node_modules/lodash.camelcase/index.js599
-rw-r--r--node_modules/lodash.camelcase/package.json17
-rw-r--r--node_modules/node-wifi/.eslintrc.json7
-rw-r--r--node_modules/node-wifi/.prettierignore1
-rw-r--r--node_modules/node-wifi/.prettierrc.json7
-rw-r--r--node_modules/node-wifi/CHANGELOG.md145
-rw-r--r--node_modules/node-wifi/CONTRIBUTING.md99
-rw-r--r--node_modules/node-wifi/LICENSE21
-rw-r--r--node_modules/node-wifi/README.md196
-rw-r--r--node_modules/node-wifi/bin/help.js78
-rwxr-xr-xnode_modules/node-wifi/bin/wifi.js128
-rw-r--r--node_modules/node-wifi/package.json57
-rw-r--r--node_modules/node-wifi/src/__test__/unlogger.js12
-rw-r--r--node_modules/node-wifi/src/env.js5
-rw-r--r--node_modules/node-wifi/src/index.js52
-rw-r--r--node_modules/node-wifi/src/linux-connect.js45
-rw-r--r--node_modules/node-wifi/src/linux-current-connections.js75
-rw-r--r--node_modules/node-wifi/src/linux-delete.js33
-rw-r--r--node_modules/node-wifi/src/linux-disconnect.js34
-rw-r--r--node_modules/node-wifi/src/linux-scan.js9
-rw-r--r--node_modules/node-wifi/src/linux/__logs__/scan-01.log16
-rw-r--r--node_modules/node-wifi/src/linux/index.js3
-rw-r--r--node_modules/node-wifi/src/linux/scan/__logs__/scan-01.log16
-rw-r--r--node_modules/node-wifi/src/linux/scan/__test__/command.spec.js33
-rw-r--r--node_modules/node-wifi/src/linux/scan/__test__/parser.spec.js196
-rw-r--r--node_modules/node-wifi/src/linux/scan/command.js22
-rw-r--r--node_modules/node-wifi/src/linux/scan/index.js4
-rw-r--r--node_modules/node-wifi/src/linux/scan/parser.js51
-rw-r--r--node_modules/node-wifi/src/mac-connect.js8
-rw-r--r--node_modules/node-wifi/src/mac-current-connections.js9
-rw-r--r--node_modules/node-wifi/src/mac-delete.js9
-rw-r--r--node_modules/node-wifi/src/mac-scan.js9
-rw-r--r--node_modules/node-wifi/src/macOS/__logs__/current-connections-01.log17
-rw-r--r--node_modules/node-wifi/src/macOS/__logs__/delete-01.log3
-rw-r--r--node_modules/node-wifi/src/macOS/__logs__/scan-01.log6
-rw-r--r--node_modules/node-wifi/src/macOS/__logs__/scan-shifted.log7
-rw-r--r--node_modules/node-wifi/src/macOS/__logs__/scan-space.log5
-rw-r--r--node_modules/node-wifi/src/macOS/connect/__test__/command.spec.js23
-rw-r--r--node_modules/node-wifi/src/macOS/connect/command.js15
-rw-r--r--node_modules/node-wifi/src/macOS/connect/index.js3
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/__logs__/current-connections-01.log17
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/__test__/command.spec.js10
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/__test__/parser.spec.js27
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/command.js6
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/index.js4
-rw-r--r--node_modules/node-wifi/src/macOS/current-connections/parser.js61
-rw-r--r--node_modules/node-wifi/src/macOS/delete/__logs__/delete-01.log3
-rw-r--r--node_modules/node-wifi/src/macOS/delete/__test__/command.spec.js21
-rw-r--r--node_modules/node-wifi/src/macOS/delete/__test__/parser.spec.js15
-rw-r--r--node_modules/node-wifi/src/macOS/delete/command.js14
-rw-r--r--node_modules/node-wifi/src/macOS/delete/index.js3
-rw-r--r--node_modules/node-wifi/src/macOS/delete/parser.js10
-rw-r--r--node_modules/node-wifi/src/macOS/index.js6
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__logs__/airport-xml-2.log3104
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__logs__/scan-01.log6
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__logs__/scan-monterey.log6
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__logs__/scan-shifted.log7
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__logs__/scan-space.log5
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__test__/command.spec.js10
-rw-r--r--node_modules/node-wifi/src/macOS/scan/__test__/parser.spec.js208
-rw-r--r--node_modules/node-wifi/src/macOS/scan/command.js6
-rw-r--r--node_modules/node-wifi/src/macOS/scan/index.js4
-rw-r--r--node_modules/node-wifi/src/macOS/scan/parser.js73
-rw-r--r--node_modules/node-wifi/src/platform.js21
-rw-r--r--node_modules/node-wifi/src/utils/__test__/frequency-from-channel.spec.js11
-rw-r--r--node_modules/node-wifi/src/utils/__test__/percentage-db.spec.js13
-rw-r--r--node_modules/node-wifi/src/utils/__test__/promiser.spec.js66
-rw-r--r--node_modules/node-wifi/src/utils/executer.js13
-rw-r--r--node_modules/node-wifi/src/utils/frequency-from-channel.js40
-rw-r--r--node_modules/node-wifi/src/utils/network-utils.js54
-rw-r--r--node_modules/node-wifi/src/utils/percentage-db.js10
-rw-r--r--node_modules/node-wifi/src/utils/promiser.js33
-rw-r--r--node_modules/node-wifi/src/wifi.js94
-rw-r--r--node_modules/node-wifi/src/windows-connect.js136
-rw-r--r--node_modules/node-wifi/src/windows-current-connections.js89
-rw-r--r--node_modules/node-wifi/src/windows-disconnect.js31
-rw-r--r--node_modules/node-wifi/src/windows-scan.js100
-rw-r--r--node_modules/reduce-flatten/.travis.yml7
-rw-r--r--node_modules/reduce-flatten/LICENSE21
-rw-r--r--node_modules/reduce-flatten/README.hbs11
-rw-r--r--node_modules/reduce-flatten/README.md29
-rw-r--r--node_modules/reduce-flatten/index.js19
-rw-r--r--node_modules/reduce-flatten/package.json24
-rw-r--r--node_modules/reduce-flatten/test.js11
-rw-r--r--node_modules/supports-color/browser.js5
-rw-r--r--node_modules/supports-color/index.js131
-rw-r--r--node_modules/supports-color/license9
-rw-r--r--node_modules/supports-color/package.json53
-rw-r--r--node_modules/supports-color/readme.md66
-rw-r--r--node_modules/systeminformation/LICENSE20
-rw-r--r--node_modules/systeminformation/README.md1091
-rw-r--r--node_modules/systeminformation/lib/audio.js222
-rw-r--r--node_modules/systeminformation/lib/battery.js308
-rw-r--r--node_modules/systeminformation/lib/bluetooth.js229
-rwxr-xr-xnode_modules/systeminformation/lib/cli.js31
-rw-r--r--node_modules/systeminformation/lib/cpu.js1704
-rw-r--r--node_modules/systeminformation/lib/docker.js757
-rw-r--r--node_modules/systeminformation/lib/dockerSocket.js327
-rw-r--r--node_modules/systeminformation/lib/filesystem.js1495
-rw-r--r--node_modules/systeminformation/lib/graphics.js1103
-rw-r--r--node_modules/systeminformation/lib/index.d.ts1028
-rw-r--r--node_modules/systeminformation/lib/index.js504
-rw-r--r--node_modules/systeminformation/lib/internet.js236
-rw-r--r--node_modules/systeminformation/lib/memory.js551
-rw-r--r--node_modules/systeminformation/lib/network.js1779
-rw-r--r--node_modules/systeminformation/lib/osinfo.js1167
-rw-r--r--node_modules/systeminformation/lib/printer.js210
-rw-r--r--node_modules/systeminformation/lib/processes.js1289
-rw-r--r--node_modules/systeminformation/lib/system.js720
-rw-r--r--node_modules/systeminformation/lib/usb.js274
-rw-r--r--node_modules/systeminformation/lib/users.js363
-rw-r--r--node_modules/systeminformation/lib/util.js1303
-rw-r--r--node_modules/systeminformation/lib/virtualbox.js107
-rw-r--r--node_modules/systeminformation/lib/wifi.js744
-rw-r--r--node_modules/systeminformation/package.json99
-rw-r--r--node_modules/table-layout/LICENSE21
-rw-r--r--node_modules/table-layout/README.hbs84
-rw-r--r--node_modules/table-layout/README.md154
-rw-r--r--node_modules/table-layout/index.js197
-rw-r--r--node_modules/table-layout/lib/ansi.js15
-rw-r--r--node_modules/table-layout/lib/cell.js28
-rw-r--r--node_modules/table-layout/lib/column.js67
-rw-r--r--node_modules/table-layout/lib/columns.js156
-rw-r--r--node_modules/table-layout/lib/padding.js14
-rw-r--r--node_modules/table-layout/lib/rows.js52
-rw-r--r--node_modules/table-layout/node_modules/array-back/LICENSE21
-rw-r--r--node_modules/table-layout/node_modules/array-back/README.hbs40
-rw-r--r--node_modules/table-layout/node_modules/array-back/README.md81
-rw-r--r--node_modules/table-layout/node_modules/array-back/dist/index.js70
-rw-r--r--node_modules/table-layout/node_modules/array-back/index.mjs62
-rw-r--r--node_modules/table-layout/node_modules/array-back/package.json46
-rw-r--r--node_modules/table-layout/node_modules/typical/LICENSE22
-rw-r--r--node_modules/table-layout/node_modules/typical/README.hbs40
-rw-r--r--node_modules/table-layout/node_modules/typical/README.md302
-rw-r--r--node_modules/table-layout/node_modules/typical/dist/index.js295
-rw-r--r--node_modules/table-layout/node_modules/typical/index.mjs269
-rw-r--r--node_modules/table-layout/node_modules/typical/package.json63
-rw-r--r--node_modules/table-layout/package.json41
-rw-r--r--node_modules/typical/LICENSE22
-rw-r--r--node_modules/typical/README.hbs40
-rw-r--r--node_modules/typical/README.md277
-rw-r--r--node_modules/typical/dist/index.js255
-rw-r--r--node_modules/typical/index.mjs245
-rw-r--r--node_modules/typical/package.json55
-rw-r--r--node_modules/wordwrapjs/LICENSE21
-rw-r--r--node_modules/wordwrapjs/README.hbs61
-rw-r--r--node_modules/wordwrapjs/README.md115
-rw-r--r--node_modules/wordwrapjs/index.js148
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/LICENSE22
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/README.hbs40
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/README.md302
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/dist/index.js295
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/index.mjs269
-rw-r--r--node_modules/wordwrapjs/node_modules/typical/package.json63
-rw-r--r--node_modules/wordwrapjs/package.json34
-rw-r--r--package-lock.json250
-rw-r--r--package.json4
-rw-r--r--setup.sh5
-rw-r--r--setup/Xresources0
-rw-r--r--setup/modm@tty1.service30
-rw-r--r--setup/rc.xml283
290 files changed, 40144 insertions, 20 deletions
diff --git a/ROADMAP.md b/ROADMAP.md
index ce3e59b..c4213d5 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -4,12 +4,12 @@
* [x] <s>Login screen **- Raindrops**</s>
* [ ] Desktop
* [ ] Window manager
- * [ ] Application menu
- * [ ] Task bar
+ * [ ] Application menu **- Raindrops**
+ * [ ] Task bar **- Raindrops**
* [ ] Media keys
* [ ] Application switcher
* [ ] Notifications
- * [ ] Status bar
+ * [x] <s>Status bar **- Raindrops**</s>
* [ ] Power options
* [ ] Web browser
* [ ] Basic browsing
diff --git a/core/desktop/index.html b/core/desktop/index.html
index d06197b..9024117 100644
--- a/core/desktop/index.html
+++ b/core/desktop/index.html
@@ -6,7 +6,6 @@
<style>
* {
font-family: "Inter", sans-serif;
- pointer-events: none;
user-select: none;
user-focus: none;
outline: none;
@@ -54,6 +53,12 @@
console.log('[status]', e.message)
});
+ document.getElementById("status").addEventListener("ipc-message", (event) => {
+ if (event.channel === "status") {
+ console.info("update =>", event.args[0]);
+ }
+ })
+
const fs = require("fs");
if (fs.existsSync("/mango/session/config/wallpaper")) {
diff --git a/core/status/icons/battery-0-charging.svg b/core/status/icons/battery-0-charging.svg
new file mode 100644
index 0000000..a7688ac
--- /dev/null
+++ b/core/status/icons/battery-0-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M15.5,44c-0.4,0-0.8-0.1-1.1-0.4c-0.3-0.3-0.4-0.6-0.4-1.1V8.7c0-0.4,0.1-0.8,0.4-1.1c0.3-0.3,0.6-0.4,1.1-0.4H20V4h8v3.2
+ h4.5c0.4,0,0.8,0.1,1.1,0.4C33.9,7.9,34,8.3,34,8.7v33.8c0,0.4-0.1,0.8-0.4,1.1c-0.3,0.3-0.6,0.4-1.1,0.4H15.5z M17,41h14V10.2H17
+ V41z"/>
+<polygon points="25,16 20,28 23,28 23,36 28,24 25,24 "/>
+</svg>
diff --git a/core/status/icons/battery-0.svg b/core/status/icons/battery-0.svg
new file mode 100644
index 0000000..da11590
--- /dev/null
+++ b/core/status/icons/battery-0.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M450-403h60v-240h-60v240Zm30.5 150q12.5 0 21-9t8.5-21.5q0-12.5-8.625-21T480-313q-12 0-21 8.625T450-283q0 12 9 21t21.5 9ZM310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-60h280v-616H340v616Zm0 0h280-280Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-1-charging.svg b/core/status/icons/battery-1-charging.svg
new file mode 100644
index 0000000..a7688ac
--- /dev/null
+++ b/core/status/icons/battery-1-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M15.5,44c-0.4,0-0.8-0.1-1.1-0.4c-0.3-0.3-0.4-0.6-0.4-1.1V8.7c0-0.4,0.1-0.8,0.4-1.1c0.3-0.3,0.6-0.4,1.1-0.4H20V4h8v3.2
+ h4.5c0.4,0,0.8,0.1,1.1,0.4C33.9,7.9,34,8.3,34,8.7v33.8c0,0.4-0.1,0.8-0.4,1.1c-0.3,0.3-0.6,0.4-1.1,0.4H15.5z M17,41h14V10.2H17
+ V41z"/>
+<polygon points="25,16 20,28 23,28 23,36 28,24 25,24 "/>
+</svg>
diff --git a/core/status/icons/battery-1.svg b/core/status/icons/battery-1.svg
new file mode 100644
index 0000000..9831a68
--- /dev/null
+++ b/core/status/icons/battery-1.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-60h280v-616H340v616Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-2-charging.svg b/core/status/icons/battery-2-charging.svg
new file mode 100644
index 0000000..31484bb
--- /dev/null
+++ b/core/status/icons/battery-2-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M15.5,44c-0.4,0-0.8-0.1-1.1-0.4c-0.3-0.3-0.4-0.6-0.4-1.1V8.7c0-0.4,0.1-0.8,0.4-1.1c0.3-0.3,0.6-0.4,1.1-0.4H20V4h8v3.2
+ h4.5c0.4,0,0.8,0.1,1.1,0.4C33.9,7.9,34,8.3,34,8.7v33.8c0,0.4-0.1,0.8-0.4,1.1c-0.3,0.3-0.6,0.4-1.1,0.4H15.5z M17,36.6h14V10.2H17
+ V36.6z"/>
+<polygon points="25,16 20,28 23,28 23,36 28,24 25,24 "/>
+</svg>
diff --git a/core/status/icons/battery-2.svg b/core/status/icons/battery-2.svg
new file mode 100644
index 0000000..26d0c19
--- /dev/null
+++ b/core/status/icons/battery-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-148h280v-528H340v528Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-3-charging.svg b/core/status/icons/battery-3-charging.svg
new file mode 100644
index 0000000..9f2d775
--- /dev/null
+++ b/core/status/icons/battery-3-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.6,7.6c-0.3-0.3-0.6-0.4-1.1-0.4H28V4h-8v3.2h-4.5c-0.4,0-0.8,0.1-1.1,0.4C14.1,7.9,14,8.3,14,8.7v33.8
+ c0,0.4,0.1,0.8,0.4,1.1c0.3,0.3,0.6,0.4,1.1,0.4h17c0.4,0,0.8-0.1,1.1-0.4c0.3-0.3,0.4-0.6,0.4-1.1V8.7C34,8.3,33.9,7.9,33.6,7.6z
+ M31,32.2h-6.4L23,36v-3.8h-6v-22h14V32.2z"/>
+<polygon points="25,24 25,16 20,28 23,28 23,32.2 24.6,32.2 28,24 "/>
+</svg>
diff --git a/core/status/icons/battery-3.svg b/core/status/icons/battery-3.svg
new file mode 100644
index 0000000..98023a6
--- /dev/null
+++ b/core/status/icons/battery-3.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-236h280v-440H340v440Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-4-charging.svg b/core/status/icons/battery-4-charging.svg
new file mode 100644
index 0000000..2a3a610
--- /dev/null
+++ b/core/status/icons/battery-4-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.6,7.6c-0.3-0.3-0.6-0.4-1.1-0.4H28V4h-8v3.2h-4.5c-0.4,0-0.8,0.1-1.1,0.4C14.1,7.9,14,8.3,14,8.7v33.8
+ c0,0.4,0.1,0.8,0.4,1.1c0.3,0.3,0.6,0.4,1.1,0.4h17c0.4,0,0.8-0.1,1.1-0.4c0.3-0.3,0.4-0.6,0.4-1.1V8.7C34,8.3,33.9,7.9,33.6,7.6z
+ M31,27.8h-4.6L23,36v-8h-3l0.1-0.2H17V10.2h14V27.8z"/>
+<polygon points="25,24 25,16 20.1,27.8 26.4,27.8 28,24 "/>
+</svg>
diff --git a/core/status/icons/battery-4.svg b/core/status/icons/battery-4.svg
new file mode 100644
index 0000000..12979e7
--- /dev/null
+++ b/core/status/icons/battery-4.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-324h280v-352H340v352Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-5-charging.svg b/core/status/icons/battery-5-charging.svg
new file mode 100644
index 0000000..a42609d
--- /dev/null
+++ b/core/status/icons/battery-5-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.6,7.6c-0.3-0.3-0.6-0.4-1.1-0.4H28V4h-8v3.2h-4.5c-0.4,0-0.8,0.1-1.1,0.4C14.1,7.9,14,8.3,14,8.7v33.8
+ c0,0.4,0.1,0.8,0.4,1.1c0.3,0.3,0.6,0.4,1.1,0.4h17c0.4,0,0.8-0.1,1.1-0.4c0.3-0.3,0.4-0.6,0.4-1.1V8.7C34,8.3,33.9,7.9,33.6,7.6z
+ M31,23.4h-6V24h3l-5,12v-8h-3l1.9-4.6H17V10.2h14V23.4z"/>
+<polygon points="25,16 21.9,23.4 25,23.4 "/>
+</svg>
diff --git a/core/status/icons/battery-5.svg b/core/status/icons/battery-5.svg
new file mode 100644
index 0000000..bfd4958
--- /dev/null
+++ b/core/status/icons/battery-5.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-412h280v-264H340v264Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-6-charging.svg b/core/status/icons/battery-6-charging.svg
new file mode 100644
index 0000000..ba3de72
--- /dev/null
+++ b/core/status/icons/battery-6-charging.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.6,7.6c-0.3-0.3-0.6-0.4-1.1-0.4H28V4h-8v3.2h-4.5c-0.4,0-0.8,0.1-1.1,0.4C14.1,7.9,14,8.3,14,8.7v33.8
+ c0,0.4,0.1,0.8,0.4,1.1c0.3,0.3,0.6,0.4,1.1,0.4h17c0.4,0,0.8-0.1,1.1-0.4c0.3-0.3,0.4-0.6,0.4-1.1V8.7C34,8.3,33.9,7.9,33.6,7.6z
+ M31,19h-6v5h3l-5,12v-8h-3l3.8-9H17v-8.8h14V19z"/>
+<polygon points="25,16 23.8,19 25,19 "/>
+</svg>
diff --git a/core/status/icons/battery-6.svg b/core/status/icons/battery-6.svg
new file mode 100644
index 0000000..7fd403f
--- /dev/null
+++ b/core/status/icons/battery-6.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-500h280v-176H340v176Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-7-charging.svg b/core/status/icons/battery-7-charging.svg
new file mode 100644
index 0000000..c7ee17f
--- /dev/null
+++ b/core/status/icons/battery-7-charging.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.6,7.6c-0.3-0.3-0.6-0.4-1.1-0.4H28V4h-8v3.2h-4.5c-0.4,0-0.8,0.1-1.1,0.4C14.1,7.9,14,8.3,14,8.7v33.8
+ c0,0.4,0.1,0.8,0.4,1.1c0.3,0.3,0.6,0.4,1.1,0.4h17c0.4,0,0.8-0.1,1.1-0.4c0.3-0.3,0.4-0.6,0.4-1.1V8.7C34,8.3,33.9,7.9,33.6,7.6z
+ M23,36v-8h-3l5-12v8h3L23,36z M31,14.6H17v-4.4h14V14.6z"/>
+</svg>
diff --git a/core/status/icons/battery-7.svg b/core/status/icons/battery-7.svg
new file mode 100644
index 0000000..2c617df
--- /dev/null
+++ b/core/status/icons/battery-7.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v676q0 12.75-8.625 21.375T650-80H310Zm30-588h280v-88H340v88Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-8-charging.svg b/core/status/icons/battery-8-charging.svg
new file mode 100644
index 0000000..7a51140
--- /dev/null
+++ b/core/status/icons/battery-8-charging.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
+<path d="M33.4,8.6C33,8.2,32.6,8,32,8h-4V4h-8v4h-4c-0.6,0-1,0.2-1.4,0.6C14.2,9,14,9.4,14,10v32c0,0.6,0.2,1,0.6,1.4
+ C15,43.8,15.4,44,16,44h16c0.6,0,1-0.2,1.4-0.6C33.8,43,34,42.6,34,42V10C34,9.4,33.8,9,33.4,8.6z M23,36v-8h-3l5-12v8h3L23,36z"/>
+</svg>
diff --git a/core/status/icons/battery-8.svg b/core/status/icons/battery-8.svg
new file mode 100644
index 0000000..41e611d
--- /dev/null
+++ b/core/status/icons/battery-8.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M320-80q-17 0-28.5-11.5T280-120v-640q0-17 11.5-28.5T320-800h80v-80h160v80h80q17 0 28.5 11.5T680-760v640q0 17-11.5 28.5T640-80H320Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/battery-error.svg b/core/status/icons/battery-error.svg
new file mode 100644
index 0000000..7118ade
--- /dev/null
+++ b/core/status/icons/battery-error.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m656-94-42-42 84-84-84-84 42-42 84 84 84-84 42 42-83 84 83 84-42 42-84-83-84 83ZM310-80q-12.75 0-21.375-8.625T280-110v-676q0-12.75 8.625-21.375T310-816h90v-64h160v64h90q12.75 0 21.375 8.625T680-786v363q-17 5-31.5 12T620-394v-362H340v616h204q7 17 16.5 31.5T582-80H310Zm30-60h204-15 15-204Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-ethernet.svg b/core/status/icons/network-ethernet.svg
new file mode 100644
index 0000000..30135ef
--- /dev/null
+++ b/core/status/icons/network-ethernet.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m680-240-42-42 196-198-196-198 42-42 240 240-240 240Zm-400 0L40-480l240-240 42 42-196 198 196 198-42 42Zm40-205q-14 0-24.5-10.5T285-480q0-14 10.5-24.5T320-515q14 0 24.5 10.5T355-480q0 14-10.5 24.5T320-445Zm160 0q-14 0-24.5-10.5T445-480q0-14 10.5-24.5T480-515q14 0 24.5 10.5T515-480q0 14-10.5 24.5T480-445Zm160 0q-14 0-24.5-10.5T605-480q0-14 10.5-24.5T640-515q14 0 24.5 10.5T675-480q0 14-10.5 24.5T640-445Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-none.svg b/core/status/icons/network-none.svg
new file mode 100644
index 0000000..854fa6e
--- /dev/null
+++ b/core/status/icons/network-none.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M818-56 703-171H248q-88 0-148-59T40-377q0-80 50.5-134T217-577q2-14 6.5-31.5T236-640L70-806l42-42L861-99l-43 43ZM248-231h397L285-591q-11 15-14.5 34t-3.5 37h-19q-62 0-105 39.5t-43 101q0 61.5 43 105T248-231Zm216-181Zm390 210-47-47q25-17 39-38t14-50q0-43-31-73.5T755-441h-67v-81q0-88-61-147.5T478.473-729Q450-729 417.5-720T358-691l-42-42q36-29 77.5-42.5T478-789q111 0 190.5 79T748-520v21q72-1 122 45t50 117q0 35-16.5 73.5T854-202ZM583-470Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-0.svg b/core/status/icons/network-wifi-0.svg
new file mode 100644
index 0000000..76452ad
--- /dev/null
+++ b/core/status/icons/network-wifi-0.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120 0-600q99-94 221-147t259-53q137 0 259 53t221 147L480-120Zm0-82 392-392q-87-68-184.5-107T480-740q-110 0-207.5 39T88-594l392 392Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-1.svg b/core/status/icons/network-wifi-1.svg
new file mode 100644
index 0000000..25262d5
--- /dev/null
+++ b/core/status/icons/network-wifi-1.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120 0-600q97-93 220-146.5T480-800q137 0 260 53.5T960-600L480-120ZM344-338q29-23 63.5-36t72.5-13q38 0 72.5 13t63.5 36l256-256q-87-68-184.5-107T480-740q-110 0-207.5 39T88-594l256 256Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-2.svg b/core/status/icons/network-wifi-2.svg
new file mode 100644
index 0000000..fb75dea
--- /dev/null
+++ b/core/status/icons/network-wifi-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120 0-600q97-93 220-146.5T480-800q137 0 260 53.5T960-600L480-120ZM273-409q45-35 96.5-55T480-484q59 0 110.5 20t96.5 55l185-185q-87-68-184.5-107T480-740q-110 0-207.5 39T88-594l185 185Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-3.svg b/core/status/icons/network-wifi-3.svg
new file mode 100644
index 0000000..179575c
--- /dev/null
+++ b/core/status/icons/network-wifi-3.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120 0-600q97-93 220-146.5T480-800q137 0 260 53.5T960-600L480-120ZM197-486q62-49 132-76t151-27q81 0 151.5 27T764-486l108-108q-87-68-184.5-107T480-740q-110 0-207.5 39T88-594l109 108Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-4.svg b/core/status/icons/network-wifi-4.svg
new file mode 100644
index 0000000..51722d0
--- /dev/null
+++ b/core/status/icons/network-wifi-4.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120 0-600q99-94 221-147t259-53q137 0 259 53t221 147L480-120Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/network-wifi-offline.svg b/core/status/icons/network-wifi-offline.svg
new file mode 100644
index 0000000..3d32327
--- /dev/null
+++ b/core/status/icons/network-wifi-offline.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M480-120-1-600q99-96 221.5-148T480-800q137 0 258.5 52T960-600l-35 35q-25-26-58-39.5T795-618q-78 0-133 55t-55 133q0 39 14 70.5t41 57.5L480-120Zm315-30q-15 0-25.5-10.5T759-186q0-15 10.5-25.5T795-222q15 0 25.5 10.5T831-186q0 15-10.5 25.5T795-150Zm-23-114q0-42 8-67t39-48q26-19 35-33.5t9-33.5q0-26-17.5-42.5T800-505q-29 0-48 14.5T721-451l-41-25q16-38 47-60t73-22q48 0 80.5 31t32.5 78q0 31-12.5 53T862-353q-29 23-36.5 39.5T818-264h-46Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/volume-0.svg b/core/status/icons/volume-0.svg
new file mode 100644
index 0000000..5266dc0
--- /dev/null
+++ b/core/status/icons/volume-0.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M813-56 681-188q-28 20-60.5 34.5T553-131v-62q23-7 44.5-15.5T638-231L473-397v237L273-360H113v-240h156L49-820l43-43 764 763-43 44Zm-36-232-43-43q20-34 29.5-71.923T773-481q0-103.322-60-184.661T553-769v-62q124 28 202 125.5T833-481q0 51-14 100t-42 93ZM643-422l-90-90v-130q47 22 73.5 66t26.5 96q0 15-2.5 29.5T643-422ZM473-592 369-696l104-104v208Zm-60 286v-150l-84-84H173v120h126l114 114Zm-42-192Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/volume-1.svg b/core/status/icons/volume-1.svg
new file mode 100644
index 0000000..77a6dbd
--- /dev/null
+++ b/core/status/icons/volume-1.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M280-360v-240h160l200-200v640L440-360H280Zm60-60h127l113 109v-337L467-540H340v120Zm119-60Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/volume-2.svg b/core/status/icons/volume-2.svg
new file mode 100644
index 0000000..233c07d
--- /dev/null
+++ b/core/status/icons/volume-2.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M200-360v-240h160l200-200v640L360-360H200Zm420 48v-337q54 17 87 64t33 105q0 59-33 105t-87 63ZM500-648 387-540H260v120h127l113 109v-337ZM378-480Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/volume-3.svg b/core/status/icons/volume-3.svg
new file mode 100644
index 0000000..946d406
--- /dev/null
+++ b/core/status/icons/volume-3.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="M560-131v-62q97-28 158.5-107.5T780-481q0-101-61-181T560-769v-62q124 28 202 125.5T840-481q0 127-78 224.5T560-131ZM120-360v-240h160l200-200v640L280-360H120Zm420 48v-337q55 17 87.5 64T660-480q0 57-33 104t-87 64ZM420-648 307-540H180v120h127l113 109v-337Zm-94 168Z"/></svg> \ No newline at end of file
diff --git a/core/status/icons/volume-none.svg b/core/status/icons/volume-none.svg
new file mode 100644
index 0000000..2dfad44
--- /dev/null
+++ b/core/status/icons/volume-none.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 -960 960 960" width="48"><path d="m611-323-43-43 114-113-114-113 43-43 113 114 113-114 43 43-114 113 114 113-43 43-113-114-113 114Zm-491-37v-240h160l200-200v640L280-360H120Zm300-288L307-540H180v120h127l113 109v-337ZM311-481Z"/></svg> \ No newline at end of file
diff --git a/core/status/index.html b/core/status/index.html
index eee47a7..dc9c165 100644
--- a/core/status/index.html
+++ b/core/status/index.html
@@ -6,7 +6,6 @@
<style>
* {
font-family: "Inter", sans-serif;
- pointer-events: none;
user-select: none;
user-focus: none;
outline: none;
@@ -34,15 +33,145 @@
backdrop-filter: blur(50px);
background-color: rgba(255, 255, 255, .5);
}
+
+ .status-bar-clickable:active {
+ background-color: rgba(0, 0, 0, .1);
+ border-radius: 5px;
+ }
+
+ .n {
+ font-family: "Roboto Mono", monospace;
+ }
</style>
</head>
<body>
<div id="bg"></div>
- <div id="status-bar">
- <div id="bar-left" style="display: inline-block;">left</div>
- <div id="bar-right" style="margin-left: auto; display: inline-block; width: max-content; float: right;">right</div>
+ <div id="status-bar" style="padding: 0 20px;">
+ <div id="bar-left" style="display: inline-block; height: 100%;">
+ <a onclick="ipcRenderer.sendToHost('status', { action: 'clickOn', item: 'menu' });" id="mango-menu" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px;">
+ <img src="../../logo-symbolic.svg" style="width: 24px; pointer-events: none;">
+ </a>
+ </div>
+ <div id="bar-right" style="margin-left: auto; display: inline-block; width: max-content; float: right; height: 100%;">
+ <a onclick="ipcRenderer.sendToHost('status', { action: 'clickOn', item: 'volume' });" id="item-volume" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;">
+ <img id="item-volume-icon" src="" style="width: 24px; pointer-events: none; vertical-align: middle;">
+ </a><a onclick="ipcRenderer.sendToHost('status', { action: 'clickOn', item: 'network' });" id="item-network" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;">
+ <img id="item-network-icon" src="" style="width: 24px; pointer-events: none; vertical-align: middle;">
+ </a><a onclick="ipcRenderer.sendToHost('status', { action: 'clickOn', item: 'battery' });" id="item-battery" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: 31px; vertical-align: middle;">
+ <img id="item-battery-icon" src="" style="width: 24px; pointer-events: none; vertical-align: middle;">
+ </a><a onclick="ipcRenderer.sendToHost('status', { action: 'clickOn', item: 'clock' });" id="item-clock" class="status-bar-clickable" style="height: 31px; display: inline-flex; align-items: center; justify-content: center; width: max-content; vertical-align: middle;">&nbsp;<span id="item-clock-week"></span>&nbsp;<span id="item-clock-day" class="n"></span>&nbsp;<span id="item-clock-month"></span> &nbsp;&nbsp;<span id="item-clock-hour" class="n"></span>:<span id="item-clock-minute" class="n"></span></a>
+ </div>
</div>
<script>
+ const ipcRenderer = require('electron').ipcRenderer;
+ const libmangoaudio = require('../../lib/libmangoaudio');
+ const si = require('systeminformation');
+ const wifi = require('node-wifi');
+
+ wifi.init({
+ iface: null
+ });
+
+ setInterval(async () => {
+ await connectionCheck();
+ }, 30000);
+
+ function fetchTimeout(url, options, timeout = 5000) {
+ return Promise.race([
+ fetch(url, options),
+ new Promise((_, reject) =>
+ setTimeout(() => reject(new Error('timeout')), timeout)
+ )
+ ]);
+ }
+
+ async function connectionCheck() {
+ let online = false;
+ let serversList = [
+ "https://connectivitycheck.grapheneos.network/generate_204",
+ "http://connectivitycheck.grapheneos.network/generate_204",
+ "http://grapheneos.online/gen_204",
+ "http://grapheneos.online/generate_204",
+ "https://www.google.com/generate_204",
+ "http://connectivitycheck.gstatic.com/generate_204",
+ "http://www.google.com/gen_204",
+ "http://play.googleapis.com/generate_204"
+ ]
+
+ for (let server of serversList) {
+ try {
+ let res = await fetchTimeout(server, {}, 3000);
+ if (res.status === 204) {
+ online = true;
+ break;
+ }
+ } catch (e) {}
+ }
+
+ return online;
+ }
+
+ let hasInternetAccess = connectionCheck();
+
+ setInterval(async () => {
+ let dateParts = (new Intl.DateTimeFormat('en-IE', { weekday: "short", month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit" })).format(new Date()).split(" ").map((i, j) => { if (j === 0 || j === 2) { return i.substring(0, i.length - 1); } else { return i; } });
+ let timeParts = dateParts[3].split(":");
+
+ document.getElementById("item-clock-week").innerText = dateParts[0].toString();
+ document.getElementById("item-clock-day").innerText = dateParts[1].toString();
+ document.getElementById("item-clock-month").innerText = dateParts[2].toString();
+ document.getElementById("item-clock-hour").innerText = timeParts[0];
+ document.getElementById("item-clock-minute").innerText = timeParts[1];
+
+ let level = (await libmangoaudio.getDefaultOutput())['volume']['level'];
+
+ if (typeof level === "number") {
+ if (level === 0) {
+ document.getElementById("item-volume-icon").src = "./icons/volume-0.svg";
+ } else if (level < 100/3) {
+ document.getElementById("item-volume-icon").src = "./icons/volume-1.svg";
+ } else if (level < 200/3) {
+ document.getElementById("item-volume-icon").src = "./icons/volume-2.svg";
+ } else {
+ document.getElementById("item-volume-icon").src = "./icons/volume-3.svg";
+ }
+ } else {
+ document.getElementById("item-volume-icon").src = "./icons/volume-none.svg";
+ }
+
+ let batteryInfo = await si.battery();
+ let battery = batteryInfo.percent;
+ let charging = batteryInfo.isCharging;
+ let present = batteryInfo.hasBattery || batteryInfo.maxCapacity === 0 || batteryInfo.voltage === 0 || batteryInfo.designedCapacity === 0 || batteryInfo.capacityUnit === '';
+
+ let levelIcon = Math.floor(battery / 12.5);
+ let iconSuffix = charging ? "-charging" : "";
+
+ if (present) {
+ document.getElementById("item-battery-icon").src = "./icons/battery-" + levelIcon + iconSuffix + ".svg";
+ } else {
+ document.getElementById("item-battery-icon").src = "./icons/battery-error.svg";
+ }
+
+ let online = hasInternetAccess;
+ let networks = wifi.getCurrentConnections();
+
+ if (!online) {
+ if (networks.length > 0) {
+ document.getElementById("item-network-icon").src = "./icons/network-wifi-offline.svg";
+ } else {
+ document.getElementById("item-network-icon").src = "./icons/network-none.svg";
+ }
+ } else {
+ if (networks.length > 0) {
+ let quality = Math.round(networks[0].quality / 25);
+ document.getElementById("item-network-icon").src = "./icons/network-wifi-" + quality + ".svg";
+ } else {
+ document.getElementById("item-network-icon").src = "./icons/network-ethernet.svg";
+ }
+ }
+ }, 1000);
+
function resizeBackground(width, height) {
document.getElementById("bg").style.width = width + "px";
document.getElementById("bg").style.height = height + "px";
diff --git a/init.sh b/init.sh
index 4600382..52ccc16 100644
--- a/init.sh
+++ b/init.sh
@@ -3,5 +3,6 @@ cd /mango
chmod -R +x *
xset -dpms
xset s off
+openbox&
./node_modules/electron/dist/electron --no-sandbox main.js
xterm \ No newline at end of file
diff --git a/logo-symbolic.svg b/logo-symbolic.svg
new file mode 100644
index 0000000..a88ea0f
--- /dev/null
+++ b/logo-symbolic.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 27.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
+<path d="M85.8,32c-1.3,0-2.4-1.1-2.4-2.4c0-8.6,6.1-11.7,11.7-11.7c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4
+ c-3.3,0-7.1,1.2-7.1,7.1C88.1,31,87.1,32,85.8,32z"/>
+<path d="M40.2,29.8C53.7,16.7,77.6,17,92.4,31.5S107.6,69.4,77.2,99c-10.1,9.9-33.7,23-47.1,9.9c-6.4-6.4-8.9-20.3-7.5-35.3
+ C24.1,57.3,30.1,39.8,40.2,29.8z"/>
+</svg>
diff --git a/main.js b/main.js
index b97e584..d772441 100644
--- a/main.js
+++ b/main.js
@@ -1,18 +1,11 @@
-// main.js
-
-// Modules to control application life and create native browser window
-const { app, BrowserWindow, screen } = require('electron')
+const { app, BrowserWindow, globalShortcut, ipcMain } = require('electron')
const path = require('path')
const createWindow = () => {
const mainWindow = new BrowserWindow({
backgroundColor: "#ed9464",
- x: 0,
- y: 0,
frame: false,
show: false,
- width: screen.getPrimaryDisplay().workAreaSize.width,
- height: screen.getPrimaryDisplay().workAreaSize.height,
fullscreen: true,
fullscreenable: true,
webPreferences: {
@@ -29,7 +22,59 @@ const createWindow = () => {
mainWindow.on('ready-to-show', () => {
mainWindow.show();
mainWindow.focus();
- })
+ });
+
+ ipcMain.on("statusbar", (event, data) => {
+ mainWindow.send("statusbar", data);
+ });
+
+ globalShortcut.register('Alt+Shift+Tab', () => {
+ mainWindow.send("switchBack");
+ });
+
+ globalShortcut.register('Alt+Tab', () => {
+ mainWindow.send("switch");
+ });
+
+ globalShortcut.register('Ctrl+Alt+Tab', () => {
+ mainWindow.send("switch");
+ });
+
+ globalShortcut.register('Alt+F4', () => {
+ mainWindow.send("close");
+ });
+
+ globalShortcut.register('Alt+Space', () => {
+ mainWindow.send("menu");
+ });
+
+ globalShortcut.register('Meta+D', () => {
+ mainWindow.send("desktop");
+ });
+
+ globalShortcut.register('Super+D', () => {
+ mainWindow.send("desktop");
+ });
+
+ globalShortcut.register('Meta+E', () => {});
+ globalShortcut.register('Super+E', () => {});
+ globalShortcut.register('Meta+F1', () => {});
+ globalShortcut.register('Super+F1', () => {});
+ globalShortcut.register('Meta+F2', () => {});
+ globalShortcut.register('Super+F2', () => {});
+ globalShortcut.register('Meta+F3', () => {});
+ globalShortcut.register('Super+F3', () => {});
+ globalShortcut.register('Meta+F4', () => {});
+ globalShortcut.register('Super+F4', () => {});
+ globalShortcut.register('Ctrl+Alt+Right', () => {});
+ globalShortcut.register('Ctrl+Alt+Left', () => {});
+ globalShortcut.register('Ctrl+Alt+Up', () => {});
+ globalShortcut.register('Ctrl+Alt+Down', () => {});
+ globalShortcut.register('Shift+Alt+Right', () => {});
+ globalShortcut.register('Shift+Alt+Left', () => {});
+ globalShortcut.register('Shift+Alt+Up', () => {});
+ globalShortcut.register('Shift+Alt+Down', () => {});
+ globalShortcut.register('Alt+Esc', () => {});
}
app.whenReady().then(() => {
createWindow();
diff --git a/node_modules/.bin/systeminformation b/node_modules/.bin/systeminformation
new file mode 120000
index 0000000..681d01e
--- /dev/null
+++ b/node_modules/.bin/systeminformation
@@ -0,0 +1 @@
+../systeminformation/lib/cli.js \ No newline at end of file
diff --git a/node_modules/.bin/wifi b/node_modules/.bin/wifi
new file mode 120000
index 0000000..c8959c1
--- /dev/null
+++ b/node_modules/.bin/wifi
@@ -0,0 +1 @@
+../node-wifi/bin/wifi.js \ No newline at end of file
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
index e37bd81..e45769e 100644
--- a/node_modules/.package-lock.json
+++ b/node_modules/.package-lock.json
@@ -91,6 +91,25 @@
"@types/node": "*"
}
},
+ "node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/array-back": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz",
+ "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/boolean": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
@@ -130,6 +149,27 @@
"node": ">=8"
}
},
+ "node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/chalk/node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
"node_modules/clone-response": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",
@@ -141,6 +181,63 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
+ },
+ "node_modules/command-line-args": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz",
+ "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==",
+ "dependencies": {
+ "array-back": "^3.1.0",
+ "find-replace": "^3.0.0",
+ "lodash.camelcase": "^4.3.0",
+ "typical": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/command-line-usage": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz",
+ "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==",
+ "dependencies": {
+ "array-back": "^4.0.2",
+ "chalk": "^2.4.2",
+ "table-layout": "^1.0.2",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -182,6 +279,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/defer-to-connect": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
@@ -290,6 +395,17 @@
"pend": "~1.2.0"
}
},
+ "node_modules/find-replace": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
+ "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==",
+ "dependencies": {
+ "array-back": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -426,6 +542,14 @@
"node": ">= 0.4.0"
}
},
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/has-property-descriptors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
@@ -506,6 +630,11 @@
"json-buffer": "3.0.1"
}
},
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
+ },
"node_modules/lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
@@ -551,6 +680,21 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
+ "node_modules/node-wifi": {
+ "version": "2.0.16",
+ "resolved": "https://registry.npmjs.org/node-wifi/-/node-wifi-2.0.16.tgz",
+ "integrity": "sha512-WOgs7kqTvijHij1GLMVW/ReIZHEtcvJuZSMDExEDhBhLquQJPUbBOIsQxavnhJJ06MQnGXnW1qJKe9ADibOTIA==",
+ "dependencies": {
+ "command-line-args": "^5.2.0",
+ "command-line-usage": "^6.1.1"
+ },
+ "bin": {
+ "wifi": "bin/wifi.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/normalize-url": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
@@ -620,6 +764,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/reduce-flatten": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz",
+ "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/resolve-alpn": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",
@@ -699,6 +851,72 @@
"node": ">= 8.0"
}
},
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/systeminformation": {
+ "version": "5.18.3",
+ "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.18.3.tgz",
+ "integrity": "sha512-k+gk7zSi0hI/m3Mgu1OzR8j9BfXMDYa2HUMBdEQZUVCVAO326kDrzrvtVMljiSoDs6T6ojI0AHneDn8AMa0Y6A==",
+ "os": [
+ "darwin",
+ "linux",
+ "win32",
+ "freebsd",
+ "openbsd",
+ "netbsd",
+ "sunos",
+ "android"
+ ],
+ "bin": {
+ "systeminformation": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "funding": {
+ "type": "Buy me a coffee",
+ "url": "https://www.buymeacoffee.com/systeminfo"
+ }
+ },
+ "node_modules/table-layout": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz",
+ "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==",
+ "dependencies": {
+ "array-back": "^4.0.1",
+ "deep-extend": "~0.6.0",
+ "typical": "^5.2.0",
+ "wordwrapjs": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/table-layout/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/table-layout/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/type-fest": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
@@ -711,6 +929,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/typical": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz",
+ "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@@ -719,6 +945,26 @@
"node": ">= 4.0.0"
}
},
+ "node_modules/wordwrapjs": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz",
+ "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==",
+ "dependencies": {
+ "reduce-flatten": "^2.0.0",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/wordwrapjs/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js
new file mode 100644
index 0000000..90a871c
--- /dev/null
+++ b/node_modules/ansi-styles/index.js
@@ -0,0 +1,165 @@
+'use strict';
+const colorConvert = require('color-convert');
+
+const wrapAnsi16 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${code + offset}m`;
+};
+
+const wrapAnsi256 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};5;${code}m`;
+};
+
+const wrapAnsi16m = (fn, offset) => function () {
+ const rgb = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
+};
+
+function assembleStyles() {
+ const codes = new Map();
+ const styles = {
+ modifier: {
+ reset: [0, 0],
+ // 21 isn't widely supported and 22 does the same thing
+ bold: [1, 22],
+ dim: [2, 22],
+ italic: [3, 23],
+ underline: [4, 24],
+ inverse: [7, 27],
+ hidden: [8, 28],
+ strikethrough: [9, 29]
+ },
+ color: {
+ black: [30, 39],
+ red: [31, 39],
+ green: [32, 39],
+ yellow: [33, 39],
+ blue: [34, 39],
+ magenta: [35, 39],
+ cyan: [36, 39],
+ white: [37, 39],
+ gray: [90, 39],
+
+ // Bright color
+ redBright: [91, 39],
+ greenBright: [92, 39],
+ yellowBright: [93, 39],
+ blueBright: [94, 39],
+ magentaBright: [95, 39],
+ cyanBright: [96, 39],
+ whiteBright: [97, 39]
+ },
+ bgColor: {
+ bgBlack: [40, 49],
+ bgRed: [41, 49],
+ bgGreen: [42, 49],
+ bgYellow: [43, 49],
+ bgBlue: [44, 49],
+ bgMagenta: [45, 49],
+ bgCyan: [46, 49],
+ bgWhite: [47, 49],
+
+ // Bright color
+ bgBlackBright: [100, 49],
+ bgRedBright: [101, 49],
+ bgGreenBright: [102, 49],
+ bgYellowBright: [103, 49],
+ bgBlueBright: [104, 49],
+ bgMagentaBright: [105, 49],
+ bgCyanBright: [106, 49],
+ bgWhiteBright: [107, 49]
+ }
+ };
+
+ // Fix humans
+ styles.color.grey = styles.color.gray;
+
+ for (const groupName of Object.keys(styles)) {
+ const group = styles[groupName];
+
+ for (const styleName of Object.keys(group)) {
+ const style = group[styleName];
+
+ styles[styleName] = {
+ open: `\u001B[${style[0]}m`,
+ close: `\u001B[${style[1]}m`
+ };
+
+ group[styleName] = styles[styleName];
+
+ codes.set(style[0], style[1]);
+ }
+
+ Object.defineProperty(styles, groupName, {
+ value: group,
+ enumerable: false
+ });
+
+ Object.defineProperty(styles, 'codes', {
+ value: codes,
+ enumerable: false
+ });
+ }
+
+ const ansi2ansi = n => n;
+ const rgb2rgb = (r, g, b) => [r, g, b];
+
+ styles.color.close = '\u001B[39m';
+ styles.bgColor.close = '\u001B[49m';
+
+ styles.color.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 0)
+ };
+ styles.color.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 0)
+ };
+ styles.color.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 0)
+ };
+
+ styles.bgColor.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 10)
+ };
+
+ for (let key of Object.keys(colorConvert)) {
+ if (typeof colorConvert[key] !== 'object') {
+ continue;
+ }
+
+ const suite = colorConvert[key];
+
+ if (key === 'ansi16') {
+ key = 'ansi';
+ }
+
+ if ('ansi16' in suite) {
+ styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
+ styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
+ }
+
+ if ('ansi256' in suite) {
+ styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
+ styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
+ }
+
+ if ('rgb' in suite) {
+ styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
+ styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
+ }
+ }
+
+ return styles;
+}
+
+// Make the export immutable
+Object.defineProperty(module, 'exports', {
+ enumerable: true,
+ get: assembleStyles
+});
diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/ansi-styles/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ansi-styles/package.json b/node_modules/ansi-styles/package.json
new file mode 100644
index 0000000..65edb48
--- /dev/null
+++ b/node_modules/ansi-styles/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "ansi-styles",
+ "version": "3.2.1",
+ "description": "ANSI escape codes for styling strings in the terminal",
+ "license": "MIT",
+ "repository": "chalk/ansi-styles",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava",
+ "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "devDependencies": {
+ "ava": "*",
+ "babel-polyfill": "^6.23.0",
+ "svg-term-cli": "^2.1.1",
+ "xo": "*"
+ },
+ "ava": {
+ "require": "babel-polyfill"
+ }
+}
diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md
new file mode 100644
index 0000000..3158e2d
--- /dev/null
+++ b/node_modules/ansi-styles/readme.md
@@ -0,0 +1,147 @@
+# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
+
+> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
+
+You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
+
+<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
+
+
+## Install
+
+```
+$ npm install ansi-styles
+```
+
+
+## Usage
+
+```js
+const style = require('ansi-styles');
+
+console.log(`${style.green.open}Hello world!${style.green.close}`);
+
+
+// Color conversion between 16/256/truecolor
+// NOTE: If conversion goes to 16 colors or 256 colors, the original color
+// may be degraded to fit that color palette. This means terminals
+// that do not support 16 million colors will best-match the
+// original color.
+console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
+console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
+console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
+```
+
+## API
+
+Each style has an `open` and `close` property.
+
+
+## Styles
+
+### Modifiers
+
+- `reset`
+- `bold`
+- `dim`
+- `italic` *(Not widely supported)*
+- `underline`
+- `inverse`
+- `hidden`
+- `strikethrough` *(Not widely supported)*
+
+### Colors
+
+- `black`
+- `red`
+- `green`
+- `yellow`
+- `blue`
+- `magenta`
+- `cyan`
+- `white`
+- `gray` ("bright black")
+- `redBright`
+- `greenBright`
+- `yellowBright`
+- `blueBright`
+- `magentaBright`
+- `cyanBright`
+- `whiteBright`
+
+### Background colors
+
+- `bgBlack`
+- `bgRed`
+- `bgGreen`
+- `bgYellow`
+- `bgBlue`
+- `bgMagenta`
+- `bgCyan`
+- `bgWhite`
+- `bgBlackBright`
+- `bgRedBright`
+- `bgGreenBright`
+- `bgYellowBright`
+- `bgBlueBright`
+- `bgMagentaBright`
+- `bgCyanBright`
+- `bgWhiteBright`
+
+
+## Advanced usage
+
+By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
+
+- `style.modifier`
+- `style.color`
+- `style.bgColor`
+
+###### Example
+
+```js
+console.log(style.color.green.open);
+```
+
+Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
+
+###### Example
+
+```js
+console.log(style.codes.get(36));
+//=> 39
+```
+
+
+## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
+
+`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
+
+To use these, call the associated conversion function with the intended output, for example:
+
+```js
+style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
+style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
+
+style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
+
+style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
+style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
+```
+
+
+## Related
+
+- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
+
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+
+## License
+
+MIT
diff --git a/node_modules/array-back/LICENSE b/node_modules/array-back/LICENSE
new file mode 100644
index 0000000..203018f
--- /dev/null
+++ b/node_modules/array-back/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/array-back/README.hbs b/node_modules/array-back/README.hbs
new file mode 100644
index 0000000..dc32d2a
--- /dev/null
+++ b/node_modules/array-back/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/array-back/README.md b/node_modules/array-back/README.md
new file mode 100644
index 0000000..9860b1c
--- /dev/null
+++ b/node_modules/array-back/README.md
@@ -0,0 +1,81 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_array-back"></a>
+
+## array-back
+Takes any input and guarantees an array back.
+
+- Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+- Converts `undefined` to an empty array.
+- Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+- Ignores input which is already an array.
+
+**Example**
+```js
+> const arrayify = require('array-back')
+
+> arrayify(undefined)
+[]
+
+> arrayify(null)
+[ null ]
+
+> arrayify(0)
+[ 0 ]
+
+> arrayify([ 1, 2 ])
+[ 1, 2 ]
+
+> arrayify(new Set([ 1, 2 ]))
+[ 1, 2 ]
+
+> function f(){ return arrayify(arguments); }
+> f(1,2,3)
+[ 1, 2, 3 ]
+```
+<a name="exp_module_array-back--arrayify"></a>
+
+### arrayify(input) ⇒ <code>Array</code> ⏏
+**Kind**: Exported function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | The input value to convert to an array |
+
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/array-back/dist/index.js b/node_modules/array-back/dist/index.js
new file mode 100644
index 0000000..0848d2d
--- /dev/null
+++ b/node_modules/array-back/dist/index.js
@@ -0,0 +1,70 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.arrayBack = factory());
+}(this, function () { 'use strict';
+
+ /**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+ function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [ input ]
+ }
+
+ return arrayify;
+
+}));
diff --git a/node_modules/array-back/index.mjs b/node_modules/array-back/index.mjs
new file mode 100644
index 0000000..d937eba
--- /dev/null
+++ b/node_modules/array-back/index.mjs
@@ -0,0 +1,62 @@
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [ input ]
+}
+
+export default arrayify
diff --git a/node_modules/array-back/package.json b/node_modules/array-back/package.json
new file mode 100644
index 0000000..787cac0
--- /dev/null
+++ b/node_modules/array-back/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "array-back",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "3.1.0",
+ "description": "Guarantees an array back",
+ "repository": "https://github.com/75lb/array-back.git",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "to",
+ "convert",
+ "return",
+ "array",
+ "arrayify"
+ ],
+ "engines": {
+ "node": ">=6"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ],
+ "scripts": {
+ "test": "npm run test:esm && npm run test:js",
+ "test:esm": "node --experimental-modules test.mjs",
+ "test:js": "npm run dist:test && node dist/test.js",
+ "docs": "jsdoc2md -t README.hbs index.mjs -c build/jsdoc.conf > README.md; echo",
+ "cover": "nyc test-runner test.js && nyc report --reporter=text-lcov | coveralls",
+ "dist": "rollup -c build/index.config.js",
+ "dist:test": "rollup -c build/test.config.js",
+ "lint": "standard **/*.mjs"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "coveralls": "^3.0.3",
+ "jsdoc-to-markdown": "^4.0.1",
+ "rollup": "^1.9.0",
+ "test-runner": "^0.5.1"
+ },
+ "standard": {
+ "ignore": [
+ "dist",
+ "build"
+ ]
+ }
+}
diff --git a/node_modules/chalk/index.js b/node_modules/chalk/index.js
new file mode 100644
index 0000000..1cc5fa8
--- /dev/null
+++ b/node_modules/chalk/index.js
@@ -0,0 +1,228 @@
+'use strict';
+const escapeStringRegexp = require('escape-string-regexp');
+const ansiStyles = require('ansi-styles');
+const stdoutColor = require('supports-color').stdout;
+
+const template = require('./templates.js');
+
+const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
+
+// `supportsColor.level` → `ansiStyles.color[name]` mapping
+const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
+
+// `color-convert` models to exclude from the Chalk API due to conflicts and such
+const skipModels = new Set(['gray']);
+
+const styles = Object.create(null);
+
+function applyOptions(obj, options) {
+ options = options || {};
+
+ // Detect level if not set manually
+ const scLevel = stdoutColor ? stdoutColor.level : 0;
+ obj.level = options.level === undefined ? scLevel : options.level;
+ obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
+}
+
+function Chalk(options) {
+ // We check for this.template here since calling `chalk.constructor()`
+ // by itself will have a `this` of a previously constructed chalk object
+ if (!this || !(this instanceof Chalk) || this.template) {
+ const chalk = {};
+ applyOptions(chalk, options);
+
+ chalk.template = function () {
+ const args = [].slice.call(arguments);
+ return chalkTag.apply(null, [chalk.template].concat(args));
+ };
+
+ Object.setPrototypeOf(chalk, Chalk.prototype);
+ Object.setPrototypeOf(chalk.template, chalk);
+
+ chalk.template.constructor = Chalk;
+
+ return chalk.template;
+ }
+
+ applyOptions(this, options);
+}
+
+// Use bright blue on Windows as the normal blue color is illegible
+if (isSimpleWindowsTerm) {
+ ansiStyles.blue.open = '\u001B[94m';
+}
+
+for (const key of Object.keys(ansiStyles)) {
+ ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
+
+ styles[key] = {
+ get() {
+ const codes = ansiStyles[key];
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
+ }
+ };
+}
+
+styles.visible = {
+ get() {
+ return build.call(this, this._styles || [], true, 'visible');
+ }
+};
+
+ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
+for (const model of Object.keys(ansiStyles.color.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ styles[model] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.color.close,
+ closeRe: ansiStyles.color.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
+for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
+ styles[bgModel] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.bgColor.close,
+ closeRe: ansiStyles.bgColor.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+const proto = Object.defineProperties(() => {}, styles);
+
+function build(_styles, _empty, key) {
+ const builder = function () {
+ return applyStyle.apply(builder, arguments);
+ };
+
+ builder._styles = _styles;
+ builder._empty = _empty;
+
+ const self = this;
+
+ Object.defineProperty(builder, 'level', {
+ enumerable: true,
+ get() {
+ return self.level;
+ },
+ set(level) {
+ self.level = level;
+ }
+ });
+
+ Object.defineProperty(builder, 'enabled', {
+ enumerable: true,
+ get() {
+ return self.enabled;
+ },
+ set(enabled) {
+ self.enabled = enabled;
+ }
+ });
+
+ // See below for fix regarding invisible grey/dim combination on Windows
+ builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
+
+ // `__proto__` is used because we must return a function, but there is
+ // no way to create a function with a different prototype
+ builder.__proto__ = proto; // eslint-disable-line no-proto
+
+ return builder;
+}
+
+function applyStyle() {
+ // Support varags, but simply cast to string in case there's only one arg
+ const args = arguments;
+ const argsLen = args.length;
+ let str = String(arguments[0]);
+
+ if (argsLen === 0) {
+ return '';
+ }
+
+ if (argsLen > 1) {
+ // Don't slice `arguments`, it prevents V8 optimizations
+ for (let a = 1; a < argsLen; a++) {
+ str += ' ' + args[a];
+ }
+ }
+
+ if (!this.enabled || this.level <= 0 || !str) {
+ return this._empty ? '' : str;
+ }
+
+ // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
+ // see https://github.com/chalk/chalk/issues/58
+ // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
+ const originalDim = ansiStyles.dim.open;
+ if (isSimpleWindowsTerm && this.hasGrey) {
+ ansiStyles.dim.open = '';
+ }
+
+ for (const code of this._styles.slice().reverse()) {
+ // Replace any instances already present with a re-opening code
+ // otherwise only the part of the string until said closing code
+ // will be colored, and the rest will simply be 'plain'.
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
+
+ // Close the styling before a linebreak and reopen
+ // after next line to fix a bleed issue on macOS
+ // https://github.com/chalk/chalk/pull/92
+ str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
+ }
+
+ // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
+ ansiStyles.dim.open = originalDim;
+
+ return str;
+}
+
+function chalkTag(chalk, strings) {
+ if (!Array.isArray(strings)) {
+ // If chalk() was called by itself or with a string,
+ // return the string itself as a string.
+ return [].slice.call(arguments, 1).join(' ');
+ }
+
+ const args = [].slice.call(arguments, 2);
+ const parts = [strings.raw[0]];
+
+ for (let i = 1; i < strings.length; i++) {
+ parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
+ parts.push(String(strings.raw[i]));
+ }
+
+ return template(chalk, parts.join(''));
+}
+
+Object.defineProperties(Chalk.prototype, styles);
+
+module.exports = Chalk(); // eslint-disable-line new-cap
+module.exports.supportsColor = stdoutColor;
+module.exports.default = module.exports; // For TypeScript
diff --git a/node_modules/chalk/index.js.flow b/node_modules/chalk/index.js.flow
new file mode 100644
index 0000000..622caaa
--- /dev/null
+++ b/node_modules/chalk/index.js.flow
@@ -0,0 +1,93 @@
+// @flow strict
+
+type TemplateStringsArray = $ReadOnlyArray<string>;
+
+export type Level = $Values<{
+ None: 0,
+ Basic: 1,
+ Ansi256: 2,
+ TrueColor: 3
+}>;
+
+export type ChalkOptions = {|
+ enabled?: boolean,
+ level?: Level
+|};
+
+export type ColorSupport = {|
+ level: Level,
+ hasBasic: boolean,
+ has256: boolean,
+ has16m: boolean
+|};
+
+export interface Chalk {
+ (...text: string[]): string,
+ (text: TemplateStringsArray, ...placeholders: string[]): string,
+ constructor(options?: ChalkOptions): Chalk,
+ enabled: boolean,
+ level: Level,
+ rgb(r: number, g: number, b: number): Chalk,
+ hsl(h: number, s: number, l: number): Chalk,
+ hsv(h: number, s: number, v: number): Chalk,
+ hwb(h: number, w: number, b: number): Chalk,
+ bgHex(color: string): Chalk,
+ bgKeyword(color: string): Chalk,
+ bgRgb(r: number, g: number, b: number): Chalk,
+ bgHsl(h: number, s: number, l: number): Chalk,
+ bgHsv(h: number, s: number, v: number): Chalk,
+ bgHwb(h: number, w: number, b: number): Chalk,
+ hex(color: string): Chalk,
+ keyword(color: string): Chalk,
+
+ +reset: Chalk,
+ +bold: Chalk,
+ +dim: Chalk,
+ +italic: Chalk,
+ +underline: Chalk,
+ +inverse: Chalk,
+ +hidden: Chalk,
+ +strikethrough: Chalk,
+
+ +visible: Chalk,
+
+ +black: Chalk,
+ +red: Chalk,
+ +green: Chalk,
+ +yellow: Chalk,
+ +blue: Chalk,
+ +magenta: Chalk,
+ +cyan: Chalk,
+ +white: Chalk,
+ +gray: Chalk,
+ +grey: Chalk,
+ +blackBright: Chalk,
+ +redBright: Chalk,
+ +greenBright: Chalk,
+ +yellowBright: Chalk,
+ +blueBright: Chalk,
+ +magentaBright: Chalk,
+ +cyanBright: Chalk,
+ +whiteBright: Chalk,
+
+ +bgBlack: Chalk,
+ +bgRed: Chalk,
+ +bgGreen: Chalk,
+ +bgYellow: Chalk,
+ +bgBlue: Chalk,
+ +bgMagenta: Chalk,
+ +bgCyan: Chalk,
+ +bgWhite: Chalk,
+ +bgBlackBright: Chalk,
+ +bgRedBright: Chalk,
+ +bgGreenBright: Chalk,
+ +bgYellowBright: Chalk,
+ +bgBlueBright: Chalk,
+ +bgMagentaBright: Chalk,
+ +bgCyanBright: Chalk,
+ +bgWhiteBrigh: Chalk,
+
+ supportsColor: ColorSupport
+};
+
+declare module.exports: Chalk;
diff --git a/node_modules/chalk/license b/node_modules/chalk/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/chalk/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/chalk/node_modules/escape-string-regexp/index.js b/node_modules/chalk/node_modules/escape-string-regexp/index.js
new file mode 100644
index 0000000..7834bf9
--- /dev/null
+++ b/node_modules/chalk/node_modules/escape-string-regexp/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+
+module.exports = function (str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return str.replace(matchOperatorsRe, '\\$&');
+};
diff --git a/node_modules/chalk/node_modules/escape-string-regexp/license b/node_modules/chalk/node_modules/escape-string-regexp/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/node_modules/chalk/node_modules/escape-string-regexp/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/chalk/node_modules/escape-string-regexp/package.json b/node_modules/chalk/node_modules/escape-string-regexp/package.json
new file mode 100644
index 0000000..f307df3
--- /dev/null
+++ b/node_modules/chalk/node_modules/escape-string-regexp/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "escape-string-regexp",
+ "version": "1.0.5",
+ "description": "Escape RegExp special characters",
+ "license": "MIT",
+ "repository": "sindresorhus/escape-string-regexp",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "maintainers": [
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
+ "Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
+ ],
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "escape",
+ "regex",
+ "regexp",
+ "re",
+ "regular",
+ "expression",
+ "string",
+ "str",
+ "special",
+ "characters"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/node_modules/chalk/node_modules/escape-string-regexp/readme.md b/node_modules/chalk/node_modules/escape-string-regexp/readme.md
new file mode 100644
index 0000000..87ac82d
--- /dev/null
+++ b/node_modules/chalk/node_modules/escape-string-regexp/readme.md
@@ -0,0 +1,27 @@
+# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
+
+> Escape RegExp special characters
+
+
+## Install
+
+```
+$ npm install --save escape-string-regexp
+```
+
+
+## Usage
+
+```js
+const escapeStringRegexp = require('escape-string-regexp');
+
+const escapedString = escapeStringRegexp('how much $ for a unicorn?');
+//=> 'how much \$ for a unicorn\?'
+
+new RegExp(escapedString);
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/node_modules/chalk/package.json b/node_modules/chalk/package.json
new file mode 100644
index 0000000..bc32468
--- /dev/null
+++ b/node_modules/chalk/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "chalk",
+ "version": "2.4.2",
+ "description": "Terminal string styling done right",
+ "license": "MIT",
+ "repository": "chalk/chalk",
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
+ "bench": "matcha benchmark.js",
+ "coveralls": "nyc report --reporter=text-lcov | coveralls"
+ },
+ "files": [
+ "index.js",
+ "templates.js",
+ "types/index.d.ts",
+ "index.js.flow"
+ ],
+ "keywords": [
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "str",
+ "ansi",
+ "style",
+ "styles",
+ "tty",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "devDependencies": {
+ "ava": "*",
+ "coveralls": "^3.0.0",
+ "execa": "^0.9.0",
+ "flow-bin": "^0.68.0",
+ "import-fresh": "^2.0.0",
+ "matcha": "^0.7.0",
+ "nyc": "^11.0.2",
+ "resolve-from": "^4.0.0",
+ "typescript": "^2.5.3",
+ "xo": "*"
+ },
+ "types": "types/index.d.ts",
+ "xo": {
+ "envs": [
+ "node",
+ "mocha"
+ ],
+ "ignores": [
+ "test/_flow.js"
+ ]
+ }
+}
diff --git a/node_modules/chalk/readme.md b/node_modules/chalk/readme.md
new file mode 100644
index 0000000..d298e2c
--- /dev/null
+++ b/node_modules/chalk/readme.md
@@ -0,0 +1,314 @@
+<h1 align="center">
+ <br>
+ <br>
+ <img width="320" src="media/logo.svg" alt="Chalk">
+ <br>
+ <br>
+ <br>
+</h1>
+
+> Terminal string styling done right
+
+[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
+
+### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
+
+<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
+
+
+## Highlights
+
+- Expressive API
+- Highly performant
+- Ability to nest styles
+- [256/Truecolor color support](#256-and-truecolor-color-support)
+- Auto-detects color support
+- Doesn't extend `String.prototype`
+- Clean and focused
+- Actively maintained
+- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
+
+
+## Install
+
+```console
+$ npm install chalk
+```
+
+<a href="https://www.patreon.com/sindresorhus">
+ <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
+</a>
+
+
+## Usage
+
+```js
+const chalk = require('chalk');
+
+console.log(chalk.blue('Hello world!'));
+```
+
+Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
+
+```js
+const chalk = require('chalk');
+const log = console.log;
+
+// Combine styled and normal strings
+log(chalk.blue('Hello') + ' World' + chalk.red('!'));
+
+// Compose multiple styles using the chainable API
+log(chalk.blue.bgRed.bold('Hello world!'));
+
+// Pass in multiple arguments
+log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
+
+// Nest styles
+log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
+
+// Nest styles of the same type even (color, underline, background)
+log(chalk.green(
+ 'I am a green line ' +
+ chalk.blue.underline.bold('with a blue substring') +
+ ' that becomes green again!'
+));
+
+// ES2015 template literal
+log(`
+CPU: ${chalk.red('90%')}
+RAM: ${chalk.green('40%')}
+DISK: ${chalk.yellow('70%')}
+`);
+
+// ES2015 tagged template literal
+log(chalk`
+CPU: {red ${cpu.totalPercent}%}
+RAM: {green ${ram.used / ram.total * 100}%}
+DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
+`);
+
+// Use RGB colors in terminal emulators that support it.
+log(chalk.keyword('orange')('Yay for orange colored text!'));
+log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
+log(chalk.hex('#DEADED').bold('Bold gray!'));
+```
+
+Easily define your own themes:
+
+```js
+const chalk = require('chalk');
+
+const error = chalk.bold.red;
+const warning = chalk.keyword('orange');
+
+console.log(error('Error!'));
+console.log(warning('Warning!'));
+```
+
+Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
+
+```js
+const name = 'Sindre';
+console.log(chalk.green('Hello %s'), name);
+//=> 'Hello Sindre'
+```
+
+
+## API
+
+### chalk.`<style>[.<style>...](string, [string...])`
+
+Example: `chalk.red.bold.underline('Hello', 'world');`
+
+Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
+
+Multiple arguments will be separated by space.
+
+### chalk.enabled
+
+Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
+
+Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
+
+If you need to change this in a reusable module, create a new instance:
+
+```js
+const ctx = new chalk.constructor({enabled: false});
+```
+
+### chalk.level
+
+Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
+
+If you need to change this in a reusable module, create a new instance:
+
+```js
+const ctx = new chalk.constructor({level: 0});
+```
+
+Levels are as follows:
+
+0. All colors disabled
+1. Basic color support (16 colors)
+2. 256 color support
+3. Truecolor support (16 million colors)
+
+### chalk.supportsColor
+
+Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
+
+Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
+
+Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
+
+
+## Styles
+
+### Modifiers
+
+- `reset`
+- `bold`
+- `dim`
+- `italic` *(Not widely supported)*
+- `underline`
+- `inverse`
+- `hidden`
+- `strikethrough` *(Not widely supported)*
+- `visible` (Text is emitted only if enabled)
+
+### Colors
+
+- `black`
+- `red`
+- `green`
+- `yellow`
+- `blue` *(On Windows the bright version is used since normal blue is illegible)*
+- `magenta`
+- `cyan`
+- `white`
+- `gray` ("bright black")
+- `redBright`
+- `greenBright`
+- `yellowBright`
+- `blueBright`
+- `magentaBright`
+- `cyanBright`
+- `whiteBright`
+
+### Background colors
+
+- `bgBlack`
+- `bgRed`
+- `bgGreen`
+- `bgYellow`
+- `bgBlue`
+- `bgMagenta`
+- `bgCyan`
+- `bgWhite`
+- `bgBlackBright`
+- `bgRedBright`
+- `bgGreenBright`
+- `bgYellowBright`
+- `bgBlueBright`
+- `bgMagentaBright`
+- `bgCyanBright`
+- `bgWhiteBright`
+
+
+## Tagged template literal
+
+Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
+
+```js
+const chalk = require('chalk');
+
+const miles = 18;
+const calculateFeet = miles => miles * 5280;
+
+console.log(chalk`
+ There are {bold 5280 feet} in a mile.
+ In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
+`);
+```
+
+Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
+
+Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
+
+```js
+console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
+console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
+```
+
+Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
+
+All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
+
+
+## 256 and Truecolor color support
+
+Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
+
+Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
+
+Examples:
+
+- `chalk.hex('#DEADED').underline('Hello, world!')`
+- `chalk.keyword('orange')('Some orange text')`
+- `chalk.rgb(15, 100, 204).inverse('Hello!')`
+
+Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
+
+- `chalk.bgHex('#DEADED').underline('Hello, world!')`
+- `chalk.bgKeyword('orange')('Some orange text')`
+- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
+
+The following color models can be used:
+
+- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
+- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
+- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
+- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
+- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
+- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
+- `ansi16`
+- `ansi256`
+
+
+## Windows
+
+If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
+
+
+## Origin story
+
+[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
+
+
+## Related
+
+- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
+- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
+- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
+- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
+- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
+- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
+- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
+- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
+- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
+- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
+- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
+- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
+- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
+- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
+
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+
+## License
+
+MIT
diff --git a/node_modules/chalk/templates.js b/node_modules/chalk/templates.js
new file mode 100644
index 0000000..dbdf9b2
--- /dev/null
+++ b/node_modules/chalk/templates.js
@@ -0,0 +1,128 @@
+'use strict';
+const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
+const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
+const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
+const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
+
+const ESCAPES = new Map([
+ ['n', '\n'],
+ ['r', '\r'],
+ ['t', '\t'],
+ ['b', '\b'],
+ ['f', '\f'],
+ ['v', '\v'],
+ ['0', '\0'],
+ ['\\', '\\'],
+ ['e', '\u001B'],
+ ['a', '\u0007']
+]);
+
+function unescape(c) {
+ if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
+ return String.fromCharCode(parseInt(c.slice(1), 16));
+ }
+
+ return ESCAPES.get(c) || c;
+}
+
+function parseArguments(name, args) {
+ const results = [];
+ const chunks = args.trim().split(/\s*,\s*/g);
+ let matches;
+
+ for (const chunk of chunks) {
+ if (!isNaN(chunk)) {
+ results.push(Number(chunk));
+ } else if ((matches = chunk.match(STRING_REGEX))) {
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
+ } else {
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
+ }
+ }
+
+ return results;
+}
+
+function parseStyle(style) {
+ STYLE_REGEX.lastIndex = 0;
+
+ const results = [];
+ let matches;
+
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
+ const name = matches[1];
+
+ if (matches[2]) {
+ const args = parseArguments(name, matches[2]);
+ results.push([name].concat(args));
+ } else {
+ results.push([name]);
+ }
+ }
+
+ return results;
+}
+
+function buildStyle(chalk, styles) {
+ const enabled = {};
+
+ for (const layer of styles) {
+ for (const style of layer.styles) {
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
+ }
+ }
+
+ let current = chalk;
+ for (const styleName of Object.keys(enabled)) {
+ if (Array.isArray(enabled[styleName])) {
+ if (!(styleName in current)) {
+ throw new Error(`Unknown Chalk style: ${styleName}`);
+ }
+
+ if (enabled[styleName].length > 0) {
+ current = current[styleName].apply(current, enabled[styleName]);
+ } else {
+ current = current[styleName];
+ }
+ }
+ }
+
+ return current;
+}
+
+module.exports = (chalk, tmp) => {
+ const styles = [];
+ const chunks = [];
+ let chunk = [];
+
+ // eslint-disable-next-line max-params
+ tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
+ if (escapeChar) {
+ chunk.push(unescape(escapeChar));
+ } else if (style) {
+ const str = chunk.join('');
+ chunk = [];
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
+ styles.push({inverse, styles: parseStyle(style)});
+ } else if (close) {
+ if (styles.length === 0) {
+ throw new Error('Found extraneous } in Chalk template literal');
+ }
+
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
+ chunk = [];
+ styles.pop();
+ } else {
+ chunk.push(chr);
+ }
+ });
+
+ chunks.push(chunk.join(''));
+
+ if (styles.length > 0) {
+ const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
+ throw new Error(errMsg);
+ }
+
+ return chunks.join('');
+};
diff --git a/node_modules/chalk/types/index.d.ts b/node_modules/chalk/types/index.d.ts
new file mode 100644
index 0000000..b4e4dc5
--- /dev/null
+++ b/node_modules/chalk/types/index.d.ts
@@ -0,0 +1,97 @@
+// Type definitions for Chalk
+// Definitions by: Thomas Sauer <https://github.com/t-sauer>
+
+export const enum Level {
+ None = 0,
+ Basic = 1,
+ Ansi256 = 2,
+ TrueColor = 3
+}
+
+export interface ChalkOptions {
+ enabled?: boolean;
+ level?: Level;
+}
+
+export interface ChalkConstructor {
+ new (options?: ChalkOptions): Chalk;
+ (options?: ChalkOptions): Chalk;
+}
+
+export interface ColorSupport {
+ level: Level;
+ hasBasic: boolean;
+ has256: boolean;
+ has16m: boolean;
+}
+
+export interface Chalk {
+ (...text: string[]): string;
+ (text: TemplateStringsArray, ...placeholders: string[]): string;
+ constructor: ChalkConstructor;
+ enabled: boolean;
+ level: Level;
+ rgb(r: number, g: number, b: number): this;
+ hsl(h: number, s: number, l: number): this;
+ hsv(h: number, s: number, v: number): this;
+ hwb(h: number, w: number, b: number): this;
+ bgHex(color: string): this;
+ bgKeyword(color: string): this;
+ bgRgb(r: number, g: number, b: number): this;
+ bgHsl(h: number, s: number, l: number): this;
+ bgHsv(h: number, s: number, v: number): this;
+ bgHwb(h: number, w: number, b: number): this;
+ hex(color: string): this;
+ keyword(color: string): this;
+
+ readonly reset: this;
+ readonly bold: this;
+ readonly dim: this;
+ readonly italic: this;
+ readonly underline: this;
+ readonly inverse: this;
+ readonly hidden: this;
+ readonly strikethrough: this;
+
+ readonly visible: this;
+
+ readonly black: this;
+ readonly red: this;
+ readonly green: this;
+ readonly yellow: this;
+ readonly blue: this;
+ readonly magenta: this;
+ readonly cyan: this;
+ readonly white: this;
+ readonly gray: this;
+ readonly grey: this;
+ readonly blackBright: this;
+ readonly redBright: this;
+ readonly greenBright: this;
+ readonly yellowBright: this;
+ readonly blueBright: this;
+ readonly magentaBright: this;
+ readonly cyanBright: this;
+ readonly whiteBright: this;
+
+ readonly bgBlack: this;
+ readonly bgRed: this;
+ readonly bgGreen: this;
+ readonly bgYellow: this;
+ readonly bgBlue: this;
+ readonly bgMagenta: this;
+ readonly bgCyan: this;
+ readonly bgWhite: this;
+ readonly bgBlackBright: this;
+ readonly bgRedBright: this;
+ readonly bgGreenBright: this;
+ readonly bgYellowBright: this;
+ readonly bgBlueBright: this;
+ readonly bgMagentaBright: this;
+ readonly bgCyanBright: this;
+ readonly bgWhiteBright: this;
+}
+
+declare const chalk: Chalk & { supportsColor: ColorSupport };
+
+export default chalk
diff --git a/node_modules/color-convert/CHANGELOG.md b/node_modules/color-convert/CHANGELOG.md
new file mode 100644
index 0000000..0a7bce4
--- /dev/null
+++ b/node_modules/color-convert/CHANGELOG.md
@@ -0,0 +1,54 @@
+# 1.0.0 - 2016-01-07
+
+- Removed: unused speed test
+- Added: Automatic routing between previously unsupported conversions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `convert()` class
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: all functions to lookup dictionary
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: `ansi` to `ansi256`
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Fixed: argument grouping for functions requiring only one argument
+([#27](https://github.com/Qix-/color-convert/pull/27))
+
+# 0.6.0 - 2015-07-23
+
+- Added: methods to handle
+[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
+ - rgb2ansi16
+ - rgb2ansi
+ - hsl2ansi16
+ - hsl2ansi
+ - hsv2ansi16
+ - hsv2ansi
+ - hwb2ansi16
+ - hwb2ansi
+ - cmyk2ansi16
+ - cmyk2ansi
+ - keyword2ansi16
+ - keyword2ansi
+ - ansi162rgb
+ - ansi162hsl
+ - ansi162hsv
+ - ansi162hwb
+ - ansi162cmyk
+ - ansi162keyword
+ - ansi2rgb
+ - ansi2hsl
+ - ansi2hsv
+ - ansi2hwb
+ - ansi2cmyk
+ - ansi2keyword
+([#18](https://github.com/harthur/color-convert/pull/18))
+
+# 0.5.3 - 2015-06-02
+
+- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
+([#15](https://github.com/harthur/color-convert/issues/15))
+
+---
+
+Check out commit logs for older releases
diff --git a/node_modules/color-convert/LICENSE b/node_modules/color-convert/LICENSE
new file mode 100644
index 0000000..5b4c386
--- /dev/null
+++ b/node_modules/color-convert/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/node_modules/color-convert/README.md b/node_modules/color-convert/README.md
new file mode 100644
index 0000000..d4b08fc
--- /dev/null
+++ b/node_modules/color-convert/README.md
@@ -0,0 +1,68 @@
+# color-convert
+
+[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert)
+
+Color-convert is a color conversion library for JavaScript and node.
+It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
+convert.keyword.rgb('blue'); // [0, 0, 255]
+
+var rgbChannels = convert.rgb.channels; // 3
+var cmykChannels = convert.cmyk.channels; // 4
+var ansiChannels = convert.ansi16.channels; // 1
+```
+
+# Install
+
+```console
+$ npm install color-convert
+```
+
+# API
+
+Simply get the property of the _from_ and _to_ conversion that you're looking for.
+
+All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
+
+All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
+
+```js
+var convert = require('color-convert');
+
+// Hex to LAB
+convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
+convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
+
+// RGB to CMYK
+convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
+convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
+```
+
+### Arrays
+All functions that accept multiple arguments also support passing an array.
+
+Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hex(123, 45, 67); // '7B2D43'
+convert.rgb.hex([123, 45, 67]); // '7B2D43'
+```
+
+## Routing
+
+Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
+
+Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
+
+# Contribute
+
+If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
+
+# License
+Copyright &copy; 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
diff --git a/node_modules/color-convert/conversions.js b/node_modules/color-convert/conversions.js
new file mode 100644
index 0000000..3217200
--- /dev/null
+++ b/node_modules/color-convert/conversions.js
@@ -0,0 +1,868 @@
+/* MIT license */
+var cssKeywords = require('color-name');
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+var reverseKeywords = {};
+for (var key in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(key)) {
+ reverseKeywords[cssKeywords[key]] = key;
+ }
+}
+
+var convert = module.exports = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+// hide .channels and .labels properties
+for (var model in convert) {
+ if (convert.hasOwnProperty(model)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ var channels = convert[model].channels;
+ var labels = convert[model].labels;
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+ }
+}
+
+convert.rgb.hsl = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var min = Math.min(r, g, b);
+ var max = Math.max(r, g, b);
+ var delta = max - min;
+ var h;
+ var s;
+ var l;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ var rdif;
+ var gdif;
+ var bdif;
+ var h;
+ var s;
+
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var v = Math.max(r, g, b);
+ var diff = v - Math.min(r, g, b);
+ var diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ var r = rgb[0];
+ var g = rgb[1];
+ var b = rgb[2];
+ var h = convert.rgb.hsl(rgb)[0];
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var c;
+ var m;
+ var y;
+ var k;
+
+ k = Math.min(1 - r, 1 - g, 1 - b);
+ c = (1 - r - k) / (1 - k) || 0;
+ m = (1 - g - k) / (1 - k) || 0;
+ y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+/**
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ * */
+function comparativeDistance(x, y) {
+ return (
+ Math.pow(x[0] - y[0], 2) +
+ Math.pow(x[1] - y[1], 2) +
+ Math.pow(x[2] - y[2], 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ var reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ var currentClosestDistance = Infinity;
+ var currentClosestKeyword;
+
+ for (var keyword in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(keyword)) {
+ var value = cssKeywords[keyword];
+
+ // Compute comparative distance
+ var distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return cssKeywords[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+
+ // assume sRGB
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
+
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ var xyz = convert.rgb.xyz(rgb);
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ var h = hsl[0] / 360;
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var t1;
+ var t2;
+ var t3;
+ var rgb;
+ var val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ t1 = 2 * l - t2;
+
+ rgb = [0, 0, 0];
+ for (var i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ var h = hsl[0];
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var smin = s;
+ var lmin = Math.max(l, 0.01);
+ var sv;
+ var v;
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ v = (l + s) / 2;
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ var h = hsv[0] / 60;
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var hi = Math.floor(h) % 6;
+
+ var f = h - Math.floor(h);
+ var p = 255 * v * (1 - s);
+ var q = 255 * v * (1 - (s * f));
+ var t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ var h = hsv[0];
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var vmin = Math.max(v, 0.01);
+ var lmin;
+ var sl;
+ var l;
+
+ l = (2 - s) * v;
+ lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ var h = hwb[0] / 360;
+ var wh = hwb[1] / 100;
+ var bl = hwb[2] / 100;
+ var ratio = wh + bl;
+ var i;
+ var v;
+ var f;
+ var n;
+
+ // wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ i = Math.floor(6 * h);
+ v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ n = wh + f * (v - wh); // linear interpolation
+
+ var r;
+ var g;
+ var b;
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ var c = cmyk[0] / 100;
+ var m = cmyk[1] / 100;
+ var y = cmyk[2] / 100;
+ var k = cmyk[3] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = 1 - Math.min(1, c * (1 - k) + k);
+ g = 1 - Math.min(1, m * (1 - k) + k);
+ b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ var x = xyz[0] / 100;
+ var y = xyz[1] / 100;
+ var z = xyz[2] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var x;
+ var y;
+ var z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ var y2 = Math.pow(y, 3);
+ var x2 = Math.pow(x, 3);
+ var z2 = Math.pow(z, 3);
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var hr;
+ var h;
+ var c;
+
+ hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ var l = lch[0];
+ var c = lch[1];
+ var h = lch[2];
+ var a;
+ var b;
+ var hr;
+
+ hr = h / 360 * 2 * Math.PI;
+ a = c * Math.cos(hr);
+ b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ var ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+
+ // we use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ var ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ var color = args % 10;
+
+ // handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ var mult = (~~(args > 50) + 1) * 0.5;
+ var r = ((color & 1) * mult) * 255;
+ var g = (((color >> 1) & 1) * mult) * 255;
+ var b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // handle greyscale
+ if (args >= 232) {
+ var c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ var rem;
+ var r = Math.floor(args / 36) / 5 * 255;
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ var b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ var colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(function (char) {
+ return char + char;
+ }).join('');
+ }
+
+ var integer = parseInt(colorString, 16);
+ var r = (integer >> 16) & 0xFF;
+ var g = (integer >> 8) & 0xFF;
+ var b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var max = Math.max(Math.max(r, g), b);
+ var min = Math.min(Math.min(r, g), b);
+ var chroma = (max - min);
+ var grayscale;
+ var hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma + 4;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var c = 1;
+ var f = 0;
+
+ if (l < 0.5) {
+ c = 2.0 * s * l;
+ } else {
+ c = 2.0 * s * (1.0 - l);
+ }
+
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+
+ var c = s * v;
+ var f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ var h = hcg[0] / 360;
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ var pure = [0, 0, 0];
+ var hi = (h % 1) * 6;
+ var v = hi % 1;
+ var w = 1 - v;
+ var mg = 0;
+
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var v = c + g * (1.0 - c);
+ var f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var l = g * (1.0 - c) + 0.5 * c;
+ var s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+ var v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ var w = hwb[1] / 100;
+ var b = hwb[2] / 100;
+ var v = 1 - b;
+ var c = v - w;
+ var g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = convert.gray.hsv = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ var integer = (val << 16) + (val << 8) + val;
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
diff --git a/node_modules/color-convert/index.js b/node_modules/color-convert/index.js
new file mode 100644
index 0000000..e65b5d7
--- /dev/null
+++ b/node_modules/color-convert/index.js
@@ -0,0 +1,78 @@
+var conversions = require('./conversions');
+var route = require('./route');
+
+var convert = {};
+
+var models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ return fn(args);
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ var result = fn(args);
+
+ // we're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (var len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(function (fromModel) {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ var routes = route(fromModel);
+ var routeModels = Object.keys(routes);
+
+ routeModels.forEach(function (toModel) {
+ var fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+module.exports = convert;
diff --git a/node_modules/color-convert/package.json b/node_modules/color-convert/package.json
new file mode 100644
index 0000000..dfbc471
--- /dev/null
+++ b/node_modules/color-convert/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "color-convert",
+ "description": "Plain color conversion functions",
+ "version": "1.9.3",
+ "author": "Heather Arthur <fayearthur@gmail.com>",
+ "license": "MIT",
+ "repository": "Qix-/color-convert",
+ "scripts": {
+ "pretest": "xo",
+ "test": "node test/basic.js"
+ },
+ "keywords": [
+ "color",
+ "colour",
+ "convert",
+ "converter",
+ "conversion",
+ "rgb",
+ "hsl",
+ "hsv",
+ "hwb",
+ "cmyk",
+ "ansi",
+ "ansi16"
+ ],
+ "files": [
+ "index.js",
+ "conversions.js",
+ "css-keywords.js",
+ "route.js"
+ ],
+ "xo": {
+ "rules": {
+ "default-case": 0,
+ "no-inline-comments": 0,
+ "operator-linebreak": 0
+ }
+ },
+ "devDependencies": {
+ "chalk": "1.1.1",
+ "xo": "0.11.2"
+ },
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+}
diff --git a/node_modules/color-convert/route.js b/node_modules/color-convert/route.js
new file mode 100644
index 0000000..0a1fdea
--- /dev/null
+++ b/node_modules/color-convert/route.js
@@ -0,0 +1,97 @@
+var conversions = require('./conversions');
+
+/*
+ this function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ var graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ var models = Object.keys(conversions);
+
+ for (var len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ var graph = buildGraph();
+ var queue = [fromModel]; // unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ var current = queue.pop();
+ var adjacents = Object.keys(conversions[current]);
+
+ for (var len = adjacents.length, i = 0; i < len; i++) {
+ var adjacent = adjacents[i];
+ var node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ var path = [graph[toModel].parent, toModel];
+ var fn = conversions[graph[toModel].parent][toModel];
+
+ var cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+module.exports = function (fromModel) {
+ var graph = deriveBFS(fromModel);
+ var conversion = {};
+
+ var models = Object.keys(graph);
+ for (var len = models.length, i = 0; i < len; i++) {
+ var toModel = models[i];
+ var node = graph[toModel];
+
+ if (node.parent === null) {
+ // no possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
diff --git a/node_modules/color-name/.eslintrc.json b/node_modules/color-name/.eslintrc.json
new file mode 100644
index 0000000..c50c250
--- /dev/null
+++ b/node_modules/color-name/.eslintrc.json
@@ -0,0 +1,43 @@
+{
+ "env": {
+ "browser": true,
+ "node": true,
+ "commonjs": true,
+ "es6": true
+ },
+ "extends": "eslint:recommended",
+ "rules": {
+ "strict": 2,
+ "indent": 0,
+ "linebreak-style": 0,
+ "quotes": 0,
+ "semi": 0,
+ "no-cond-assign": 1,
+ "no-constant-condition": 1,
+ "no-duplicate-case": 1,
+ "no-empty": 1,
+ "no-ex-assign": 1,
+ "no-extra-boolean-cast": 1,
+ "no-extra-semi": 1,
+ "no-fallthrough": 1,
+ "no-func-assign": 1,
+ "no-global-assign": 1,
+ "no-implicit-globals": 2,
+ "no-inner-declarations": ["error", "functions"],
+ "no-irregular-whitespace": 2,
+ "no-loop-func": 1,
+ "no-multi-str": 1,
+ "no-mixed-spaces-and-tabs": 1,
+ "no-proto": 1,
+ "no-sequences": 1,
+ "no-throw-literal": 1,
+ "no-unmodified-loop-condition": 1,
+ "no-useless-call": 1,
+ "no-void": 1,
+ "no-with": 2,
+ "wrap-iife": 1,
+ "no-redeclare": 1,
+ "no-unused-vars": ["error", { "vars": "all", "args": "none" }],
+ "no-sparse-arrays": 1
+ }
+}
diff --git a/node_modules/color-name/.npmignore b/node_modules/color-name/.npmignore
new file mode 100644
index 0000000..f9f2816
--- /dev/null
+++ b/node_modules/color-name/.npmignore
@@ -0,0 +1,107 @@
+//this will affect all the git repos
+git config --global core.excludesfile ~/.gitignore
+
+
+//update files since .ignore won't if already tracked
+git rm --cached <file>
+
+# Compiled source #
+###################
+*.com
+*.class
+*.dll
+*.exe
+*.o
+*.so
+
+# Packages #
+############
+# it's better to unpack these files and commit the raw source
+# git has its own built in compression methods
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.zip
+
+# Logs and databases #
+######################
+*.log
+*.sql
+*.sqlite
+
+# OS generated files #
+######################
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+# Icon?
+ehthumbs.db
+Thumbs.db
+.cache
+.project
+.settings
+.tmproj
+*.esproj
+nbproject
+
+# Numerous always-ignore extensions #
+#####################################
+*.diff
+*.err
+*.orig
+*.rej
+*.swn
+*.swo
+*.swp
+*.vi
+*~
+*.sass-cache
+*.grunt
+*.tmp
+
+# Dreamweaver added files #
+###########################
+_notes
+dwsync.xml
+
+# Komodo #
+###########################
+*.komodoproject
+.komodotools
+
+# Node #
+#####################
+node_modules
+
+# Bower #
+#####################
+bower_components
+
+# Folders to ignore #
+#####################
+.hg
+.svn
+.CVS
+intermediate
+publish
+.idea
+.graphics
+_test
+_archive
+uploads
+tmp
+
+# Vim files to ignore #
+#######################
+.VimballRecord
+.netrwhist
+
+bundle.*
+
+_demo \ No newline at end of file
diff --git a/node_modules/color-name/LICENSE b/node_modules/color-name/LICENSE
new file mode 100644
index 0000000..c6b1001
--- /dev/null
+++ b/node_modules/color-name/LICENSE
@@ -0,0 +1,8 @@
+The MIT License (MIT)
+Copyright (c) 2015 Dmitry Ivanov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/color-name/README.md b/node_modules/color-name/README.md
new file mode 100644
index 0000000..932b979
--- /dev/null
+++ b/node_modules/color-name/README.md
@@ -0,0 +1,11 @@
+A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
+
+[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/)
+
+
+```js
+var colors = require('color-name');
+colors.red //[255,0,0]
+```
+
+<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
diff --git a/node_modules/color-name/index.js b/node_modules/color-name/index.js
new file mode 100644
index 0000000..b7c198a
--- /dev/null
+++ b/node_modules/color-name/index.js
@@ -0,0 +1,152 @@
+'use strict'
+
+module.exports = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
diff --git a/node_modules/color-name/package.json b/node_modules/color-name/package.json
new file mode 100644
index 0000000..d061123
--- /dev/null
+++ b/node_modules/color-name/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "color-name",
+ "version": "1.1.3",
+ "description": "A list of color names and its values",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:dfcreative/color-name.git"
+ },
+ "keywords": [
+ "color-name",
+ "color",
+ "color-keyword",
+ "keyword"
+ ],
+ "author": "DY <dfcreative@gmail.com>",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/dfcreative/color-name/issues"
+ },
+ "homepage": "https://github.com/dfcreative/color-name"
+}
diff --git a/node_modules/color-name/test.js b/node_modules/color-name/test.js
new file mode 100644
index 0000000..6e6bf30
--- /dev/null
+++ b/node_modules/color-name/test.js
@@ -0,0 +1,7 @@
+'use strict'
+
+var names = require('./');
+var assert = require('assert');
+
+assert.deepEqual(names.red, [255,0,0]);
+assert.deepEqual(names.aliceblue, [240,248,255]);
diff --git a/node_modules/command-line-args/LICENSE b/node_modules/command-line-args/LICENSE
new file mode 100644
index 0000000..07fadb4
--- /dev/null
+++ b/node_modules/command-line-args/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-22 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/command-line-args/README.md b/node_modules/command-line-args/README.md
new file mode 100644
index 0000000..d7003b8
--- /dev/null
+++ b/node_modules/command-line-args/README.md
@@ -0,0 +1,105 @@
+[![view on npm](https://badgen.net/npm/v/command-line-args)](https://www.npmjs.org/package/command-line-args)
+[![npm module downloads](https://badgen.net/npm/dt/command-line-args)](https://www.npmjs.org/package/command-line-args)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/command-line-args)](https://github.com/75lb/command-line-args/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/command-line-args)](https://github.com/75lb/command-line-args/network/dependents?dependent_type=PACKAGE)
+[![Node.js CI](https://github.com/75lb/command-line-args/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/command-line-args/actions/workflows/node.js.yml)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/command-line-args/badge.svg)](https://coveralls.io/github/75lb/command-line-args)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+***Upgraders, please read the [release notes](https://github.com/75lb/command-line-args/releases)***
+
+# command-line-args
+
+A mature, feature-complete library to parse command-line options.
+
+## Synopsis
+
+You can set options using the main notation standards ([learn more](https://github.com/75lb/command-line-args/wiki/Notation-rules)). These commands are all equivalent, setting the same values:
+```
+$ example --verbose --timeout=1000 --src one.js --src two.js
+$ example --verbose --timeout 1000 --src one.js two.js
+$ example -vt 1000 --src one.js two.js
+$ example -vt 1000 one.js two.js
+```
+
+To access the values, first create a list of [option definitions](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) describing the options your application accepts. The [`type`](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md#optiontype--function) property is a setter function (the value supplied is passed through this), giving you full control over the value received.
+
+```js
+const optionDefinitions = [
+ { name: 'verbose', alias: 'v', type: Boolean },
+ { name: 'src', type: String, multiple: true, defaultOption: true },
+ { name: 'timeout', alias: 't', type: Number }
+]
+```
+
+Next, parse the options using [commandLineArgs()](https://github.com/75lb/command-line-args/blob/master/doc/API.md#commandlineargsoptiondefinitions-options--object-):
+```js
+const commandLineArgs = require('command-line-args')
+const options = commandLineArgs(optionDefinitions)
+```
+
+`options` now looks like this:
+```js
+{
+ src: [
+ 'one.js',
+ 'two.js'
+ ],
+ verbose: true,
+ timeout: 1000
+}
+```
+
+### Advanced usage
+
+Beside the above typical usage, you can configure command-line-args to accept more advanced syntax forms.
+
+* [Command-based syntax](https://github.com/75lb/command-line-args/wiki/Implement-command-parsing-(git-style)) (git style) in the form:
+
+ ```
+ $ executable <command> [options]
+ ```
+
+ For example.
+
+ ```
+ $ git commit --squash -m "This is my commit message"
+ ```
+
+* [Command and sub-command syntax](https://github.com/75lb/command-line-args/wiki/Implement-multiple-command-parsing-(docker-style)) (docker style) in the form:
+
+ ```
+ $ executable <command> [options] <sub-command> [options]
+ ```
+
+ For example.
+
+ ```
+ $ docker run --detached --image centos bash -c yum install -y httpd
+ ```
+
+## Usage guide generation
+
+A usage guide (typically printed when `--help` is set) can be generated using [command-line-usage](https://github.com/75lb/command-line-usage). See the examples below and [read the documentation](https://github.com/75lb/command-line-usage) for instructions how to create them.
+
+A typical usage guide example.
+
+![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/footer.png)
+
+The [polymer-cli](https://github.com/Polymer/polymer-cli/) usage guide is a good real-life example.
+
+![usage](https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/polymer.png)
+
+## Further Reading
+
+There is plenty more to learn, please see [the wiki](https://github.com/75lb/command-line-args/wiki) for examples and documentation.
+
+## Install
+
+```sh
+$ npm install command-line-args --save
+```
+
+* * *
+
+&copy; 2014-22 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/command-line-args/dist/index.js b/node_modules/command-line-args/dist/index.js
new file mode 100644
index 0000000..90a0c5e
--- /dev/null
+++ b/node_modules/command-line-args/dist/index.js
@@ -0,0 +1,1399 @@
+'use strict';
+
+function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
+
+var camelCase = _interopDefault(require('lodash.camelcase'));
+
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [ input ]
+}
+
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - converts array-like objects (e.g. `arguments`) to a real array
+ * - converts `undefined` to an empty array
+ * - converts any another other, singular value (including `null`) into an array containing that value
+ * - ignores input which is already an array
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject$1 (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike$1 (input) {
+ return isObject$1(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - the input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify$1 (input) {
+ if (Array.isArray(input)) {
+ return input
+ } else {
+ if (input === undefined) {
+ return []
+ } else if (isArrayLike$1(input)) {
+ return Array.prototype.slice.call(input)
+ } else {
+ return [ input ]
+ }
+ }
+}
+
+/**
+ * Find and either replace or remove items in an array.
+ *
+ * @module find-replace
+ * @example
+ * > const findReplace = require('find-replace')
+ * > const numbers = [ 1, 2, 3]
+ *
+ * > findReplace(numbers, n => n === 2, 'two')
+ * [ 1, 'two', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+ * [ 1, [ 'two', 'zwei' ], 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, 'two', 'zwei')
+ * [ 1, 'two', 'zwei', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2) // no replacement, so remove
+ * [ 1, 3 ]
+ */
+
+/**
+ * @param {array} - The input array
+ * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on.
+ * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed.
+ * @returns {array}
+ * @alias module:find-replace
+ */
+function findReplace (array, testFn) {
+ const found = [];
+ const replaceWiths = arrayify$1(arguments);
+ replaceWiths.splice(0, 2);
+
+ arrayify$1(array).forEach((value, index) => {
+ let expanded = [];
+ replaceWiths.forEach(replaceWith => {
+ if (typeof replaceWith === 'function') {
+ expanded = expanded.concat(replaceWith(value));
+ } else {
+ expanded.push(replaceWith);
+ }
+ });
+
+ if (testFn(value)) {
+ found.push({
+ index: index,
+ replaceWithValue: expanded
+ });
+ }
+ });
+
+ found.reverse().forEach(item => {
+ const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue);
+ array.splice.apply(array, spliceArgs);
+ });
+
+ return array
+}
+
+/**
+ * Some useful tools for working with `process.argv`.
+ *
+ * @module argv-tools
+ * @typicalName argvTools
+ * @example
+ * const argvTools = require('argv-tools')
+ */
+
+/**
+ * Regular expressions for matching option formats.
+ * @static
+ */
+const re = {
+ short: /^-([^\d-])$/,
+ long: /^--(\S+)/,
+ combinedShort: /^-[^\d-]{2,}$/,
+ optEquals: /^(--\S+?)=(.*)/
+};
+
+/**
+ * Array subclass encapsulating common operations on `process.argv`.
+ * @static
+ */
+class ArgvArray extends Array {
+ /**
+ * Clears the array has loads the supplied input.
+ * @param {string[]} argv - The argv list to load. Defaults to `process.argv`.
+ */
+ load (argv) {
+ this.clear();
+ if (argv && argv !== process.argv) {
+ argv = arrayify(argv);
+ } else {
+ /* if no argv supplied, assume we are parsing process.argv */
+ argv = process.argv.slice(0);
+ const deleteCount = process.execArgv.some(isExecArg) ? 1 : 2;
+ argv.splice(0, deleteCount);
+ }
+ argv.forEach(arg => this.push(String(arg)));
+ }
+
+ /**
+ * Clear the array.
+ */
+ clear () {
+ this.length = 0;
+ }
+
+ /**
+ * expand ``--option=value` style args.
+ */
+ expandOptionEqualsNotation () {
+ if (this.some(arg => re.optEquals.test(arg))) {
+ const expandedArgs = [];
+ this.forEach(arg => {
+ const matches = arg.match(re.optEquals);
+ if (matches) {
+ expandedArgs.push(matches[1], matches[2]);
+ } else {
+ expandedArgs.push(arg);
+ }
+ });
+ this.clear();
+ this.load(expandedArgs);
+ }
+ }
+
+ /**
+ * expand getopt-style combinedShort options.
+ */
+ expandGetoptNotation () {
+ if (this.hasCombinedShortOptions()) {
+ findReplace(this, re.combinedShort, expandCombinedShortArg);
+ }
+ }
+
+ /**
+ * Returns true if the array contains combined short options (e.g. `-ab`).
+ * @returns {boolean}
+ */
+ hasCombinedShortOptions () {
+ return this.some(arg => re.combinedShort.test(arg))
+ }
+
+ static from (argv) {
+ const result = new this();
+ result.load(argv);
+ return result
+ }
+}
+
+/**
+ * Expand a combined short option.
+ * @param {string} - the string to expand, e.g. `-ab`
+ * @returns {string[]}
+ * @static
+ */
+function expandCombinedShortArg (arg) {
+ /* remove initial hypen */
+ arg = arg.slice(1);
+ return arg.split('').map(letter => '-' + letter)
+}
+
+/**
+ * Returns true if the supplied arg matches `--option=value` notation.
+ * @param {string} - the arg to test, e.g. `--one=something`
+ * @returns {boolean}
+ * @static
+ */
+function isOptionEqualsNotation (arg) {
+ return re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in either long (`--one`) or short (`-o`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isOption (arg) {
+ return (re.short.test(arg) || re.long.test(arg)) && !re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in long (`--one`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isLongOption (arg) {
+ return re.long.test(arg) && !isOptionEqualsNotation(arg)
+}
+
+/**
+ * Returns the name from a long, short or `--options=value` arg.
+ * @param {string} - the arg to inspect, e.g. `--one`
+ * @returns {string}
+ * @static
+ */
+function getOptionName (arg) {
+ if (re.short.test(arg)) {
+ return arg.match(re.short)[1]
+ } else if (isLongOption(arg)) {
+ return arg.match(re.long)[1]
+ } else if (isOptionEqualsNotation(arg)) {
+ return arg.match(re.optEquals)[1].replace(/^--/, '')
+ } else {
+ return null
+ }
+}
+
+function isValue (arg) {
+ return !(isOption(arg) || re.combinedShort.test(arg) || re.optEquals.test(arg))
+}
+
+function isExecArg (arg) {
+ return ['--eval', '-e'].indexOf(arg) > -1 || arg.startsWith('--eval=')
+}
+
+/**
+ * For type-checking Javascript values.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ */
+
+/**
+ * Returns true if input is a number
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+function isArrayLike$2 (input) {
+ return isObject$2(input) && typeof input.length === 'number'
+}
+
+/**
+ * returns true if the typeof input is `'object'`, but not null!
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isObject$2 (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is a string
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a boolean
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isBoolean (input) {
+ return typeof input === 'boolean'
+}
+
+/**
+ * Returns true if the input value is a function
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isFunction (input) {
+ return typeof input === 'function'
+}
+
+/**
+ * Returns true if the input value is an es2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isClass (input) {
+ if (isFunction(input)) {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+var t = {
+ isNumber,
+ isString,
+ isBoolean,
+ isPlainObject,
+ isArrayLike: isArrayLike$2,
+ isObject: isObject$2,
+ isDefined,
+ isFunction,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable
+};
+
+/**
+ * @module option-definition
+ */
+
+/**
+ * Describes a command-line option. Additionally, if generating a usage guide with [command-line-usage](https://github.com/75lb/command-line-usage) you could optionally add `description` and `typeLabel` properties to each definition.
+ *
+ * @alias module:option-definition
+ * @typicalname option
+ */
+class OptionDefinition {
+ constructor (definition) {
+ /**
+ * The only required definition property is `name`, so the simplest working example is
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'file' },
+ * { name: 'depth' }
+ * ]
+ * ```
+ *
+ * Where a `type` property is not specified it will default to `String`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | -------------------- | ------------ |
+ * | 1 | `--file` | `{ file: null }` |
+ * | 2 | `--file lib.js` | `{ file: 'lib.js' }` |
+ * | 3 | `--depth 2` | `{ depth: '2' }` |
+ *
+ * Unicode option names and aliases are valid, for example:
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'один' },
+ * { name: '两' },
+ * { name: 'три', alias: 'т' }
+ * ]
+ * ```
+ * @type {string}
+ */
+ this.name = definition.name;
+
+ /**
+ * The `type` value is a setter function (you receive the output from this), enabling you to be specific about the type and value received.
+ *
+ * The most common values used are `String` (the default), `Number` and `Boolean` but you can use a custom function, for example:
+ *
+ * ```js
+ * const fs = require('fs')
+ *
+ * class FileDetails {
+ * constructor (filename) {
+ * this.filename = filename
+ * this.exists = fs.existsSync(filename)
+ * }
+ * }
+ *
+ * const cli = commandLineArgs([
+ * { name: 'file', type: filename => new FileDetails(filename) },
+ * { name: 'depth', type: Number }
+ * ])
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 1 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
+ *
+ * The `--depth` option expects a `Number`. If no value was set, you will receive `null`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 2 | `--depth` | `{ depth: null }` |
+ * | 3 | `--depth 2` | `{ depth: 2 }` |
+ *
+ * @type {function}
+ * @default String
+ */
+ this.type = definition.type || String;
+
+ /**
+ * getopt-style short option names. Can be any single character (unicode included) except a digit or hyphen.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'hot', alias: 'h', type: Boolean },
+ * { name: 'discount', alias: 'd', type: Boolean },
+ * { name: 'courses', alias: 'c' , type: Number }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
+ * | 2 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
+ *
+ * @type {string}
+ */
+ this.alias = definition.alias;
+
+ /**
+ * Set this flag if the option takes a list of values. You will receive an array of values, each passed through the `type` function (if specified).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', type: String, multiple: true }
+ * ]
+ * ```
+ *
+ * Note, examples 1 and 3 below demonstrate "greedy" parsing which can be disabled by using `lazyMultiple`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.multiple = definition.multiple;
+
+ /**
+ * Identical to `multiple` but with greedy parsing disabled.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', lazyMultiple: true },
+ * { name: 'verbose', alias: 'v', type: Boolean, lazyMultiple: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `-vvv` | `{ verbose: [ true, true, true ] }` |
+ *
+ * @type {boolean}
+ */
+ this.lazyMultiple = definition.lazyMultiple;
+
+ /**
+ * Any values unaccounted for by an option definition will be set on the `defaultOption`. This flag is typically set on the most commonly-used option to make for more concise usage (i.e. `$ example *.js` instead of `$ example --files *.js`).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultOption: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.defaultOption = definition.defaultOption;
+
+ /**
+ * An initial value for the option.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultValue: [ 'one.js' ] },
+ * { name: 'max', type: Number, defaultValue: 3 }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | | `{ files: [ 'one.js' ], max: 3 }` |
+ * | 2 | `--files two.js` | `{ files: [ 'two.js' ], max: 3 }` |
+ * | 3 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
+ *
+ * @type {*}
+ */
+ this.defaultValue = definition.defaultValue;
+
+ /**
+ * When your app has a large amount of options it makes sense to organise them in groups.
+ *
+ * There are two automatic groups: `_all` (contains all options) and `_none` (contains options without a `group` specified in their definition).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'verbose', group: 'standard' },
+ * { name: 'help', group: [ 'standard', 'main' ] },
+ * { name: 'compress', group: [ 'server', 'main' ] },
+ * { name: 'static', group: 'server' },
+ * { name: 'debug' }
+ * ]
+ * ```
+ *
+ *<table>
+ * <tr>
+ * <th>#</th><th>Command Line</th><th>commandLineArgs() output</th>
+ * </tr>
+ * <tr>
+ * <td>1</td><td><code>--verbose</code></td><td><pre><code>
+ *{
+ * _all: { verbose: true },
+ * standard: { verbose: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>2</td><td><code>--debug</code></td><td><pre><code>
+ *{
+ * _all: { debug: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>3</td><td><code>--verbose --debug --compress</code></td><td><pre><code>
+ *{
+ * _all: {
+ * verbose: true,
+ * debug: true,
+ * compress: true
+ * },
+ * standard: { verbose: true },
+ * server: { compress: true },
+ * main: { compress: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>4</td><td><code>--compress</code></td><td><pre><code>
+ *{
+ * _all: { compress: true },
+ * server: { compress: true },
+ * main: { compress: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ *</table>
+ *
+ * @type {string|string[]}
+ */
+ this.group = definition.group;
+
+ /* pick up any remaining properties */
+ for (const prop in definition) {
+ if (!this[prop]) this[prop] = definition[prop];
+ }
+ }
+
+ isBoolean () {
+ return this.type === Boolean || (t.isFunction(this.type) && this.type.name === 'Boolean')
+ }
+
+ isMultiple () {
+ return this.multiple || this.lazyMultiple
+ }
+
+ static create (def) {
+ const result = new this(def);
+ return result
+ }
+}
+
+/**
+ * @module option-definitions
+ */
+
+/**
+ * @alias module:option-definitions
+ */
+class Definitions extends Array {
+ /**
+ * validate option definitions
+ * @param {boolean} [caseInsensitive=false] - whether arguments will be parsed in a case insensitive manner
+ * @returns {string}
+ */
+ validate (caseInsensitive) {
+ const someHaveNoName = this.some(def => !def.name);
+ if (someHaveNoName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `name` property is required on each definition'
+ );
+ }
+
+ const someDontHaveFunctionType = this.some(def => def.type && typeof def.type !== 'function');
+ if (someDontHaveFunctionType) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)'
+ );
+ }
+
+ let invalidOption;
+
+ const numericAlias = this.some(def => {
+ invalidOption = def;
+ return t.isDefined(def.alias) && t.isNumber(def.alias)
+ });
+ if (numericAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: to avoid ambiguity an alias cannot be numeric [--' + invalidOption.name + ' alias is -' + invalidOption.alias + ']'
+ );
+ }
+
+ const multiCharacterAlias = this.some(def => {
+ invalidOption = def;
+ return t.isDefined(def.alias) && def.alias.length !== 1
+ });
+ if (multiCharacterAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias must be a single character'
+ );
+ }
+
+ const hypenAlias = this.some(def => {
+ invalidOption = def;
+ return def.alias === '-'
+ });
+ if (hypenAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias cannot be "-"'
+ );
+ }
+
+ const duplicateName = hasDuplicates(this.map(def => caseInsensitive ? def.name.toLowerCase() : def.name));
+ if (duplicateName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same name'
+ );
+ }
+
+ const duplicateAlias = hasDuplicates(this.map(def => caseInsensitive && t.isDefined(def.alias) ? def.alias.toLowerCase() : def.alias));
+ if (duplicateAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same alias'
+ );
+ }
+
+ const duplicateDefaultOption = this.filter(def => def.defaultOption === true).length > 1;
+ if (duplicateDefaultOption) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Only one option definition can be the defaultOption'
+ );
+ }
+
+ const defaultBoolean = this.some(def => {
+ invalidOption = def;
+ return def.isBoolean() && def.defaultOption
+ });
+ if (defaultBoolean) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ `A boolean option ["${invalidOption.name}"] can not also be the defaultOption.`
+ );
+ }
+ }
+
+ /**
+ * Get definition by option arg (e.g. `--one` or `-o`)
+ * @param {string} [arg] the argument name to get the definition for
+ * @param {boolean} [caseInsensitive] whether to use case insensitive comparisons when finding the appropriate definition
+ * @returns {Definition}
+ */
+ get (arg, caseInsensitive) {
+ if (isOption(arg)) {
+ if (re.short.test(arg)) {
+ const shortOptionName = getOptionName(arg);
+ if (caseInsensitive) {
+ const lowercaseShortOptionName = shortOptionName.toLowerCase();
+ return this.find(def => t.isDefined(def.alias) && def.alias.toLowerCase() === lowercaseShortOptionName)
+ } else {
+ return this.find(def => def.alias === shortOptionName)
+ }
+ } else {
+ const optionName = getOptionName(arg);
+ if (caseInsensitive) {
+ const lowercaseOptionName = optionName.toLowerCase();
+ return this.find(def => def.name.toLowerCase() === lowercaseOptionName)
+ } else {
+ return this.find(def => def.name === optionName)
+ }
+ }
+ } else {
+ return this.find(def => def.name === arg)
+ }
+ }
+
+ getDefault () {
+ return this.find(def => def.defaultOption === true)
+ }
+
+ isGrouped () {
+ return this.some(def => def.group)
+ }
+
+ whereGrouped () {
+ return this.filter(containsValidGroup)
+ }
+
+ whereNotGrouped () {
+ return this.filter(def => !containsValidGroup(def))
+ }
+
+ whereDefaultValueSet () {
+ return this.filter(def => t.isDefined(def.defaultValue))
+ }
+
+ static from (definitions, caseInsensitive) {
+ if (definitions instanceof this) return definitions
+ const result = super.from(arrayify(definitions), def => OptionDefinition.create(def));
+ result.validate(caseInsensitive);
+ return result
+ }
+}
+
+function halt (name, message) {
+ const err = new Error(message);
+ err.name = name;
+ throw err
+}
+
+function containsValidGroup (def) {
+ return arrayify(def.group).some(group => group)
+}
+
+function hasDuplicates (array) {
+ const items = {};
+ for (let i = 0; i < array.length; i++) {
+ const value = array[i];
+ if (items[value]) {
+ return true
+ } else {
+ if (t.isDefined(value)) items[value] = true;
+ }
+ }
+}
+
+/**
+ * @module argv-parser
+ */
+
+/**
+ * @alias module:argv-parser
+ */
+class ArgvParser {
+ /**
+ * @param {OptionDefinitions} - Definitions array
+ * @param {object} [options] - Options
+ * @param {string[]} [options.argv] - Overrides `process.argv`
+ * @param {boolean} [options.stopAtFirstUnknown] -
+ * @param {boolean} [options.caseInsensitive] - Arguments will be parsed in a case insensitive manner. Defaults to false.
+ */
+ constructor (definitions, options) {
+ this.options = Object.assign({}, options);
+ /**
+ * Option Definitions
+ */
+ this.definitions = Definitions.from(definitions, this.options.caseInsensitive);
+
+ /**
+ * Argv
+ */
+ this.argv = ArgvArray.from(this.options.argv);
+ if (this.argv.hasCombinedShortOptions()) {
+ findReplace(this.argv, re.combinedShort.test.bind(re.combinedShort), arg => {
+ arg = arg.slice(1);
+ return arg.split('').map(letter => ({ origArg: `-${arg}`, arg: '-' + letter }))
+ });
+ }
+ }
+
+ /**
+ * Yields one `{ event, name, value, arg, def }` argInfo object for each arg in `process.argv` (or `options.argv`).
+ */
+ * [Symbol.iterator] () {
+ const definitions = this.definitions;
+
+ let def;
+ let value;
+ let name;
+ let event;
+ let singularDefaultSet = false;
+ let unknownFound = false;
+ let origArg;
+
+ for (let arg of this.argv) {
+ if (t.isPlainObject(arg)) {
+ origArg = arg.origArg;
+ arg = arg.arg;
+ }
+
+ if (unknownFound && this.options.stopAtFirstUnknown) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value: undefined };
+ continue
+ }
+
+ /* handle long or short option */
+ if (isOption(arg)) {
+ def = definitions.get(arg, this.options.caseInsensitive);
+ value = undefined;
+ if (def) {
+ value = def.isBoolean() ? true : null;
+ event = 'set';
+ } else {
+ event = 'unknown_option';
+ }
+
+ /* handle --option-value notation */
+ } else if (isOptionEqualsNotation(arg)) {
+ const matches = arg.match(re.optEquals);
+ def = definitions.get(matches[1], this.options.caseInsensitive);
+ if (def) {
+ if (def.isBoolean()) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value, def };
+ event = 'set';
+ value = true;
+ } else {
+ event = 'set';
+ value = matches[2];
+ }
+ } else {
+ event = 'unknown_option';
+ }
+
+ /* handle value */
+ } else if (isValue(arg)) {
+ if (def) {
+ value = arg;
+ event = 'set';
+ } else {
+ /* get the defaultOption */
+ def = this.definitions.getDefault();
+ if (def && !singularDefaultSet) {
+ value = arg;
+ event = 'set';
+ } else {
+ event = 'unknown_value';
+ def = undefined;
+ }
+ }
+ }
+
+ name = def ? def.name : '_unknown';
+ const argInfo = { event, arg, name, value, def };
+ if (origArg) {
+ argInfo.subArg = arg;
+ argInfo.arg = origArg;
+ }
+ yield argInfo;
+
+ /* unknownFound logic */
+ if (name === '_unknown') unknownFound = true;
+
+ /* singularDefaultSet logic */
+ if (def && def.defaultOption && !def.isMultiple() && event === 'set') singularDefaultSet = true;
+
+ /* reset values once consumed and yielded */
+ if (def && def.isBoolean()) def = undefined;
+ /* reset the def if it's a singular which has been set */
+ if (def && !def.multiple && t.isDefined(value) && value !== null) {
+ def = undefined;
+ }
+ value = undefined;
+ event = undefined;
+ name = undefined;
+ origArg = undefined;
+ }
+ }
+}
+
+const _value = new WeakMap();
+
+/**
+ * Encapsulates behaviour (defined by an OptionDefinition) when setting values
+ */
+class Option {
+ constructor (definition) {
+ this.definition = new OptionDefinition(definition);
+ this.state = null; /* set or default */
+ this.resetToDefault();
+ }
+
+ get () {
+ return _value.get(this)
+ }
+
+ set (val) {
+ this._set(val, 'set');
+ }
+
+ _set (val, state) {
+ const def = this.definition;
+ if (def.isMultiple()) {
+ /* don't add null or undefined to a multiple */
+ if (val !== null && val !== undefined) {
+ const arr = this.get();
+ if (this.state === 'default') arr.length = 0;
+ arr.push(def.type(val));
+ this.state = state;
+ }
+ } else {
+ /* throw if already set on a singlar defaultOption */
+ if (!def.isMultiple() && this.state === 'set') {
+ const err = new Error(`Singular option already set [${this.definition.name}=${this.get()}]`);
+ err.name = 'ALREADY_SET';
+ err.value = val;
+ err.optionName = def.name;
+ throw err
+ } else if (val === null || val === undefined) {
+ _value.set(this, val);
+ // /* required to make 'partial: defaultOption with value equal to defaultValue 2' pass */
+ // if (!(def.defaultOption && !def.isMultiple())) {
+ // this.state = state
+ // }
+ } else {
+ _value.set(this, def.type(val));
+ this.state = state;
+ }
+ }
+ }
+
+ resetToDefault () {
+ if (t.isDefined(this.definition.defaultValue)) {
+ if (this.definition.isMultiple()) {
+ _value.set(this, arrayify(this.definition.defaultValue).slice());
+ } else {
+ _value.set(this, this.definition.defaultValue);
+ }
+ } else {
+ if (this.definition.isMultiple()) {
+ _value.set(this, []);
+ } else {
+ _value.set(this, null);
+ }
+ }
+ this.state = 'default';
+ }
+
+ static create (definition) {
+ definition = new OptionDefinition(definition);
+ if (definition.isBoolean()) {
+ return FlagOption.create(definition)
+ } else {
+ return new this(definition)
+ }
+ }
+}
+
+class FlagOption extends Option {
+ set (val) {
+ super.set(true);
+ }
+
+ static create (def) {
+ return new this(def)
+ }
+}
+
+/**
+ * A map of { DefinitionNameString: Option }. By default, an Output has an `_unknown` property and any options with defaultValues.
+ */
+class Output extends Map {
+ constructor (definitions) {
+ super();
+ /**
+ * @type {OptionDefinitions}
+ */
+ this.definitions = Definitions.from(definitions);
+
+ /* by default, an Output has an `_unknown` property and any options with defaultValues */
+ this.set('_unknown', Option.create({ name: '_unknown', multiple: true }));
+ for (const def of this.definitions.whereDefaultValueSet()) {
+ this.set(def.name, Option.create(def));
+ }
+ }
+
+ toObject (options) {
+ options = options || {};
+ const output = {};
+ for (const item of this) {
+ const name = options.camelCase && item[0] !== '_unknown' ? camelCase(item[0]) : item[0];
+ const option = item[1];
+ if (name === '_unknown' && !option.get().length) continue
+ output[name] = option.get();
+ }
+
+ if (options.skipUnknown) delete output._unknown;
+ return output
+ }
+}
+
+class GroupedOutput extends Output {
+ toObject (options) {
+ const superOutputNoCamel = super.toObject({ skipUnknown: options.skipUnknown });
+ const superOutput = super.toObject(options);
+ const unknown = superOutput._unknown;
+ delete superOutput._unknown;
+ const grouped = {
+ _all: superOutput
+ };
+ if (unknown && unknown.length) grouped._unknown = unknown;
+
+ this.definitions.whereGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name;
+ const outputValue = superOutputNoCamel[def.name];
+ for (const groupName of arrayify(def.group)) {
+ grouped[groupName] = grouped[groupName] || {};
+ if (t.isDefined(outputValue)) {
+ grouped[groupName][name] = outputValue;
+ }
+ }
+ });
+
+ this.definitions.whereNotGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name;
+ const outputValue = superOutputNoCamel[def.name];
+ if (t.isDefined(outputValue)) {
+ if (!grouped._none) grouped._none = {};
+ grouped._none[name] = outputValue;
+ }
+ });
+ return grouped
+ }
+}
+
+/**
+ * @module command-line-args
+ */
+
+/**
+ * Returns an object containing all option values set on the command line. By default it parses the global [`process.argv`](https://nodejs.org/api/process.html#process_process_argv) array.
+ *
+ * Parsing is strict by default - an exception is thrown if the user sets a singular option more than once or sets an unknown value or option (one without a valid [definition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md)). To be more permissive, enabling [partial](https://github.com/75lb/command-line-args/wiki/Partial-mode-example) or [stopAtFirstUnknown](https://github.com/75lb/command-line-args/wiki/stopAtFirstUnknown) modes will return known options in the usual manner while collecting unknown arguments in a separate `_unknown` property.
+ *
+ * @param {Array<OptionDefinition>} - An array of [OptionDefinition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) objects
+ * @param {object} [options] - Options.
+ * @param {string[]} [options.argv] - An array of strings which, if present will be parsed instead of `process.argv`.
+ * @param {boolean} [options.partial] - If `true`, an array of unknown arguments is returned in the `_unknown` property of the output.
+ * @param {boolean} [options.stopAtFirstUnknown] - If `true`, parsing will stop at the first unknown argument and the remaining arguments returned in `_unknown`. When set, `partial: true` is also implied.
+ * @param {boolean} [options.camelCase] - If `true`, options with hypenated names (e.g. `move-to`) will be returned in camel-case (e.g. `moveTo`).
+ * @param {boolean} [options.caseInsensitive] - If `true`, the case of each option name or alias parsed is insignificant. In other words, both `--Verbose` and `--verbose`, `-V` and `-v` would be equivalent. Defaults to false.
+ * @returns {object}
+ * @throws `UNKNOWN_OPTION` If `options.partial` is false and the user set an undefined option. The `err.optionName` property contains the arg that specified an unknown option, e.g. `--one`.
+ * @throws `UNKNOWN_VALUE` If `options.partial` is false and the user set a value unaccounted for by an option definition. The `err.value` property contains the unknown value, e.g. `5`.
+ * @throws `ALREADY_SET` If a user sets a singular, non-multiple option more than once. The `err.optionName` property contains the option name that has already been set, e.g. `one`.
+ * @throws `INVALID_DEFINITIONS`
+ * - If an option definition is missing the required `name` property
+ * - If an option definition has a `type` value that's not a function
+ * - If an alias is numeric, a hyphen or a length other than 1
+ * - If an option definition name was used more than once
+ * - If an option definition alias was used more than once
+ * - If more than one option definition has `defaultOption: true`
+ * - If a `Boolean` option is also set as the `defaultOption`.
+ * @alias module:command-line-args
+ */
+function commandLineArgs (optionDefinitions, options) {
+ options = options || {};
+ if (options.stopAtFirstUnknown) options.partial = true;
+ optionDefinitions = Definitions.from(optionDefinitions, options.caseInsensitive);
+
+ const parser = new ArgvParser(optionDefinitions, {
+ argv: options.argv,
+ stopAtFirstUnknown: options.stopAtFirstUnknown,
+ caseInsensitive: options.caseInsensitive
+ });
+
+ const OutputClass = optionDefinitions.isGrouped() ? GroupedOutput : Output;
+ const output = new OutputClass(optionDefinitions);
+
+ /* Iterate the parser setting each known value to the output. Optionally, throw on unknowns. */
+ for (const argInfo of parser) {
+ const arg = argInfo.subArg || argInfo.arg;
+ if (!options.partial) {
+ if (argInfo.event === 'unknown_value') {
+ const err = new Error(`Unknown value: ${arg}`);
+ err.name = 'UNKNOWN_VALUE';
+ err.value = arg;
+ throw err
+ } else if (argInfo.event === 'unknown_option') {
+ const err = new Error(`Unknown option: ${arg}`);
+ err.name = 'UNKNOWN_OPTION';
+ err.optionName = arg;
+ throw err
+ }
+ }
+
+ let option;
+ if (output.has(argInfo.name)) {
+ option = output.get(argInfo.name);
+ } else {
+ option = Option.create(argInfo.def);
+ output.set(argInfo.name, option);
+ }
+
+ if (argInfo.name === '_unknown') {
+ option.set(arg);
+ } else {
+ option.set(argInfo.value);
+ }
+ }
+
+ return output.toObject({ skipUnknown: !options.partial, camelCase: options.camelCase })
+}
+
+module.exports = commandLineArgs;
diff --git a/node_modules/command-line-args/dist/index.mjs b/node_modules/command-line-args/dist/index.mjs
new file mode 100644
index 0000000..00683e4
--- /dev/null
+++ b/node_modules/command-line-args/dist/index.mjs
@@ -0,0 +1,1395 @@
+import camelCase from 'lodash.camelcase';
+
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [ input ]
+}
+
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - converts array-like objects (e.g. `arguments`) to a real array
+ * - converts `undefined` to an empty array
+ * - converts any another other, singular value (including `null`) into an array containing that value
+ * - ignores input which is already an array
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject$1 (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike$1 (input) {
+ return isObject$1(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - the input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify$1 (input) {
+ if (Array.isArray(input)) {
+ return input
+ } else {
+ if (input === undefined) {
+ return []
+ } else if (isArrayLike$1(input)) {
+ return Array.prototype.slice.call(input)
+ } else {
+ return [ input ]
+ }
+ }
+}
+
+/**
+ * Find and either replace or remove items in an array.
+ *
+ * @module find-replace
+ * @example
+ * > const findReplace = require('find-replace')
+ * > const numbers = [ 1, 2, 3]
+ *
+ * > findReplace(numbers, n => n === 2, 'two')
+ * [ 1, 'two', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+ * [ 1, [ 'two', 'zwei' ], 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, 'two', 'zwei')
+ * [ 1, 'two', 'zwei', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2) // no replacement, so remove
+ * [ 1, 3 ]
+ */
+
+/**
+ * @param {array} - The input array
+ * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on.
+ * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed.
+ * @returns {array}
+ * @alias module:find-replace
+ */
+function findReplace (array, testFn) {
+ const found = [];
+ const replaceWiths = arrayify$1(arguments);
+ replaceWiths.splice(0, 2);
+
+ arrayify$1(array).forEach((value, index) => {
+ let expanded = [];
+ replaceWiths.forEach(replaceWith => {
+ if (typeof replaceWith === 'function') {
+ expanded = expanded.concat(replaceWith(value));
+ } else {
+ expanded.push(replaceWith);
+ }
+ });
+
+ if (testFn(value)) {
+ found.push({
+ index: index,
+ replaceWithValue: expanded
+ });
+ }
+ });
+
+ found.reverse().forEach(item => {
+ const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue);
+ array.splice.apply(array, spliceArgs);
+ });
+
+ return array
+}
+
+/**
+ * Some useful tools for working with `process.argv`.
+ *
+ * @module argv-tools
+ * @typicalName argvTools
+ * @example
+ * const argvTools = require('argv-tools')
+ */
+
+/**
+ * Regular expressions for matching option formats.
+ * @static
+ */
+const re = {
+ short: /^-([^\d-])$/,
+ long: /^--(\S+)/,
+ combinedShort: /^-[^\d-]{2,}$/,
+ optEquals: /^(--\S+?)=(.*)/
+};
+
+/**
+ * Array subclass encapsulating common operations on `process.argv`.
+ * @static
+ */
+class ArgvArray extends Array {
+ /**
+ * Clears the array has loads the supplied input.
+ * @param {string[]} argv - The argv list to load. Defaults to `process.argv`.
+ */
+ load (argv) {
+ this.clear();
+ if (argv && argv !== process.argv) {
+ argv = arrayify(argv);
+ } else {
+ /* if no argv supplied, assume we are parsing process.argv */
+ argv = process.argv.slice(0);
+ const deleteCount = process.execArgv.some(isExecArg) ? 1 : 2;
+ argv.splice(0, deleteCount);
+ }
+ argv.forEach(arg => this.push(String(arg)));
+ }
+
+ /**
+ * Clear the array.
+ */
+ clear () {
+ this.length = 0;
+ }
+
+ /**
+ * expand ``--option=value` style args.
+ */
+ expandOptionEqualsNotation () {
+ if (this.some(arg => re.optEquals.test(arg))) {
+ const expandedArgs = [];
+ this.forEach(arg => {
+ const matches = arg.match(re.optEquals);
+ if (matches) {
+ expandedArgs.push(matches[1], matches[2]);
+ } else {
+ expandedArgs.push(arg);
+ }
+ });
+ this.clear();
+ this.load(expandedArgs);
+ }
+ }
+
+ /**
+ * expand getopt-style combinedShort options.
+ */
+ expandGetoptNotation () {
+ if (this.hasCombinedShortOptions()) {
+ findReplace(this, re.combinedShort, expandCombinedShortArg);
+ }
+ }
+
+ /**
+ * Returns true if the array contains combined short options (e.g. `-ab`).
+ * @returns {boolean}
+ */
+ hasCombinedShortOptions () {
+ return this.some(arg => re.combinedShort.test(arg))
+ }
+
+ static from (argv) {
+ const result = new this();
+ result.load(argv);
+ return result
+ }
+}
+
+/**
+ * Expand a combined short option.
+ * @param {string} - the string to expand, e.g. `-ab`
+ * @returns {string[]}
+ * @static
+ */
+function expandCombinedShortArg (arg) {
+ /* remove initial hypen */
+ arg = arg.slice(1);
+ return arg.split('').map(letter => '-' + letter)
+}
+
+/**
+ * Returns true if the supplied arg matches `--option=value` notation.
+ * @param {string} - the arg to test, e.g. `--one=something`
+ * @returns {boolean}
+ * @static
+ */
+function isOptionEqualsNotation (arg) {
+ return re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in either long (`--one`) or short (`-o`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isOption (arg) {
+ return (re.short.test(arg) || re.long.test(arg)) && !re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in long (`--one`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isLongOption (arg) {
+ return re.long.test(arg) && !isOptionEqualsNotation(arg)
+}
+
+/**
+ * Returns the name from a long, short or `--options=value` arg.
+ * @param {string} - the arg to inspect, e.g. `--one`
+ * @returns {string}
+ * @static
+ */
+function getOptionName (arg) {
+ if (re.short.test(arg)) {
+ return arg.match(re.short)[1]
+ } else if (isLongOption(arg)) {
+ return arg.match(re.long)[1]
+ } else if (isOptionEqualsNotation(arg)) {
+ return arg.match(re.optEquals)[1].replace(/^--/, '')
+ } else {
+ return null
+ }
+}
+
+function isValue (arg) {
+ return !(isOption(arg) || re.combinedShort.test(arg) || re.optEquals.test(arg))
+}
+
+function isExecArg (arg) {
+ return ['--eval', '-e'].indexOf(arg) > -1 || arg.startsWith('--eval=')
+}
+
+/**
+ * For type-checking Javascript values.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ */
+
+/**
+ * Returns true if input is a number
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+function isArrayLike$2 (input) {
+ return isObject$2(input) && typeof input.length === 'number'
+}
+
+/**
+ * returns true if the typeof input is `'object'`, but not null!
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isObject$2 (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is a string
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a boolean
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isBoolean (input) {
+ return typeof input === 'boolean'
+}
+
+/**
+ * Returns true if the input value is a function
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isFunction (input) {
+ return typeof input === 'function'
+}
+
+/**
+ * Returns true if the input value is an es2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isClass (input) {
+ if (isFunction(input)) {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+var t = {
+ isNumber,
+ isString,
+ isBoolean,
+ isPlainObject,
+ isArrayLike: isArrayLike$2,
+ isObject: isObject$2,
+ isDefined,
+ isFunction,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable
+};
+
+/**
+ * @module option-definition
+ */
+
+/**
+ * Describes a command-line option. Additionally, if generating a usage guide with [command-line-usage](https://github.com/75lb/command-line-usage) you could optionally add `description` and `typeLabel` properties to each definition.
+ *
+ * @alias module:option-definition
+ * @typicalname option
+ */
+class OptionDefinition {
+ constructor (definition) {
+ /**
+ * The only required definition property is `name`, so the simplest working example is
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'file' },
+ * { name: 'depth' }
+ * ]
+ * ```
+ *
+ * Where a `type` property is not specified it will default to `String`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | -------------------- | ------------ |
+ * | 1 | `--file` | `{ file: null }` |
+ * | 2 | `--file lib.js` | `{ file: 'lib.js' }` |
+ * | 3 | `--depth 2` | `{ depth: '2' }` |
+ *
+ * Unicode option names and aliases are valid, for example:
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'один' },
+ * { name: '两' },
+ * { name: 'три', alias: 'т' }
+ * ]
+ * ```
+ * @type {string}
+ */
+ this.name = definition.name;
+
+ /**
+ * The `type` value is a setter function (you receive the output from this), enabling you to be specific about the type and value received.
+ *
+ * The most common values used are `String` (the default), `Number` and `Boolean` but you can use a custom function, for example:
+ *
+ * ```js
+ * const fs = require('fs')
+ *
+ * class FileDetails {
+ * constructor (filename) {
+ * this.filename = filename
+ * this.exists = fs.existsSync(filename)
+ * }
+ * }
+ *
+ * const cli = commandLineArgs([
+ * { name: 'file', type: filename => new FileDetails(filename) },
+ * { name: 'depth', type: Number }
+ * ])
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 1 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
+ *
+ * The `--depth` option expects a `Number`. If no value was set, you will receive `null`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 2 | `--depth` | `{ depth: null }` |
+ * | 3 | `--depth 2` | `{ depth: 2 }` |
+ *
+ * @type {function}
+ * @default String
+ */
+ this.type = definition.type || String;
+
+ /**
+ * getopt-style short option names. Can be any single character (unicode included) except a digit or hyphen.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'hot', alias: 'h', type: Boolean },
+ * { name: 'discount', alias: 'd', type: Boolean },
+ * { name: 'courses', alias: 'c' , type: Number }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
+ * | 2 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
+ *
+ * @type {string}
+ */
+ this.alias = definition.alias;
+
+ /**
+ * Set this flag if the option takes a list of values. You will receive an array of values, each passed through the `type` function (if specified).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', type: String, multiple: true }
+ * ]
+ * ```
+ *
+ * Note, examples 1 and 3 below demonstrate "greedy" parsing which can be disabled by using `lazyMultiple`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.multiple = definition.multiple;
+
+ /**
+ * Identical to `multiple` but with greedy parsing disabled.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', lazyMultiple: true },
+ * { name: 'verbose', alias: 'v', type: Boolean, lazyMultiple: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `-vvv` | `{ verbose: [ true, true, true ] }` |
+ *
+ * @type {boolean}
+ */
+ this.lazyMultiple = definition.lazyMultiple;
+
+ /**
+ * Any values unaccounted for by an option definition will be set on the `defaultOption`. This flag is typically set on the most commonly-used option to make for more concise usage (i.e. `$ example *.js` instead of `$ example --files *.js`).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultOption: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.defaultOption = definition.defaultOption;
+
+ /**
+ * An initial value for the option.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultValue: [ 'one.js' ] },
+ * { name: 'max', type: Number, defaultValue: 3 }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | | `{ files: [ 'one.js' ], max: 3 }` |
+ * | 2 | `--files two.js` | `{ files: [ 'two.js' ], max: 3 }` |
+ * | 3 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
+ *
+ * @type {*}
+ */
+ this.defaultValue = definition.defaultValue;
+
+ /**
+ * When your app has a large amount of options it makes sense to organise them in groups.
+ *
+ * There are two automatic groups: `_all` (contains all options) and `_none` (contains options without a `group` specified in their definition).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'verbose', group: 'standard' },
+ * { name: 'help', group: [ 'standard', 'main' ] },
+ * { name: 'compress', group: [ 'server', 'main' ] },
+ * { name: 'static', group: 'server' },
+ * { name: 'debug' }
+ * ]
+ * ```
+ *
+ *<table>
+ * <tr>
+ * <th>#</th><th>Command Line</th><th>commandLineArgs() output</th>
+ * </tr>
+ * <tr>
+ * <td>1</td><td><code>--verbose</code></td><td><pre><code>
+ *{
+ * _all: { verbose: true },
+ * standard: { verbose: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>2</td><td><code>--debug</code></td><td><pre><code>
+ *{
+ * _all: { debug: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>3</td><td><code>--verbose --debug --compress</code></td><td><pre><code>
+ *{
+ * _all: {
+ * verbose: true,
+ * debug: true,
+ * compress: true
+ * },
+ * standard: { verbose: true },
+ * server: { compress: true },
+ * main: { compress: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>4</td><td><code>--compress</code></td><td><pre><code>
+ *{
+ * _all: { compress: true },
+ * server: { compress: true },
+ * main: { compress: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ *</table>
+ *
+ * @type {string|string[]}
+ */
+ this.group = definition.group;
+
+ /* pick up any remaining properties */
+ for (const prop in definition) {
+ if (!this[prop]) this[prop] = definition[prop];
+ }
+ }
+
+ isBoolean () {
+ return this.type === Boolean || (t.isFunction(this.type) && this.type.name === 'Boolean')
+ }
+
+ isMultiple () {
+ return this.multiple || this.lazyMultiple
+ }
+
+ static create (def) {
+ const result = new this(def);
+ return result
+ }
+}
+
+/**
+ * @module option-definitions
+ */
+
+/**
+ * @alias module:option-definitions
+ */
+class Definitions extends Array {
+ /**
+ * validate option definitions
+ * @param {boolean} [caseInsensitive=false] - whether arguments will be parsed in a case insensitive manner
+ * @returns {string}
+ */
+ validate (caseInsensitive) {
+ const someHaveNoName = this.some(def => !def.name);
+ if (someHaveNoName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `name` property is required on each definition'
+ );
+ }
+
+ const someDontHaveFunctionType = this.some(def => def.type && typeof def.type !== 'function');
+ if (someDontHaveFunctionType) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)'
+ );
+ }
+
+ let invalidOption;
+
+ const numericAlias = this.some(def => {
+ invalidOption = def;
+ return t.isDefined(def.alias) && t.isNumber(def.alias)
+ });
+ if (numericAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: to avoid ambiguity an alias cannot be numeric [--' + invalidOption.name + ' alias is -' + invalidOption.alias + ']'
+ );
+ }
+
+ const multiCharacterAlias = this.some(def => {
+ invalidOption = def;
+ return t.isDefined(def.alias) && def.alias.length !== 1
+ });
+ if (multiCharacterAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias must be a single character'
+ );
+ }
+
+ const hypenAlias = this.some(def => {
+ invalidOption = def;
+ return def.alias === '-'
+ });
+ if (hypenAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias cannot be "-"'
+ );
+ }
+
+ const duplicateName = hasDuplicates(this.map(def => caseInsensitive ? def.name.toLowerCase() : def.name));
+ if (duplicateName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same name'
+ );
+ }
+
+ const duplicateAlias = hasDuplicates(this.map(def => caseInsensitive && t.isDefined(def.alias) ? def.alias.toLowerCase() : def.alias));
+ if (duplicateAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same alias'
+ );
+ }
+
+ const duplicateDefaultOption = this.filter(def => def.defaultOption === true).length > 1;
+ if (duplicateDefaultOption) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Only one option definition can be the defaultOption'
+ );
+ }
+
+ const defaultBoolean = this.some(def => {
+ invalidOption = def;
+ return def.isBoolean() && def.defaultOption
+ });
+ if (defaultBoolean) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ `A boolean option ["${invalidOption.name}"] can not also be the defaultOption.`
+ );
+ }
+ }
+
+ /**
+ * Get definition by option arg (e.g. `--one` or `-o`)
+ * @param {string} [arg] the argument name to get the definition for
+ * @param {boolean} [caseInsensitive] whether to use case insensitive comparisons when finding the appropriate definition
+ * @returns {Definition}
+ */
+ get (arg, caseInsensitive) {
+ if (isOption(arg)) {
+ if (re.short.test(arg)) {
+ const shortOptionName = getOptionName(arg);
+ if (caseInsensitive) {
+ const lowercaseShortOptionName = shortOptionName.toLowerCase();
+ return this.find(def => t.isDefined(def.alias) && def.alias.toLowerCase() === lowercaseShortOptionName)
+ } else {
+ return this.find(def => def.alias === shortOptionName)
+ }
+ } else {
+ const optionName = getOptionName(arg);
+ if (caseInsensitive) {
+ const lowercaseOptionName = optionName.toLowerCase();
+ return this.find(def => def.name.toLowerCase() === lowercaseOptionName)
+ } else {
+ return this.find(def => def.name === optionName)
+ }
+ }
+ } else {
+ return this.find(def => def.name === arg)
+ }
+ }
+
+ getDefault () {
+ return this.find(def => def.defaultOption === true)
+ }
+
+ isGrouped () {
+ return this.some(def => def.group)
+ }
+
+ whereGrouped () {
+ return this.filter(containsValidGroup)
+ }
+
+ whereNotGrouped () {
+ return this.filter(def => !containsValidGroup(def))
+ }
+
+ whereDefaultValueSet () {
+ return this.filter(def => t.isDefined(def.defaultValue))
+ }
+
+ static from (definitions, caseInsensitive) {
+ if (definitions instanceof this) return definitions
+ const result = super.from(arrayify(definitions), def => OptionDefinition.create(def));
+ result.validate(caseInsensitive);
+ return result
+ }
+}
+
+function halt (name, message) {
+ const err = new Error(message);
+ err.name = name;
+ throw err
+}
+
+function containsValidGroup (def) {
+ return arrayify(def.group).some(group => group)
+}
+
+function hasDuplicates (array) {
+ const items = {};
+ for (let i = 0; i < array.length; i++) {
+ const value = array[i];
+ if (items[value]) {
+ return true
+ } else {
+ if (t.isDefined(value)) items[value] = true;
+ }
+ }
+}
+
+/**
+ * @module argv-parser
+ */
+
+/**
+ * @alias module:argv-parser
+ */
+class ArgvParser {
+ /**
+ * @param {OptionDefinitions} - Definitions array
+ * @param {object} [options] - Options
+ * @param {string[]} [options.argv] - Overrides `process.argv`
+ * @param {boolean} [options.stopAtFirstUnknown] -
+ * @param {boolean} [options.caseInsensitive] - Arguments will be parsed in a case insensitive manner. Defaults to false.
+ */
+ constructor (definitions, options) {
+ this.options = Object.assign({}, options);
+ /**
+ * Option Definitions
+ */
+ this.definitions = Definitions.from(definitions, this.options.caseInsensitive);
+
+ /**
+ * Argv
+ */
+ this.argv = ArgvArray.from(this.options.argv);
+ if (this.argv.hasCombinedShortOptions()) {
+ findReplace(this.argv, re.combinedShort.test.bind(re.combinedShort), arg => {
+ arg = arg.slice(1);
+ return arg.split('').map(letter => ({ origArg: `-${arg}`, arg: '-' + letter }))
+ });
+ }
+ }
+
+ /**
+ * Yields one `{ event, name, value, arg, def }` argInfo object for each arg in `process.argv` (or `options.argv`).
+ */
+ * [Symbol.iterator] () {
+ const definitions = this.definitions;
+
+ let def;
+ let value;
+ let name;
+ let event;
+ let singularDefaultSet = false;
+ let unknownFound = false;
+ let origArg;
+
+ for (let arg of this.argv) {
+ if (t.isPlainObject(arg)) {
+ origArg = arg.origArg;
+ arg = arg.arg;
+ }
+
+ if (unknownFound && this.options.stopAtFirstUnknown) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value: undefined };
+ continue
+ }
+
+ /* handle long or short option */
+ if (isOption(arg)) {
+ def = definitions.get(arg, this.options.caseInsensitive);
+ value = undefined;
+ if (def) {
+ value = def.isBoolean() ? true : null;
+ event = 'set';
+ } else {
+ event = 'unknown_option';
+ }
+
+ /* handle --option-value notation */
+ } else if (isOptionEqualsNotation(arg)) {
+ const matches = arg.match(re.optEquals);
+ def = definitions.get(matches[1], this.options.caseInsensitive);
+ if (def) {
+ if (def.isBoolean()) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value, def };
+ event = 'set';
+ value = true;
+ } else {
+ event = 'set';
+ value = matches[2];
+ }
+ } else {
+ event = 'unknown_option';
+ }
+
+ /* handle value */
+ } else if (isValue(arg)) {
+ if (def) {
+ value = arg;
+ event = 'set';
+ } else {
+ /* get the defaultOption */
+ def = this.definitions.getDefault();
+ if (def && !singularDefaultSet) {
+ value = arg;
+ event = 'set';
+ } else {
+ event = 'unknown_value';
+ def = undefined;
+ }
+ }
+ }
+
+ name = def ? def.name : '_unknown';
+ const argInfo = { event, arg, name, value, def };
+ if (origArg) {
+ argInfo.subArg = arg;
+ argInfo.arg = origArg;
+ }
+ yield argInfo;
+
+ /* unknownFound logic */
+ if (name === '_unknown') unknownFound = true;
+
+ /* singularDefaultSet logic */
+ if (def && def.defaultOption && !def.isMultiple() && event === 'set') singularDefaultSet = true;
+
+ /* reset values once consumed and yielded */
+ if (def && def.isBoolean()) def = undefined;
+ /* reset the def if it's a singular which has been set */
+ if (def && !def.multiple && t.isDefined(value) && value !== null) {
+ def = undefined;
+ }
+ value = undefined;
+ event = undefined;
+ name = undefined;
+ origArg = undefined;
+ }
+ }
+}
+
+const _value = new WeakMap();
+
+/**
+ * Encapsulates behaviour (defined by an OptionDefinition) when setting values
+ */
+class Option {
+ constructor (definition) {
+ this.definition = new OptionDefinition(definition);
+ this.state = null; /* set or default */
+ this.resetToDefault();
+ }
+
+ get () {
+ return _value.get(this)
+ }
+
+ set (val) {
+ this._set(val, 'set');
+ }
+
+ _set (val, state) {
+ const def = this.definition;
+ if (def.isMultiple()) {
+ /* don't add null or undefined to a multiple */
+ if (val !== null && val !== undefined) {
+ const arr = this.get();
+ if (this.state === 'default') arr.length = 0;
+ arr.push(def.type(val));
+ this.state = state;
+ }
+ } else {
+ /* throw if already set on a singlar defaultOption */
+ if (!def.isMultiple() && this.state === 'set') {
+ const err = new Error(`Singular option already set [${this.definition.name}=${this.get()}]`);
+ err.name = 'ALREADY_SET';
+ err.value = val;
+ err.optionName = def.name;
+ throw err
+ } else if (val === null || val === undefined) {
+ _value.set(this, val);
+ // /* required to make 'partial: defaultOption with value equal to defaultValue 2' pass */
+ // if (!(def.defaultOption && !def.isMultiple())) {
+ // this.state = state
+ // }
+ } else {
+ _value.set(this, def.type(val));
+ this.state = state;
+ }
+ }
+ }
+
+ resetToDefault () {
+ if (t.isDefined(this.definition.defaultValue)) {
+ if (this.definition.isMultiple()) {
+ _value.set(this, arrayify(this.definition.defaultValue).slice());
+ } else {
+ _value.set(this, this.definition.defaultValue);
+ }
+ } else {
+ if (this.definition.isMultiple()) {
+ _value.set(this, []);
+ } else {
+ _value.set(this, null);
+ }
+ }
+ this.state = 'default';
+ }
+
+ static create (definition) {
+ definition = new OptionDefinition(definition);
+ if (definition.isBoolean()) {
+ return FlagOption.create(definition)
+ } else {
+ return new this(definition)
+ }
+ }
+}
+
+class FlagOption extends Option {
+ set (val) {
+ super.set(true);
+ }
+
+ static create (def) {
+ return new this(def)
+ }
+}
+
+/**
+ * A map of { DefinitionNameString: Option }. By default, an Output has an `_unknown` property and any options with defaultValues.
+ */
+class Output extends Map {
+ constructor (definitions) {
+ super();
+ /**
+ * @type {OptionDefinitions}
+ */
+ this.definitions = Definitions.from(definitions);
+
+ /* by default, an Output has an `_unknown` property and any options with defaultValues */
+ this.set('_unknown', Option.create({ name: '_unknown', multiple: true }));
+ for (const def of this.definitions.whereDefaultValueSet()) {
+ this.set(def.name, Option.create(def));
+ }
+ }
+
+ toObject (options) {
+ options = options || {};
+ const output = {};
+ for (const item of this) {
+ const name = options.camelCase && item[0] !== '_unknown' ? camelCase(item[0]) : item[0];
+ const option = item[1];
+ if (name === '_unknown' && !option.get().length) continue
+ output[name] = option.get();
+ }
+
+ if (options.skipUnknown) delete output._unknown;
+ return output
+ }
+}
+
+class GroupedOutput extends Output {
+ toObject (options) {
+ const superOutputNoCamel = super.toObject({ skipUnknown: options.skipUnknown });
+ const superOutput = super.toObject(options);
+ const unknown = superOutput._unknown;
+ delete superOutput._unknown;
+ const grouped = {
+ _all: superOutput
+ };
+ if (unknown && unknown.length) grouped._unknown = unknown;
+
+ this.definitions.whereGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name;
+ const outputValue = superOutputNoCamel[def.name];
+ for (const groupName of arrayify(def.group)) {
+ grouped[groupName] = grouped[groupName] || {};
+ if (t.isDefined(outputValue)) {
+ grouped[groupName][name] = outputValue;
+ }
+ }
+ });
+
+ this.definitions.whereNotGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name;
+ const outputValue = superOutputNoCamel[def.name];
+ if (t.isDefined(outputValue)) {
+ if (!grouped._none) grouped._none = {};
+ grouped._none[name] = outputValue;
+ }
+ });
+ return grouped
+ }
+}
+
+/**
+ * @module command-line-args
+ */
+
+/**
+ * Returns an object containing all option values set on the command line. By default it parses the global [`process.argv`](https://nodejs.org/api/process.html#process_process_argv) array.
+ *
+ * Parsing is strict by default - an exception is thrown if the user sets a singular option more than once or sets an unknown value or option (one without a valid [definition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md)). To be more permissive, enabling [partial](https://github.com/75lb/command-line-args/wiki/Partial-mode-example) or [stopAtFirstUnknown](https://github.com/75lb/command-line-args/wiki/stopAtFirstUnknown) modes will return known options in the usual manner while collecting unknown arguments in a separate `_unknown` property.
+ *
+ * @param {Array<OptionDefinition>} - An array of [OptionDefinition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) objects
+ * @param {object} [options] - Options.
+ * @param {string[]} [options.argv] - An array of strings which, if present will be parsed instead of `process.argv`.
+ * @param {boolean} [options.partial] - If `true`, an array of unknown arguments is returned in the `_unknown` property of the output.
+ * @param {boolean} [options.stopAtFirstUnknown] - If `true`, parsing will stop at the first unknown argument and the remaining arguments returned in `_unknown`. When set, `partial: true` is also implied.
+ * @param {boolean} [options.camelCase] - If `true`, options with hypenated names (e.g. `move-to`) will be returned in camel-case (e.g. `moveTo`).
+ * @param {boolean} [options.caseInsensitive] - If `true`, the case of each option name or alias parsed is insignificant. In other words, both `--Verbose` and `--verbose`, `-V` and `-v` would be equivalent. Defaults to false.
+ * @returns {object}
+ * @throws `UNKNOWN_OPTION` If `options.partial` is false and the user set an undefined option. The `err.optionName` property contains the arg that specified an unknown option, e.g. `--one`.
+ * @throws `UNKNOWN_VALUE` If `options.partial` is false and the user set a value unaccounted for by an option definition. The `err.value` property contains the unknown value, e.g. `5`.
+ * @throws `ALREADY_SET` If a user sets a singular, non-multiple option more than once. The `err.optionName` property contains the option name that has already been set, e.g. `one`.
+ * @throws `INVALID_DEFINITIONS`
+ * - If an option definition is missing the required `name` property
+ * - If an option definition has a `type` value that's not a function
+ * - If an alias is numeric, a hyphen or a length other than 1
+ * - If an option definition name was used more than once
+ * - If an option definition alias was used more than once
+ * - If more than one option definition has `defaultOption: true`
+ * - If a `Boolean` option is also set as the `defaultOption`.
+ * @alias module:command-line-args
+ */
+function commandLineArgs (optionDefinitions, options) {
+ options = options || {};
+ if (options.stopAtFirstUnknown) options.partial = true;
+ optionDefinitions = Definitions.from(optionDefinitions, options.caseInsensitive);
+
+ const parser = new ArgvParser(optionDefinitions, {
+ argv: options.argv,
+ stopAtFirstUnknown: options.stopAtFirstUnknown,
+ caseInsensitive: options.caseInsensitive
+ });
+
+ const OutputClass = optionDefinitions.isGrouped() ? GroupedOutput : Output;
+ const output = new OutputClass(optionDefinitions);
+
+ /* Iterate the parser setting each known value to the output. Optionally, throw on unknowns. */
+ for (const argInfo of parser) {
+ const arg = argInfo.subArg || argInfo.arg;
+ if (!options.partial) {
+ if (argInfo.event === 'unknown_value') {
+ const err = new Error(`Unknown value: ${arg}`);
+ err.name = 'UNKNOWN_VALUE';
+ err.value = arg;
+ throw err
+ } else if (argInfo.event === 'unknown_option') {
+ const err = new Error(`Unknown option: ${arg}`);
+ err.name = 'UNKNOWN_OPTION';
+ err.optionName = arg;
+ throw err
+ }
+ }
+
+ let option;
+ if (output.has(argInfo.name)) {
+ option = output.get(argInfo.name);
+ } else {
+ option = Option.create(argInfo.def);
+ output.set(argInfo.name, option);
+ }
+
+ if (argInfo.name === '_unknown') {
+ option.set(arg);
+ } else {
+ option.set(argInfo.value);
+ }
+ }
+
+ return output.toObject({ skipUnknown: !options.partial, camelCase: options.camelCase })
+}
+
+export default commandLineArgs;
diff --git a/node_modules/command-line-args/index.mjs b/node_modules/command-line-args/index.mjs
new file mode 100644
index 0000000..4ce4dea
--- /dev/null
+++ b/node_modules/command-line-args/index.mjs
@@ -0,0 +1,86 @@
+import Definitions from './lib/option-definitions.mjs'
+import ArgvParser from './lib/argv-parser.mjs'
+import Option from './lib/option.mjs'
+import OutputGrouped from './lib/output-grouped.mjs'
+import Output from './lib/output.mjs'
+
+/**
+ * @module command-line-args
+ */
+
+/**
+ * Returns an object containing all option values set on the command line. By default it parses the global [`process.argv`](https://nodejs.org/api/process.html#process_process_argv) array.
+ *
+ * Parsing is strict by default - an exception is thrown if the user sets a singular option more than once or sets an unknown value or option (one without a valid [definition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md)). To be more permissive, enabling [partial](https://github.com/75lb/command-line-args/wiki/Partial-mode-example) or [stopAtFirstUnknown](https://github.com/75lb/command-line-args/wiki/stopAtFirstUnknown) modes will return known options in the usual manner while collecting unknown arguments in a separate `_unknown` property.
+ *
+ * @param {Array<OptionDefinition>} - An array of [OptionDefinition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) objects
+ * @param {object} [options] - Options.
+ * @param {string[]} [options.argv] - An array of strings which, if present will be parsed instead of `process.argv`.
+ * @param {boolean} [options.partial] - If `true`, an array of unknown arguments is returned in the `_unknown` property of the output.
+ * @param {boolean} [options.stopAtFirstUnknown] - If `true`, parsing will stop at the first unknown argument and the remaining arguments returned in `_unknown`. When set, `partial: true` is also implied.
+ * @param {boolean} [options.camelCase] - If `true`, options with hypenated names (e.g. `move-to`) will be returned in camel-case (e.g. `moveTo`).
+ * @param {boolean} [options.caseInsensitive] - If `true`, the case of each option name or alias parsed is insignificant. In other words, both `--Verbose` and `--verbose`, `-V` and `-v` would be equivalent. Defaults to false.
+ * @returns {object}
+ * @throws `UNKNOWN_OPTION` If `options.partial` is false and the user set an undefined option. The `err.optionName` property contains the arg that specified an unknown option, e.g. `--one`.
+ * @throws `UNKNOWN_VALUE` If `options.partial` is false and the user set a value unaccounted for by an option definition. The `err.value` property contains the unknown value, e.g. `5`.
+ * @throws `ALREADY_SET` If a user sets a singular, non-multiple option more than once. The `err.optionName` property contains the option name that has already been set, e.g. `one`.
+ * @throws `INVALID_DEFINITIONS`
+ * - If an option definition is missing the required `name` property
+ * - If an option definition has a `type` value that's not a function
+ * - If an alias is numeric, a hyphen or a length other than 1
+ * - If an option definition name was used more than once
+ * - If an option definition alias was used more than once
+ * - If more than one option definition has `defaultOption: true`
+ * - If a `Boolean` option is also set as the `defaultOption`.
+ * @alias module:command-line-args
+ */
+function commandLineArgs (optionDefinitions, options) {
+ options = options || {}
+ if (options.stopAtFirstUnknown) options.partial = true
+ optionDefinitions = Definitions.from(optionDefinitions, options.caseInsensitive)
+
+ const parser = new ArgvParser(optionDefinitions, {
+ argv: options.argv,
+ stopAtFirstUnknown: options.stopAtFirstUnknown,
+ caseInsensitive: options.caseInsensitive
+ })
+
+ const OutputClass = optionDefinitions.isGrouped() ? OutputGrouped : Output
+ const output = new OutputClass(optionDefinitions)
+
+ /* Iterate the parser setting each known value to the output. Optionally, throw on unknowns. */
+ for (const argInfo of parser) {
+ const arg = argInfo.subArg || argInfo.arg
+ if (!options.partial) {
+ if (argInfo.event === 'unknown_value') {
+ const err = new Error(`Unknown value: ${arg}`)
+ err.name = 'UNKNOWN_VALUE'
+ err.value = arg
+ throw err
+ } else if (argInfo.event === 'unknown_option') {
+ const err = new Error(`Unknown option: ${arg}`)
+ err.name = 'UNKNOWN_OPTION'
+ err.optionName = arg
+ throw err
+ }
+ }
+
+ let option
+ if (output.has(argInfo.name)) {
+ option = output.get(argInfo.name)
+ } else {
+ option = Option.create(argInfo.def)
+ output.set(argInfo.name, option)
+ }
+
+ if (argInfo.name === '_unknown') {
+ option.set(arg)
+ } else {
+ option.set(argInfo.value)
+ }
+ }
+
+ return output.toObject({ skipUnknown: !options.partial, camelCase: options.camelCase })
+}
+
+export default commandLineArgs
diff --git a/node_modules/command-line-args/lib/argv-parser.mjs b/node_modules/command-line-args/lib/argv-parser.mjs
new file mode 100644
index 0000000..a2335d3
--- /dev/null
+++ b/node_modules/command-line-args/lib/argv-parser.mjs
@@ -0,0 +1,139 @@
+import * as argvTools from './argv-tools.mjs'
+import Definitions from './option-definitions.mjs'
+import findReplace from '../node_modules/find-replace/dist/index.mjs'
+import t from '../node_modules/typical/index.mjs'
+
+/**
+ * @module argv-parser
+ */
+
+/**
+ * @alias module:argv-parser
+ */
+class ArgvParser {
+ /**
+ * @param {OptionDefinitions} - Definitions array
+ * @param {object} [options] - Options
+ * @param {string[]} [options.argv] - Overrides `process.argv`
+ * @param {boolean} [options.stopAtFirstUnknown] -
+ * @param {boolean} [options.caseInsensitive] - Arguments will be parsed in a case insensitive manner. Defaults to false.
+ */
+ constructor (definitions, options) {
+ this.options = Object.assign({}, options)
+ /**
+ * Option Definitions
+ */
+ this.definitions = Definitions.from(definitions, this.options.caseInsensitive)
+
+ /**
+ * Argv
+ */
+ this.argv = argvTools.ArgvArray.from(this.options.argv)
+ if (this.argv.hasCombinedShortOptions()) {
+ findReplace(this.argv, argvTools.re.combinedShort.test.bind(argvTools.re.combinedShort), arg => {
+ arg = arg.slice(1)
+ return arg.split('').map(letter => ({ origArg: `-${arg}`, arg: '-' + letter }))
+ })
+ }
+ }
+
+ /**
+ * Yields one `{ event, name, value, arg, def }` argInfo object for each arg in `process.argv` (or `options.argv`).
+ */
+ * [Symbol.iterator] () {
+ const definitions = this.definitions
+
+ let def
+ let value
+ let name
+ let event
+ let singularDefaultSet = false
+ let unknownFound = false
+ let origArg
+
+ for (let arg of this.argv) {
+ if (t.isPlainObject(arg)) {
+ origArg = arg.origArg
+ arg = arg.arg
+ }
+
+ if (unknownFound && this.options.stopAtFirstUnknown) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value: undefined }
+ continue
+ }
+
+ /* handle long or short option */
+ if (argvTools.isOption(arg)) {
+ def = definitions.get(arg, this.options.caseInsensitive)
+ value = undefined
+ if (def) {
+ value = def.isBoolean() ? true : null
+ event = 'set'
+ } else {
+ event = 'unknown_option'
+ }
+
+ /* handle --option-value notation */
+ } else if (argvTools.isOptionEqualsNotation(arg)) {
+ const matches = arg.match(argvTools.re.optEquals)
+ def = definitions.get(matches[1], this.options.caseInsensitive)
+ if (def) {
+ if (def.isBoolean()) {
+ yield { event: 'unknown_value', arg, name: '_unknown', value, def }
+ event = 'set'
+ value = true
+ } else {
+ event = 'set'
+ value = matches[2]
+ }
+ } else {
+ event = 'unknown_option'
+ }
+
+ /* handle value */
+ } else if (argvTools.isValue(arg)) {
+ if (def) {
+ value = arg
+ event = 'set'
+ } else {
+ /* get the defaultOption */
+ def = this.definitions.getDefault()
+ if (def && !singularDefaultSet) {
+ value = arg
+ event = 'set'
+ } else {
+ event = 'unknown_value'
+ def = undefined
+ }
+ }
+ }
+
+ name = def ? def.name : '_unknown'
+ const argInfo = { event, arg, name, value, def }
+ if (origArg) {
+ argInfo.subArg = arg
+ argInfo.arg = origArg
+ }
+ yield argInfo
+
+ /* unknownFound logic */
+ if (name === '_unknown') unknownFound = true
+
+ /* singularDefaultSet logic */
+ if (def && def.defaultOption && !def.isMultiple() && event === 'set') singularDefaultSet = true
+
+ /* reset values once consumed and yielded */
+ if (def && def.isBoolean()) def = undefined
+ /* reset the def if it's a singular which has been set */
+ if (def && !def.multiple && t.isDefined(value) && value !== null) {
+ def = undefined
+ }
+ value = undefined
+ event = undefined
+ name = undefined
+ origArg = undefined
+ }
+ }
+}
+
+export default ArgvParser
diff --git a/node_modules/command-line-args/lib/argv-tools.mjs b/node_modules/command-line-args/lib/argv-tools.mjs
new file mode 100644
index 0000000..7a0e426
--- /dev/null
+++ b/node_modules/command-line-args/lib/argv-tools.mjs
@@ -0,0 +1,173 @@
+import arrayify from '../node_modules/array-back/index.mjs'
+import findReplace from '../node_modules/find-replace/dist/index.mjs'
+
+/**
+ * Some useful tools for working with `process.argv`.
+ *
+ * @module argv-tools
+ * @typicalName argvTools
+ * @example
+ * const argvTools = require('argv-tools')
+ */
+
+/**
+ * Regular expressions for matching option formats.
+ * @static
+ */
+const re = {
+ short: /^-([^\d-])$/,
+ long: /^--(\S+)/,
+ combinedShort: /^-[^\d-]{2,}$/,
+ optEquals: /^(--\S+?)=(.*)/
+}
+
+/**
+ * Array subclass encapsulating common operations on `process.argv`.
+ * @static
+ */
+class ArgvArray extends Array {
+ /**
+ * Clears the array has loads the supplied input.
+ * @param {string[]} argv - The argv list to load. Defaults to `process.argv`.
+ */
+ load (argv) {
+ this.clear()
+ if (argv && argv !== process.argv) {
+ argv = arrayify(argv)
+ } else {
+ /* if no argv supplied, assume we are parsing process.argv */
+ argv = process.argv.slice(0)
+ const deleteCount = process.execArgv.some(isExecArg) ? 1 : 2
+ argv.splice(0, deleteCount)
+ }
+ argv.forEach(arg => this.push(String(arg)))
+ }
+
+ /**
+ * Clear the array.
+ */
+ clear () {
+ this.length = 0
+ }
+
+ /**
+ * expand ``--option=value` style args.
+ */
+ expandOptionEqualsNotation () {
+ if (this.some(arg => re.optEquals.test(arg))) {
+ const expandedArgs = []
+ this.forEach(arg => {
+ const matches = arg.match(re.optEquals)
+ if (matches) {
+ expandedArgs.push(matches[1], matches[2])
+ } else {
+ expandedArgs.push(arg)
+ }
+ })
+ this.clear()
+ this.load(expandedArgs)
+ }
+ }
+
+ /**
+ * expand getopt-style combinedShort options.
+ */
+ expandGetoptNotation () {
+ if (this.hasCombinedShortOptions()) {
+ findReplace(this, re.combinedShort, expandCombinedShortArg)
+ }
+ }
+
+ /**
+ * Returns true if the array contains combined short options (e.g. `-ab`).
+ * @returns {boolean}
+ */
+ hasCombinedShortOptions () {
+ return this.some(arg => re.combinedShort.test(arg))
+ }
+
+ static from (argv) {
+ const result = new this()
+ result.load(argv)
+ return result
+ }
+}
+
+/**
+ * Expand a combined short option.
+ * @param {string} - the string to expand, e.g. `-ab`
+ * @returns {string[]}
+ * @static
+ */
+function expandCombinedShortArg (arg) {
+ /* remove initial hypen */
+ arg = arg.slice(1)
+ return arg.split('').map(letter => '-' + letter)
+}
+
+/**
+ * Returns true if the supplied arg matches `--option=value` notation.
+ * @param {string} - the arg to test, e.g. `--one=something`
+ * @returns {boolean}
+ * @static
+ */
+function isOptionEqualsNotation (arg) {
+ return re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in either long (`--one`) or short (`-o`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isOption (arg) {
+ return (re.short.test(arg) || re.long.test(arg)) && !re.optEquals.test(arg)
+}
+
+/**
+ * Returns true if the supplied arg is in long (`--one`) format.
+ * @param {string} - the arg to test, e.g. `--one`
+ * @returns {boolean}
+ * @static
+ */
+function isLongOption (arg) {
+ return re.long.test(arg) && !isOptionEqualsNotation(arg)
+}
+
+/**
+ * Returns the name from a long, short or `--options=value` arg.
+ * @param {string} - the arg to inspect, e.g. `--one`
+ * @returns {string}
+ * @static
+ */
+function getOptionName (arg) {
+ if (re.short.test(arg)) {
+ return arg.match(re.short)[1]
+ } else if (isLongOption(arg)) {
+ return arg.match(re.long)[1]
+ } else if (isOptionEqualsNotation(arg)) {
+ return arg.match(re.optEquals)[1].replace(/^--/, '')
+ } else {
+ return null
+ }
+}
+
+function isValue (arg) {
+ return !(isOption(arg) || re.combinedShort.test(arg) || re.optEquals.test(arg))
+}
+
+function isExecArg (arg) {
+ return ['--eval', '-e'].indexOf(arg) > -1 || arg.startsWith('--eval=')
+}
+
+export {
+ expandCombinedShortArg,
+ re,
+ ArgvArray,
+ getOptionName,
+ isOption,
+ isLongOption,
+ isOptionEqualsNotation,
+ isValue
+}
diff --git a/node_modules/command-line-args/lib/option-definition.mjs b/node_modules/command-line-args/lib/option-definition.mjs
new file mode 100644
index 0000000..eb2e65c
--- /dev/null
+++ b/node_modules/command-line-args/lib/option-definition.mjs
@@ -0,0 +1,265 @@
+import t from '../node_modules/typical/index.mjs'
+
+/**
+ * @module option-definition
+ */
+
+/**
+ * Describes a command-line option. Additionally, if generating a usage guide with [command-line-usage](https://github.com/75lb/command-line-usage) you could optionally add `description` and `typeLabel` properties to each definition.
+ *
+ * @alias module:option-definition
+ * @typicalname option
+ */
+class OptionDefinition {
+ constructor (definition) {
+ /**
+ * The only required definition property is `name`, so the simplest working example is
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'file' },
+ * { name: 'depth' }
+ * ]
+ * ```
+ *
+ * Where a `type` property is not specified it will default to `String`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | -------------------- | ------------ |
+ * | 1 | `--file` | `{ file: null }` |
+ * | 2 | `--file lib.js` | `{ file: 'lib.js' }` |
+ * | 3 | `--depth 2` | `{ depth: '2' }` |
+ *
+ * Unicode option names and aliases are valid, for example:
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'один' },
+ * { name: '两' },
+ * { name: 'три', alias: 'т' }
+ * ]
+ * ```
+ * @type {string}
+ */
+ this.name = definition.name
+
+ /**
+ * The `type` value is a setter function (you receive the output from this), enabling you to be specific about the type and value received.
+ *
+ * The most common values used are `String` (the default), `Number` and `Boolean` but you can use a custom function, for example:
+ *
+ * ```js
+ * const fs = require('fs')
+ *
+ * class FileDetails {
+ * constructor (filename) {
+ * this.filename = filename
+ * this.exists = fs.existsSync(filename)
+ * }
+ * }
+ *
+ * const cli = commandLineArgs([
+ * { name: 'file', type: filename => new FileDetails(filename) },
+ * { name: 'depth', type: Number }
+ * ])
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 1 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
+ *
+ * The `--depth` option expects a `Number`. If no value was set, you will receive `null`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ----------------- | ------------ |
+ * | 2 | `--depth` | `{ depth: null }` |
+ * | 3 | `--depth 2` | `{ depth: 2 }` |
+ *
+ * @type {function}
+ * @default String
+ */
+ this.type = definition.type || String
+
+ /**
+ * getopt-style short option names. Can be any single character (unicode included) except a digit or hyphen.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'hot', alias: 'h', type: Boolean },
+ * { name: 'discount', alias: 'd', type: Boolean },
+ * { name: 'courses', alias: 'c' , type: Number }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
+ * | 2 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
+ *
+ * @type {string}
+ */
+ this.alias = definition.alias
+
+ /**
+ * Set this flag if the option takes a list of values. You will receive an array of values, each passed through the `type` function (if specified).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', type: String, multiple: true }
+ * ]
+ * ```
+ *
+ * Note, examples 1 and 3 below demonstrate "greedy" parsing which can be disabled by using `lazyMultiple`.
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.multiple = definition.multiple
+
+ /**
+ * Identical to `multiple` but with greedy parsing disabled.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', lazyMultiple: true },
+ * { name: 'verbose', alias: 'v', type: Boolean, lazyMultiple: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `-vvv` | `{ verbose: [ true, true, true ] }` |
+ *
+ * @type {boolean}
+ */
+ this.lazyMultiple = definition.lazyMultiple
+
+ /**
+ * Any values unaccounted for by an option definition will be set on the `defaultOption`. This flag is typically set on the most commonly-used option to make for more concise usage (i.e. `$ example *.js` instead of `$ example --files *.js`).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultOption: true }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 2 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
+ * | 3 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
+ *
+ * @type {boolean}
+ */
+ this.defaultOption = definition.defaultOption
+
+ /**
+ * An initial value for the option.
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'files', multiple: true, defaultValue: [ 'one.js' ] },
+ * { name: 'max', type: Number, defaultValue: 3 }
+ * ]
+ * ```
+ *
+ * | # | argv input | commandLineArgs() output |
+ * | --- | ------------ | ------------ |
+ * | 1 | | `{ files: [ 'one.js' ], max: 3 }` |
+ * | 2 | `--files two.js` | `{ files: [ 'two.js' ], max: 3 }` |
+ * | 3 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
+ *
+ * @type {*}
+ */
+ this.defaultValue = definition.defaultValue
+
+ /**
+ * When your app has a large amount of options it makes sense to organise them in groups.
+ *
+ * There are two automatic groups: `_all` (contains all options) and `_none` (contains options without a `group` specified in their definition).
+ *
+ * ```js
+ * const optionDefinitions = [
+ * { name: 'verbose', group: 'standard' },
+ * { name: 'help', group: [ 'standard', 'main' ] },
+ * { name: 'compress', group: [ 'server', 'main' ] },
+ * { name: 'static', group: 'server' },
+ * { name: 'debug' }
+ * ]
+ * ```
+ *
+ *<table>
+ * <tr>
+ * <th>#</th><th>Command Line</th><th>commandLineArgs() output</th>
+ * </tr>
+ * <tr>
+ * <td>1</td><td><code>--verbose</code></td><td><pre><code>
+ *{
+ * _all: { verbose: true },
+ * standard: { verbose: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>2</td><td><code>--debug</code></td><td><pre><code>
+ *{
+ * _all: { debug: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>3</td><td><code>--verbose --debug --compress</code></td><td><pre><code>
+ *{
+ * _all: {
+ * verbose: true,
+ * debug: true,
+ * compress: true
+ * },
+ * standard: { verbose: true },
+ * server: { compress: true },
+ * main: { compress: true },
+ * _none: { debug: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ * <tr>
+ * <td>4</td><td><code>--compress</code></td><td><pre><code>
+ *{
+ * _all: { compress: true },
+ * server: { compress: true },
+ * main: { compress: true }
+ *}
+ *</code></pre></td>
+ * </tr>
+ *</table>
+ *
+ * @type {string|string[]}
+ */
+ this.group = definition.group
+
+ /* pick up any remaining properties */
+ for (const prop in definition) {
+ if (!this[prop]) this[prop] = definition[prop]
+ }
+ }
+
+ isBoolean () {
+ return this.type === Boolean || (t.isFunction(this.type) && this.type.name === 'Boolean')
+ }
+
+ isMultiple () {
+ return this.multiple || this.lazyMultiple
+ }
+
+ static create (def) {
+ const result = new this(def)
+ return result
+ }
+}
+
+export default OptionDefinition
diff --git a/node_modules/command-line-args/lib/option-definitions.mjs b/node_modules/command-line-args/lib/option-definitions.mjs
new file mode 100644
index 0000000..0bc879c
--- /dev/null
+++ b/node_modules/command-line-args/lib/option-definitions.mjs
@@ -0,0 +1,187 @@
+import arrayify from '../node_modules/array-back/index.mjs'
+import * as argvTools from './argv-tools.mjs'
+import t from '../node_modules/typical/index.mjs'
+import Definition from './option-definition.mjs'
+
+/**
+ * @module option-definitions
+ */
+
+/**
+ * @alias module:option-definitions
+ */
+class Definitions extends Array {
+ /**
+ * validate option definitions
+ * @param {boolean} [caseInsensitive=false] - whether arguments will be parsed in a case insensitive manner
+ * @returns {string}
+ */
+ validate (caseInsensitive) {
+ const someHaveNoName = this.some(def => !def.name)
+ if (someHaveNoName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `name` property is required on each definition'
+ )
+ }
+
+ const someDontHaveFunctionType = this.some(def => def.type && typeof def.type !== 'function')
+ if (someDontHaveFunctionType) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)'
+ )
+ }
+
+ let invalidOption
+
+ const numericAlias = this.some(def => {
+ invalidOption = def
+ return t.isDefined(def.alias) && t.isNumber(def.alias)
+ })
+ if (numericAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: to avoid ambiguity an alias cannot be numeric [--' + invalidOption.name + ' alias is -' + invalidOption.alias + ']'
+ )
+ }
+
+ const multiCharacterAlias = this.some(def => {
+ invalidOption = def
+ return t.isDefined(def.alias) && def.alias.length !== 1
+ })
+ if (multiCharacterAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias must be a single character'
+ )
+ }
+
+ const hypenAlias = this.some(def => {
+ invalidOption = def
+ return def.alias === '-'
+ })
+ if (hypenAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Invalid option definition: an alias cannot be "-"'
+ )
+ }
+
+ const duplicateName = hasDuplicates(this.map(def => caseInsensitive ? def.name.toLowerCase() : def.name))
+ if (duplicateName) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same name'
+ )
+ }
+
+ const duplicateAlias = hasDuplicates(this.map(def => caseInsensitive && t.isDefined(def.alias) ? def.alias.toLowerCase() : def.alias))
+ if (duplicateAlias) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Two or more option definitions have the same alias'
+ )
+ }
+
+ const duplicateDefaultOption = this.filter(def => def.defaultOption === true).length > 1;
+ if (duplicateDefaultOption) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ 'Only one option definition can be the defaultOption'
+ )
+ }
+
+ const defaultBoolean = this.some(def => {
+ invalidOption = def
+ return def.isBoolean() && def.defaultOption
+ })
+ if (defaultBoolean) {
+ halt(
+ 'INVALID_DEFINITIONS',
+ `A boolean option ["${invalidOption.name}"] can not also be the defaultOption.`
+ )
+ }
+ }
+
+ /**
+ * Get definition by option arg (e.g. `--one` or `-o`)
+ * @param {string} [arg] the argument name to get the definition for
+ * @param {boolean} [caseInsensitive] whether to use case insensitive comparisons when finding the appropriate definition
+ * @returns {Definition}
+ */
+ get (arg, caseInsensitive) {
+ if (argvTools.isOption(arg)) {
+ if (argvTools.re.short.test(arg)) {
+ const shortOptionName = argvTools.getOptionName(arg)
+ if (caseInsensitive) {
+ const lowercaseShortOptionName = shortOptionName.toLowerCase()
+ return this.find(def => t.isDefined(def.alias) && def.alias.toLowerCase() === lowercaseShortOptionName)
+ } else {
+ return this.find(def => def.alias === shortOptionName)
+ }
+ } else {
+ const optionName = argvTools.getOptionName(arg)
+ if (caseInsensitive) {
+ const lowercaseOptionName = optionName.toLowerCase()
+ return this.find(def => def.name.toLowerCase() === lowercaseOptionName)
+ } else {
+ return this.find(def => def.name === optionName)
+ }
+ }
+ } else {
+ return this.find(def => def.name === arg)
+ }
+ }
+
+ getDefault () {
+ return this.find(def => def.defaultOption === true)
+ }
+
+ isGrouped () {
+ return this.some(def => def.group)
+ }
+
+ whereGrouped () {
+ return this.filter(containsValidGroup)
+ }
+
+ whereNotGrouped () {
+ return this.filter(def => !containsValidGroup(def))
+ }
+
+ whereDefaultValueSet () {
+ return this.filter(def => t.isDefined(def.defaultValue))
+ }
+
+ static from (definitions, caseInsensitive) {
+ if (definitions instanceof this) return definitions
+ const result = super.from(arrayify(definitions), def => Definition.create(def))
+ result.validate(caseInsensitive)
+ return result
+ }
+}
+
+function halt (name, message) {
+ const err = new Error(message)
+ err.name = name
+ throw err
+}
+
+function containsValidGroup (def) {
+ return arrayify(def.group).some(group => group)
+}
+
+function hasDuplicates (array) {
+ const items = {}
+ for (let i = 0; i < array.length; i++) {
+ const value = array[i]
+ if (items[value]) {
+ return true
+ } else {
+ if (t.isDefined(value)) items[value] = true
+ }
+ }
+}
+
+export default Definitions
diff --git a/node_modules/command-line-args/lib/option-flag.mjs b/node_modules/command-line-args/lib/option-flag.mjs
new file mode 100644
index 0000000..4bbf0c8
--- /dev/null
+++ b/node_modules/command-line-args/lib/option-flag.mjs
@@ -0,0 +1,13 @@
+import Option from './option.mjs'
+
+class FlagOption extends Option {
+ set (val) {
+ super.set(true)
+ }
+
+ static create (def) {
+ return new this(def)
+ }
+}
+
+export default FlagOption
diff --git a/node_modules/command-line-args/lib/option.mjs b/node_modules/command-line-args/lib/option.mjs
new file mode 100644
index 0000000..eca9013
--- /dev/null
+++ b/node_modules/command-line-args/lib/option.mjs
@@ -0,0 +1,92 @@
+import arrayify from '../node_modules/array-back/index.mjs'
+import t from '../node_modules/typical/index.mjs'
+import Definition from './option-definition.mjs'
+const _value = new WeakMap()
+
+/**
+ * Encapsulates behaviour (defined by an OptionDefinition) when setting values
+ */
+class Option {
+ constructor (definition) {
+ this.definition = new Definition(definition)
+ this.state = null /* set or default */
+ this.resetToDefault()
+ }
+
+ get () {
+ return _value.get(this)
+ }
+
+ set (val) {
+ this._set(val, 'set')
+ }
+
+ _set (val, state) {
+ const def = this.definition
+ if (def.isMultiple()) {
+ /* don't add null or undefined to a multiple */
+ if (val !== null && val !== undefined) {
+ const arr = this.get()
+ if (this.state === 'default') arr.length = 0
+ arr.push(def.type(val))
+ this.state = state
+ }
+ } else {
+ /* throw if already set on a singlar defaultOption */
+ if (!def.isMultiple() && this.state === 'set') {
+ const err = new Error(`Singular option already set [${this.definition.name}=${this.get()}]`)
+ err.name = 'ALREADY_SET'
+ err.value = val
+ err.optionName = def.name
+ throw err
+ } else if (val === null || val === undefined) {
+ _value.set(this, val)
+ // /* required to make 'partial: defaultOption with value equal to defaultValue 2' pass */
+ // if (!(def.defaultOption && !def.isMultiple())) {
+ // this.state = state
+ // }
+ } else {
+ _value.set(this, def.type(val))
+ this.state = state
+ }
+ }
+ }
+
+ resetToDefault () {
+ if (t.isDefined(this.definition.defaultValue)) {
+ if (this.definition.isMultiple()) {
+ _value.set(this, arrayify(this.definition.defaultValue).slice())
+ } else {
+ _value.set(this, this.definition.defaultValue)
+ }
+ } else {
+ if (this.definition.isMultiple()) {
+ _value.set(this, [])
+ } else {
+ _value.set(this, null)
+ }
+ }
+ this.state = 'default'
+ }
+
+ static create (definition) {
+ definition = new Definition(definition)
+ if (definition.isBoolean()) {
+ return FlagOption.create(definition)
+ } else {
+ return new this(definition)
+ }
+ }
+}
+
+class FlagOption extends Option {
+ set (val) {
+ super.set(true)
+ }
+
+ static create (def) {
+ return new this(def)
+ }
+}
+
+export default Option
diff --git a/node_modules/command-line-args/lib/output-grouped.mjs b/node_modules/command-line-args/lib/output-grouped.mjs
new file mode 100644
index 0000000..ed78b1d
--- /dev/null
+++ b/node_modules/command-line-args/lib/output-grouped.mjs
@@ -0,0 +1,40 @@
+import Output from './output.mjs'
+import arrayify from '../node_modules/array-back/index.mjs'
+import t from '../node_modules/typical/index.mjs'
+import camelCase from 'lodash.camelcase'
+
+class GroupedOutput extends Output {
+ toObject (options) {
+ const superOutputNoCamel = super.toObject({ skipUnknown: options.skipUnknown })
+ const superOutput = super.toObject(options)
+ const unknown = superOutput._unknown
+ delete superOutput._unknown
+ const grouped = {
+ _all: superOutput
+ }
+ if (unknown && unknown.length) grouped._unknown = unknown
+
+ this.definitions.whereGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name
+ const outputValue = superOutputNoCamel[def.name]
+ for (const groupName of arrayify(def.group)) {
+ grouped[groupName] = grouped[groupName] || {}
+ if (t.isDefined(outputValue)) {
+ grouped[groupName][name] = outputValue
+ }
+ }
+ })
+
+ this.definitions.whereNotGrouped().forEach(def => {
+ const name = options.camelCase ? camelCase(def.name) : def.name
+ const outputValue = superOutputNoCamel[def.name]
+ if (t.isDefined(outputValue)) {
+ if (!grouped._none) grouped._none = {}
+ grouped._none[name] = outputValue
+ }
+ })
+ return grouped
+ }
+}
+
+export default GroupedOutput
diff --git a/node_modules/command-line-args/lib/output.mjs b/node_modules/command-line-args/lib/output.mjs
new file mode 100644
index 0000000..f52a091
--- /dev/null
+++ b/node_modules/command-line-args/lib/output.mjs
@@ -0,0 +1,38 @@
+import Option from './option.mjs'
+import Definitions from './option-definitions.mjs'
+import camelCase from 'lodash.camelcase'
+
+/**
+ * A map of { DefinitionNameString: Option }. By default, an Output has an `_unknown` property and any options with defaultValues.
+ */
+class Output extends Map {
+ constructor (definitions) {
+ super()
+ /**
+ * @type {OptionDefinitions}
+ */
+ this.definitions = Definitions.from(definitions)
+
+ /* by default, an Output has an `_unknown` property and any options with defaultValues */
+ this.set('_unknown', Option.create({ name: '_unknown', multiple: true }))
+ for (const def of this.definitions.whereDefaultValueSet()) {
+ this.set(def.name, Option.create(def))
+ }
+ }
+
+ toObject (options) {
+ options = options || {}
+ const output = {}
+ for (const item of this) {
+ const name = options.camelCase && item[0] !== '_unknown' ? camelCase(item[0]) : item[0]
+ const option = item[1]
+ if (name === '_unknown' && !option.get().length) continue
+ output[name] = option.get()
+ }
+
+ if (options.skipUnknown) delete output._unknown
+ return output
+ }
+}
+
+export default Output
diff --git a/node_modules/command-line-args/package.json b/node_modules/command-line-args/package.json
new file mode 100644
index 0000000..7431e10
--- /dev/null
+++ b/node_modules/command-line-args/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "command-line-args",
+ "version": "5.2.1",
+ "description": "A mature, feature-complete library to parse command-line options.",
+ "repository": "https://github.com/75lb/command-line-args",
+ "scripts": {
+ "test": "npm run dist && npm run test:js && npm run test:mjs",
+ "test:js": "node dist/tests.js",
+ "test:mjs": "node --experimental-modules test/tests.mjs",
+ "test:ci": "npm run test:js",
+ "docs": "jsdoc2md -c jsdoc.conf index.mjs > doc/API.md && jsdoc2md -c jsdoc.conf lib/option-definition.mjs > doc/option-definition.md",
+ "cover": "nyc --reporter=text-lcov test-runner test/*.js test/internals/*.js | coveralls",
+ "dist": "rollup index.mjs -f cjs -e 'lodash.camelcase' -o dist/index.js && rollup index.mjs -f esm -e 'lodash.camelcase' -o dist/index.mjs && rollup test/tests.mjs -f cjs -e 'test-runner,assert,lodash.camelcase' -o dist/tests.js"
+ },
+ "main": "dist/index.js",
+ "keywords": [
+ "argv",
+ "parse",
+ "argument",
+ "args",
+ "option",
+ "options",
+ "parser",
+ "parsing",
+ "cli",
+ "command",
+ "line"
+ ],
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ },
+ "files": [
+ "index.mjs",
+ "lib",
+ "dist/index.js",
+ "dist/index.mjs"
+ ],
+ "devDependencies": {
+ "coveralls": "^3.1.1",
+ "jsdoc-to-markdown": "^7.1.1",
+ "rollup": "~1.7.4",
+ "test-runner": "^0.5.1"
+ },
+ "dependencies": {
+ "array-back": "^3.1.0",
+ "find-replace": "^3.0.0",
+ "lodash.camelcase": "^4.3.0",
+ "typical": "^4.0.0"
+ },
+ "standard": {
+ "ignore": [
+ "dist"
+ ],
+ "envs": []
+ }
+}
diff --git a/node_modules/command-line-usage/LICENSE b/node_modules/command-line-usage/LICENSE
new file mode 100644
index 0000000..9263703
--- /dev/null
+++ b/node_modules/command-line-usage/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-22 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/command-line-usage/README.md b/node_modules/command-line-usage/README.md
new file mode 100644
index 0000000..4192413
--- /dev/null
+++ b/node_modules/command-line-usage/README.md
@@ -0,0 +1,120 @@
+[![view on npm](https://badgen.net/npm/v/command-line-usage)](https://www.npmjs.org/package/command-line-usage)
+[![npm module downloads](https://badgen.net/npm/dt/command-line-usage)](https://www.npmjs.org/package/command-line-usage)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/command-line-usage)](https://github.com/75lb/command-line-usage/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/command-line-usage)](https://github.com/75lb/command-line-usage/network/dependents?dependent_type=PACKAGE)
+[![Node.js CI](https://github.com/75lb/command-line-usage/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/command-line-usage/actions/workflows/node.js.yml)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/command-line-usage/badge.svg)](https://coveralls.io/github/75lb/command-line-usage)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+# command-line-usage
+
+***Upgraders, please check the [release notes](https://github.com/75lb/command-line-usage/releases).***
+
+A simple, data-driven module for creating a usage guide.
+
+## Synopsis
+
+A usage guide is created by first defining an arbitrary number of sections, e.g. a description section, synopsis, option list, examples, footer etc. Each section has an optional header, some content and must be of type [`content`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#module_command-line-usage--commandLineUsage..content) or [`optionList`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#module_command-line-usage--commandLineUsage..optionList). This section data is passed to [`commandLineUsage()`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#exp_module_command-line-usage--commandLineUsage) which returns a usage guide.
+
+Inline ansi formatting can be used anywhere within section content using [chalk template literal syntax](https://github.com/chalk/chalk/tree/v2.4.2#tagged-template-literal).
+
+For example, this script:
+```js
+import commandLineUsage from 'command-line-usage'
+
+const sections = [
+ {
+ header: 'A typical app',
+ content: 'Generates something {italic very} important.'
+ },
+ {
+ header: 'Options',
+ optionList: [
+ {
+ name: 'input',
+ typeLabel: '{underline file}',
+ description: 'The input to process.'
+ },
+ {
+ name: 'help',
+ description: 'Print this usage guide.'
+ }
+ ]
+ }
+]
+const usage = commandLineUsage(sections)
+console.log(usage)
+```
+
+Outputs this guide:
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/synopsis.png" width="90%">
+
+## Some examples
+
+### Typical
+
+A fairly typical usage guide with three sections - description, option list and footer. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-create-a-typical-usage-guide).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/simple.png" width="90%">
+
+### Option List groups
+
+Demonstrates breaking the option list up into groups. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-break-the-option-list-up-into-groups).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/groups.png" width="90%">
+
+### Banners
+
+A banner is created by adding the `raw: true` property to your `content`. This flag disables any formatting on the content, displaying it raw as supplied.
+
+#### Header
+
+Demonstrates a banner at the top. This example also adds a `synopsis` section. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-banner-to-your-usage-guide#code).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/header.png" width="90%">
+
+#### Footer
+
+Demonstrates a footer banner. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-banner-to-your-usage-guide#code-1).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/footer.png" width="90%">
+
+### Examples section (table layout)
+
+An examples section is added. To achieve this table layout, supply the `content` as an array of objects. The property names of each object are not important, so long as they are consistent throughout the array. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-an-examples-section-to-your-usage-guide).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/example-columns.png" width="90%">
+
+### Advanced optionList layout
+
+The `optionList` layout is fully configurable by setting the `tableOptions` property with an options object suitable for passing into [table-layout](https://github.com/75lb/table-layout#table-). This example overrides the default column widths and adds flame padding. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-use-advanced-optionList-table-formatting).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/option-list-options.png" width="90%">
+
+### Command list
+
+Useful if your app is command-driven, like git or npm. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-command-list-to-your-usage-guide).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/command-list.png" width="90%">
+
+### Description section (table layout)
+
+Demonstrates supplying specific [table layout](https://github.com/75lb/table-layout) options to achieve more advanced layout. In this case the second column (containing the hammer and sickle) has a fixed `width` of 40 and `noWrap` enabled (as the input is already formatted as desired). [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-description-section-to-your-usage-guide).
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/description-columns.png" width="90%">
+
+### Real-life
+
+The [polymer-cli](https://github.com/Polymer/tools/tree/master/packages/cli) usage guide is a good real-life example.
+
+<img src="https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/polymer.png" width="90%">
+
+## Documentation
+
+* [API Reference](https://github.com/75lb/command-line-usage/blob/master/doc/api.md)
+* [The full list of examples](https://github.com/75lb/command-line-usage/wiki)
+
+* * *
+
+&copy; 2015-22 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/command-line-usage/index.js b/node_modules/command-line-usage/index.js
new file mode 100644
index 0000000..d93c6c5
--- /dev/null
+++ b/node_modules/command-line-usage/index.js
@@ -0,0 +1,30 @@
+/**
+ * @module command-line-usage
+ */
+
+/**
+ * Generates a usage guide suitable for a command-line app.
+ * @param {Section|Section[]} - One or more section objects ({@link module:command-line-usage~content} or {@link module:command-line-usage~optionList}).
+ * @returns {string}
+ * @alias module:command-line-usage
+ */
+function commandLineUsage (sections) {
+ const arrayify = require('array-back')
+ sections = arrayify(sections)
+ if (sections.length) {
+ const OptionList = require('./lib/section/option-list')
+ const ContentSection = require('./lib/section/content')
+ const output = sections.map(section => {
+ if (section.optionList) {
+ return new OptionList(section)
+ } else {
+ return new ContentSection(section)
+ }
+ })
+ return '\n' + output.join('\n')
+ } else {
+ return ''
+ }
+}
+
+module.exports = commandLineUsage
diff --git a/node_modules/command-line-usage/lib/chalk-format.js b/node_modules/command-line-usage/lib/chalk-format.js
new file mode 100644
index 0000000..c544cce
--- /dev/null
+++ b/node_modules/command-line-usage/lib/chalk-format.js
@@ -0,0 +1,11 @@
+function chalkFormat (str) {
+ if (str) {
+ str = str.replace(/`/g, '\\`')
+ const chalk = require('chalk')
+ return chalk(Object.assign([], { raw: [str] }))
+ } else {
+ return ''
+ }
+}
+
+module.exports = chalkFormat
diff --git a/node_modules/command-line-usage/lib/section.js b/node_modules/command-line-usage/lib/section.js
new file mode 100644
index 0000000..821a366
--- /dev/null
+++ b/node_modules/command-line-usage/lib/section.js
@@ -0,0 +1,29 @@
+class Section {
+ constructor () {
+ this.lines = []
+ }
+
+ add (lines) {
+ if (lines) {
+ const arrayify = require('array-back')
+ arrayify(lines).forEach(line => this.lines.push(line))
+ } else {
+ this.lines.push('')
+ }
+ }
+
+ toString () {
+ const os = require('os')
+ return this.lines.join(os.EOL)
+ }
+
+ header (text) {
+ const chalk = require('chalk')
+ if (text) {
+ this.add(chalk.underline.bold(text))
+ this.add()
+ }
+ }
+}
+
+module.exports = Section
diff --git a/node_modules/command-line-usage/lib/section/content.js b/node_modules/command-line-usage/lib/section/content.js
new file mode 100644
index 0000000..4287f60
--- /dev/null
+++ b/node_modules/command-line-usage/lib/section/content.js
@@ -0,0 +1,154 @@
+const Section = require('../section')
+const t = require('typical')
+const Table = require('table-layout')
+const chalkFormat = require('../chalk-format')
+
+class ContentSection extends Section {
+ constructor (section) {
+ super()
+ this.header(section.header)
+
+ if (section.content) {
+ /* add content without indentation or wrapping */
+ if (section.raw) {
+ const arrayify = require('array-back')
+ const content = arrayify(section.content).map(line => chalkFormat(line))
+ this.add(content)
+ } else {
+ this.add(getContentLines(section.content))
+ }
+
+ this.add()
+ }
+ }
+}
+
+function getContentLines (content) {
+ const defaultPadding = { left: ' ', right: ' ' }
+
+ if (content) {
+ /* string content */
+ if (t.isString(content)) {
+ const table = new Table({ column: chalkFormat(content) }, {
+ padding: defaultPadding,
+ maxWidth: 80
+ })
+ return table.renderLines()
+
+ /* array of strings */
+ } else if (Array.isArray(content) && content.every(t.isString)) {
+ const rows = content.map(string => ({ column: chalkFormat(string) }))
+ const table = new Table(rows, {
+ padding: defaultPadding,
+ maxWidth: 80
+ })
+ return table.renderLines()
+
+ /* array of objects (use table-layout) */
+ } else if (Array.isArray(content) && content.every(t.isPlainObject)) {
+ const table = new Table(content.map(row => ansiFormatRow(row)), {
+ padding: defaultPadding
+ })
+ return table.renderLines()
+
+ /* { options: object, data: object[] } */
+ } else if (t.isPlainObject(content)) {
+ if (!content.options || !content.data) {
+ throw new Error('must have an "options" or "data" property\n' + JSON.stringify(content))
+ }
+ const options = Object.assign(
+ { padding: defaultPadding },
+ content.options
+ )
+
+ /* convert nowrap to noWrap to avoid breaking compatibility */
+ if (options.columns) {
+ options.columns = options.columns.map(column => {
+ if (column.nowrap) {
+ column.noWrap = column.nowrap
+ delete column.nowrap
+ }
+ return column
+ })
+ }
+
+ const table = new Table(
+ content.data.map(row => ansiFormatRow(row)),
+ options
+ )
+ return table.renderLines()
+ } else {
+ const message = `invalid input - 'content' must be a string, array of strings, or array of plain objects:\n\n${JSON.stringify(content)}`
+ throw new Error(message)
+ }
+ }
+}
+
+function ansiFormatRow (row) {
+ for (const key in row) {
+ row[key] = chalkFormat(row[key])
+ }
+ return row
+}
+
+module.exports = ContentSection
+
+/**
+ * A Content section comprises a header and one or more lines of content.
+ * @typedef module:command-line-usage~content
+ * @property header {string} - The section header, always bold and underlined.
+ * @property content {string|string[]|object[]} - Overloaded property, accepting data in one of four formats:
+ *
+ * 1. A single string (one line of text)
+ * 2. An array of strings (multiple lines of text)
+ * 3. An array of objects (recordset-style data). In this case, the data will be rendered in table format. The property names of each object are not important, so long as they are consistent throughout the array.
+ * 4. An object with two properties - `data` and `options`. In this case, the data and options will be passed directly to the underlying [table layout](https://github.com/75lb/table-layout) module for rendering.
+ *
+ * @property raw {boolean} - Set to true to avoid indentation and wrapping. Useful for banners.
+ * @example
+ * Simple string of content. For ansi formatting, use [chalk template literal syntax](https://github.com/chalk/chalk#tagged-template-literal).
+ * ```js
+ * {
+ * header: 'A typical app',
+ * content: 'Generates something {rgb(255,200,0).italic very {underline.bgRed important}}.'
+ * }
+ * ```
+ *
+ * An array of strings is interpreted as lines, to be joined by the system newline character.
+ * ```js
+ * {
+ * header: 'A typical app',
+ * content: [
+ * 'First line.',
+ * 'Second line.'
+ * ]
+ * }
+ * ```
+ *
+ * An array of recordset-style objects are rendered in table layout.
+ * ```js
+ * {
+ * header: 'A typical app',
+ * content: [
+ * { colA: 'First row, first column.', colB: 'First row, second column.'},
+ * { colA: 'Second row, first column.', colB: 'Second row, second column.'}
+ * ]
+ * }
+ * ```
+ *
+ * An object with `data` and `options` properties will be passed directly to the underlying [table layout](https://github.com/75lb/table-layout) module for rendering.
+ * ```js
+ * {
+ * header: 'A typical app',
+ * content: {
+ * data: [
+ * { colA: 'First row, first column.', colB: 'First row, second column.'},
+ * { colA: 'Second row, first column.', colB: 'Second row, second column.'}
+ * ],
+ * options: {
+ * maxWidth: 60
+ * }
+ * }
+ * }
+ * ```
+ */
diff --git a/node_modules/command-line-usage/lib/section/option-list.js b/node_modules/command-line-usage/lib/section/option-list.js
new file mode 100644
index 0000000..9214c13
--- /dev/null
+++ b/node_modules/command-line-usage/lib/section/option-list.js
@@ -0,0 +1,128 @@
+const Section = require('../section')
+const Table = require('table-layout')
+const chalk = require('../chalk-format')
+const t = require('typical')
+const arrayify = require('array-back')
+
+class OptionList extends Section {
+ constructor (data) {
+ super()
+ let definitions = arrayify(data.optionList)
+ const hide = arrayify(data.hide)
+ const groups = arrayify(data.group)
+
+ /* filter out hidden definitions */
+ if (hide.length) {
+ definitions = definitions.filter(definition => {
+ return hide.indexOf(definition.name) === -1
+ })
+ }
+
+ if (data.header) this.header(data.header)
+
+ if (groups.length) {
+ definitions = definitions.filter(def => {
+ const noGroupMatch = groups.indexOf('_none') > -1 && !t.isDefined(def.group)
+ const groupMatch = intersect(arrayify(def.group), groups)
+ if (noGroupMatch || groupMatch) return def
+ })
+ }
+
+ const rows = definitions.map(def => {
+ return {
+ option: getOptionNames(def, data.reverseNameOrder),
+ description: chalk(def.description)
+ }
+ })
+
+ const tableOptions = data.tableOptions || {
+ padding: { left: ' ', right: ' ' },
+ columns: [
+ { name: 'option', noWrap: true },
+ { name: 'description', maxWidth: 80 }
+ ]
+ }
+ const table = new Table(rows, tableOptions)
+ this.add(table.renderLines())
+
+ this.add()
+ }
+}
+
+function getOptionNames (definition, reverseNameOrder) {
+ let type = definition.type ? definition.type.name.toLowerCase() : 'string'
+ const multiple = (definition.multiple || definition.lazyMultiple) ? '[]' : ''
+ if (type) {
+ type = type === 'boolean' ? '' : `{underline ${type}${multiple}}`
+ }
+ type = chalk(definition.typeLabel || type)
+
+ let result = ''
+ if (definition.alias) {
+ if (definition.name) {
+ if (reverseNameOrder) {
+ result = chalk(`{bold --${definition.name}}, {bold -${definition.alias}} ${type}`)
+ } else {
+ result = chalk(`{bold -${definition.alias}}, {bold --${definition.name}} ${type}`)
+ }
+ } else {
+ if (reverseNameOrder) {
+ result = chalk(`{bold -${definition.alias}} ${type}`)
+ } else {
+ result = chalk(`{bold -${definition.alias}} ${type}`)
+ }
+ }
+ } else {
+ result = chalk(`{bold --${definition.name}} ${type}`)
+ }
+ return result
+}
+
+function intersect (arr1, arr2) {
+ return arr1.some(function (item1) {
+ return arr2.some(function (item2) {
+ return item1 === item2
+ })
+ })
+}
+
+module.exports = OptionList
+
+/**
+ * An OptionList section adds a table displaying the supplied option definitions.
+ * @typedef module:command-line-usage~optionList
+ * @property {string} [header] - The section header, always bold and underlined.
+ * @property optionList {OptionDefinition[]} - An array of [option definition](https://github.com/75lb/command-line-args/blob/master/doc/option-definition.md) objects. In addition to the regular definition properties, command-line-usage will look for:
+ *
+ * - `description` - a string describing the option.
+ * - `typeLabel` - a string to replace the default type string (e.g. `<string>`). It's often more useful to set a more descriptive type label, like `<ms>`, `<files>`, `<command>` etc.
+ * @property {string|string[]} [group] - If specified, only options from this particular group will be printed. [Example](https://github.com/75lb/command-line-usage/blob/master/example/groups.js).
+ * @property {string|string[]} [hide] - The names of one of more option definitions to hide from the option list. [Example](https://github.com/75lb/command-line-usage/blob/master/example/hide.js).
+ * @property {boolean} [reverseNameOrder] - If true, the option alias will be displayed after the name, i.e. `--verbose, -v` instead of `-v, --verbose`).
+ * @property {object} [tableOptions] - An options object suitable for passing into [table-layout](https://github.com/75lb/table-layout#table-). See [here for an example](https://github.com/75lb/command-line-usage/blob/master/example/option-list-options.js).
+ *
+ * @example
+ * {
+ * header: 'Options',
+ * optionList: [
+ * {
+ * name: 'help',
+ * alias: 'h',
+ * description: 'Display this usage guide.'
+ * },
+ * {
+ * name: 'src',
+ * description: 'The input files to process',
+ * multiple: true,
+ * defaultOption: true,
+ * typeLabel: '{underline file} ...'
+ * },
+ * {
+ * name: 'timeout',
+ * description: 'Timeout value in ms.',
+ * alias: 't',
+ * typeLabel: '{underline ms}'
+ * }
+ * ]
+ * }
+ */
diff --git a/node_modules/command-line-usage/node_modules/array-back/LICENSE b/node_modules/command-line-usage/node_modules/array-back/LICENSE
new file mode 100644
index 0000000..203018f
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/command-line-usage/node_modules/array-back/README.hbs b/node_modules/command-line-usage/node_modules/array-back/README.hbs
new file mode 100644
index 0000000..7d84bd2
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/command-line-usage/node_modules/array-back/README.md b/node_modules/command-line-usage/node_modules/array-back/README.md
new file mode 100644
index 0000000..431339e
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/README.md
@@ -0,0 +1,81 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_array-back"></a>
+
+## array-back
+Takes any input and guarantees an array back.
+
+- Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+- Converts `undefined` to an empty array.
+- Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+- Ignores input which is already an array.
+
+**Example**
+```js
+> const arrayify = require('array-back')
+
+> arrayify(undefined)
+[]
+
+> arrayify(null)
+[ null ]
+
+> arrayify(0)
+[ 0 ]
+
+> arrayify([ 1, 2 ])
+[ 1, 2 ]
+
+> arrayify(new Set([ 1, 2 ]))
+[ 1, 2 ]
+
+> function f(){ return arrayify(arguments); }
+> f(1,2,3)
+[ 1, 2, 3 ]
+```
+<a name="exp_module_array-back--arrayify"></a>
+
+### arrayify(input) ⇒ <code>Array</code> ⏏
+**Kind**: Exported function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | The input value to convert to an array |
+
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/command-line-usage/node_modules/array-back/dist/index.js b/node_modules/command-line-usage/node_modules/array-back/dist/index.js
new file mode 100644
index 0000000..3b97b84
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/dist/index.js
@@ -0,0 +1,70 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.arrayBack = factory());
+}(this, (function () { 'use strict';
+
+ /**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+ function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [input]
+ }
+
+ return arrayify;
+
+})));
diff --git a/node_modules/command-line-usage/node_modules/array-back/index.mjs b/node_modules/command-line-usage/node_modules/array-back/index.mjs
new file mode 100644
index 0000000..1090399
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/index.mjs
@@ -0,0 +1,62 @@
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [input]
+}
+
+export default arrayify
diff --git a/node_modules/command-line-usage/node_modules/array-back/package.json b/node_modules/command-line-usage/node_modules/array-back/package.json
new file mode 100644
index 0000000..a677a10
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/array-back/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "array-back",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "4.0.2",
+ "description": "Guarantees an array back",
+ "repository": "https://github.com/75lb/array-back.git",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "to",
+ "convert",
+ "return",
+ "array",
+ "arrayify"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ],
+ "scripts": {
+ "test": "npm run dist && npm run test:esm && npm run test:web",
+ "test:esm": "esm-runner test.mjs",
+ "test:web": "web-runner test.mjs",
+ "docs": "jsdoc2md -t README.hbs index.mjs -c jsdoc.conf > README.md",
+ "dist": "rollup -f umd -n arrayBack -o dist/index.js index.mjs",
+ "cover": "c8 npm run test:esm && c8 report --reporter=text-lcov | coveralls"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "@test-runner/web": "^0.2.1",
+ "c8": "^6.0.1",
+ "coveralls": "^3.0.7",
+ "esm-runner": "^0.2.0",
+ "isomorphic-assert": "^0.1.1",
+ "jsdoc-to-markdown": "^5.0.2",
+ "rollup": "^1.26.5"
+ },
+ "standard": {
+ "ignore": [
+ "dist"
+ ]
+ }
+}
diff --git a/node_modules/command-line-usage/node_modules/typical/LICENSE b/node_modules/command-line-usage/node_modules/typical/LICENSE
new file mode 100644
index 0000000..700561a
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/command-line-usage/node_modules/typical/README.hbs b/node_modules/command-line-usage/node_modules/typical/README.hbs
new file mode 100644
index 0000000..bb092a1
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/command-line-usage/node_modules/typical/README.md b/node_modules/command-line-usage/node_modules/typical/README.md
new file mode 100644
index 0000000..6e3d513
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/README.md
@@ -0,0 +1,302 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_typical"></a>
+
+## typical
+Isomorphic, functional type-checking for Javascript.
+
+**Example**
+```js
+const t = require('typical')
+const allDefined = array.every(t.isDefined)
+```
+
+* [typical](#module_typical)
+ * [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code>
+ * [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code>
+ * [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code>
+ * [.isObject(input)](#module_typical.isObject) ⇒ <code>boolean</code>
+ * [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code>
+ * [.isUndefined(input)](#module_typical.isUndefined) ⇒ <code>boolean</code>
+ * [.isNull(input)](#module_typical.isNull) ⇒ <code>boolean</code>
+ * [.isDefinedValue(input)](#module_typical.isDefinedValue) ⇒ <code>boolean</code>
+ * [.isClass(input)](#module_typical.isClass) ⇒ <code>boolean</code>
+ * [.isPrimitive(input)](#module_typical.isPrimitive) ⇒ <code>boolean</code>
+ * [.isPromise(input)](#module_typical.isPromise) ⇒ <code>boolean</code>
+ * [.isIterable(input)](#module_typical.isIterable) ⇒ <code>boolean</code>
+ * [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code>
+ * [.isFunction(input)](#module_typical.isFunction) ⇒ <code>boolean</code>
+
+<a name="module_typical.isNumber"></a>
+
+### t.isNumber(n) ⇒ <code>boolean</code>
+Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| n | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isNumber(0)
+true
+> t.isNumber(1)
+true
+> t.isNumber(1.1)
+true
+> t.isNumber(0xff)
+true
+> t.isNumber(0644)
+true
+> t.isNumber(6.2e5)
+true
+> t.isNumber(NaN)
+false
+> t.isNumber(Infinity)
+false
+```
+<a name="module_typical.isPlainObject"></a>
+
+### t.isPlainObject(input) ⇒ <code>boolean</code>
+A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isPlainObject({ something: 'one' })
+true
+> t.isPlainObject(new Date())
+false
+> t.isPlainObject([ 0, 1 ])
+false
+> t.isPlainObject(/test/)
+false
+> t.isPlainObject(1)
+false
+> t.isPlainObject('one')
+false
+> t.isPlainObject(null)
+false
+> t.isPlainObject((function * () {})())
+false
+> t.isPlainObject(function * () {})
+false
+```
+<a name="module_typical.isArrayLike"></a>
+
+### t.isArrayLike(input) ⇒ <code>boolean</code>
+An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+function sum(x, y){
+ console.log(t.isArrayLike(arguments))
+ // prints `true`
+}
+```
+<a name="module_typical.isObject"></a>
+
+### t.isObject(input) ⇒ <code>boolean</code>
+Returns true if the typeof input is `'object'` but not null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefined"></a>
+
+### t.isDefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is defined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isUndefined"></a>
+
+### t.isUndefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is undefined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isNull"></a>
+
+### t.isNull(input) ⇒ <code>boolean</code>
+Returns true if the input value is null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefinedValue"></a>
+
+### t.isDefinedValue(input) ⇒ <code>boolean</code>
+Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isClass"></a>
+
+### t.isClass(input) ⇒ <code>boolean</code>
+Returns true if the input value is an ES2015 `class`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPrimitive"></a>
+
+### t.isPrimitive(input) ⇒ <code>boolean</code>
+Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPromise"></a>
+
+### t.isPromise(input) ⇒ <code>boolean</code>
+Returns true if the input is a Promise.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isIterable"></a>
+
+### t.isIterable(input) ⇒ <code>boolean</code>
+Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isIterable('string')
+true
+> t.isIterable(new Map())
+true
+> t.isIterable([])
+true
+> t.isIterable((function * () {})())
+true
+> t.isIterable(Promise.resolve())
+false
+> t.isIterable(Promise)
+false
+> t.isIterable(true)
+false
+> t.isIterable({})
+false
+> t.isIterable(0)
+false
+> t.isIterable(1.1)
+false
+> t.isIterable(NaN)
+false
+> t.isIterable(Infinity)
+false
+> t.isIterable(function () {})
+false
+> t.isIterable(Date)
+false
+> t.isIterable()
+false
+> t.isIterable({ then: function () {} })
+false
+```
+<a name="module_typical.isString"></a>
+
+### t.isString(input) ⇒ <code>boolean</code>
+Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isFunction"></a>
+
+### t.isFunction(input) ⇒ <code>boolean</code>
+Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/command-line-usage/node_modules/typical/dist/index.js b/node_modules/command-line-usage/node_modules/typical/dist/index.js
new file mode 100644
index 0000000..ed8b168
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/dist/index.js
@@ -0,0 +1,295 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (global = global || self, factory(global.typical = {}));
+}(this, function (exports) { 'use strict';
+
+ /**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+ /**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+ function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+ }
+
+ /**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+ function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+ }
+
+ /**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ /**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefined (input) {
+ return typeof input !== 'undefined'
+ }
+
+ /**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isUndefined (input) {
+ return !isDefined(input)
+ }
+
+ /**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isNull (input) {
+ return input === null
+ }
+
+ /**
+ * Returns true if the input value is both defined and not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+ }
+
+ /**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+ function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+ }
+
+ /**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isString (input) {
+ return typeof input === 'string'
+ }
+
+ /**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isFunction (input) {
+ return typeof input === 'function'
+ }
+
+ var index = {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+ };
+
+ exports.default = index;
+ exports.isArrayLike = isArrayLike;
+ exports.isClass = isClass;
+ exports.isDefined = isDefined;
+ exports.isDefinedValue = isDefinedValue;
+ exports.isFunction = isFunction;
+ exports.isIterable = isIterable;
+ exports.isNull = isNull;
+ exports.isNumber = isNumber;
+ exports.isObject = isObject;
+ exports.isPlainObject = isPlainObject;
+ exports.isPrimitive = isPrimitive;
+ exports.isPromise = isPromise;
+ exports.isString = isString;
+ exports.isUndefined = isUndefined;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/node_modules/command-line-usage/node_modules/typical/index.mjs b/node_modules/command-line-usage/node_modules/typical/index.mjs
new file mode 100644
index 0000000..d3468a9
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/index.mjs
@@ -0,0 +1,269 @@
+/**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+/**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+export function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+export function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+export function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isUndefined (input) {
+ return !isDefined(input)
+}
+
+/**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isNull (input) {
+ return input === null
+}
+
+/**
+ * Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+}
+
+/**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise
+ const isThenable = input.then && typeof input.then === 'function'
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+export function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+/**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isFunction (input) {
+ return typeof input === 'function'
+}
+
+export default {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+}
diff --git a/node_modules/command-line-usage/node_modules/typical/package.json b/node_modules/command-line-usage/node_modules/typical/package.json
new file mode 100644
index 0000000..d664f1b
--- /dev/null
+++ b/node_modules/command-line-usage/node_modules/typical/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "typical",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "5.2.0",
+ "description": "Isomorphic, functional type-checking for Javascript",
+ "repository": "https://github.com/75lb/typical",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "type",
+ "checking",
+ "check",
+ "value",
+ "valid",
+ "is",
+ "number",
+ "object",
+ "plainobject",
+ "array",
+ "like",
+ "defined",
+ "string",
+ "boolean",
+ "function",
+ "promise",
+ "iterable",
+ "class",
+ "primitive",
+ "isstring",
+ "isclass",
+ "isiterable",
+ "isdefined",
+ "isobject",
+ "isomorphic"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "npm run dist && npm run test:js && npm run test:esm",
+ "test:all": "npm run test:js && npm run test:esm && npm run test:web",
+ "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js",
+ "test:esm": "esm-runner test/*.mjs",
+ "test:web": "web-runner test/test.mjs",
+ "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js",
+ "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named",
+ "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo",
+ "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "devDependencies": {
+ "coveralls": "^3.0.7",
+ "esm-runner": "^0.1.5",
+ "jsdoc-to-markdown": "^5.0.2",
+ "nyc": "^14.1.1",
+ "rollup": "^1.25.1",
+ "test-object-model": "^0.4.4",
+ "test-runner": "^0.6.0"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ]
+}
diff --git a/node_modules/command-line-usage/package.json b/node_modules/command-line-usage/package.json
new file mode 100644
index 0000000..7ecc6e0
--- /dev/null
+++ b/node_modules/command-line-usage/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "command-line-usage",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "6.1.3",
+ "description": "Generates command-line usage information",
+ "repository": "https://github.com/75lb/command-line-usage",
+ "license": "MIT",
+ "files": [
+ "lib/**/*.js",
+ "index.js"
+ ],
+ "keywords": [
+ "terminal",
+ "command line",
+ "usage",
+ "generator"
+ ],
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "scripts": {
+ "docs": "jsdoc2md --no-gfm index.js lib/**/*.js > doc/api.md; echo",
+ "test": "test-runner test/*.js",
+ "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "dependencies": {
+ "array-back": "^4.0.2",
+ "chalk": "^2.4.2",
+ "table-layout": "^1.0.2",
+ "typical": "^5.2.0"
+ },
+ "devDependencies": {
+ "jsdoc-to-markdown": "^7.1.1",
+ "test-runner": "^0.6.3"
+ },
+ "standard": {
+ "ignore": [
+ "example"
+ ]
+ }
+}
diff --git a/node_modules/deep-extend/CHANGELOG.md b/node_modules/deep-extend/CHANGELOG.md
new file mode 100644
index 0000000..dd13ec1
--- /dev/null
+++ b/node_modules/deep-extend/CHANGELOG.md
@@ -0,0 +1,46 @@
+Changelog
+=========
+
+v0.6.0
+------
+
+- Updated "devDependencies" versions to fix vulnerability alerts
+- Dropped support of io.js and node.js v0.12.x and lower since new versions of
+ "devDependencies" couldn't work with those old node.js versions
+ (minimal supported version of node.js now is v4.0.0)
+
+v0.5.1
+------
+
+- Fix prototype pollution vulnerability (thanks to @mwakerman for the PR)
+- Avoid using deprecated Buffer API (thanks to @ChALkeR for the PR)
+
+v0.5.0
+------
+
+- Auto-testing provided by Travis CI;
+- Support older Node.JS versions (`v0.11.x` and `v0.10.x`);
+- Removed tests files from npm package.
+
+v0.4.2
+------
+
+- Fix for `null` as an argument.
+
+v0.4.1
+------
+
+- Removed test code from <b>npm</b> package
+ ([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21));
+- Increased minimal version of Node from `0.4.0` to `0.12.0`
+ (because can't run tests on lesser version anyway).
+
+v0.4.0
+------
+
+- **WARNING!** Broken backward compatibility with `v0.3.x`;
+- Fixed bug with extending arrays instead of cloning;
+- Deep cloning for arrays;
+- Check for own property;
+- Fixed some documentation issues;
+- Strict JS mode.
diff --git a/node_modules/deep-extend/LICENSE b/node_modules/deep-extend/LICENSE
new file mode 100644
index 0000000..5c58916
--- /dev/null
+++ b/node_modules/deep-extend/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2018, Viacheslav Lotsmanov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/deep-extend/README.md b/node_modules/deep-extend/README.md
new file mode 100644
index 0000000..67c7fc0
--- /dev/null
+++ b/node_modules/deep-extend/README.md
@@ -0,0 +1,91 @@
+Deep Extend
+===========
+
+Recursive object extending.
+
+[![Build Status](https://api.travis-ci.org/unclechu/node-deep-extend.svg?branch=master)](https://travis-ci.org/unclechu/node-deep-extend)
+
+[![NPM](https://nodei.co/npm/deep-extend.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/deep-extend/)
+
+Install
+-------
+
+```bash
+$ npm install deep-extend
+```
+
+Usage
+-----
+
+```javascript
+var deepExtend = require('deep-extend');
+var obj1 = {
+ a: 1,
+ b: 2,
+ d: {
+ a: 1,
+ b: [],
+ c: { test1: 123, test2: 321 }
+ },
+ f: 5,
+ g: 123,
+ i: 321,
+ j: [1, 2]
+};
+var obj2 = {
+ b: 3,
+ c: 5,
+ d: {
+ b: { first: 'one', second: 'two' },
+ c: { test2: 222 }
+ },
+ e: { one: 1, two: 2 },
+ f: [],
+ g: (void 0),
+ h: /abc/g,
+ i: null,
+ j: [3, 4]
+};
+
+deepExtend(obj1, obj2);
+
+console.log(obj1);
+/*
+{ a: 1,
+ b: 3,
+ d:
+ { a: 1,
+ b: { first: 'one', second: 'two' },
+ c: { test1: 123, test2: 222 } },
+ f: [],
+ g: undefined,
+ c: 5,
+ e: { one: 1, two: 2 },
+ h: /abc/g,
+ i: null,
+ j: [3, 4] }
+*/
+```
+
+Unit testing
+------------
+
+```bash
+$ npm test
+```
+
+Changelog
+---------
+
+[CHANGELOG.md](./CHANGELOG.md)
+
+Any issues?
+-----------
+
+Please, report about issues
+[here](https://github.com/unclechu/node-deep-extend/issues).
+
+License
+-------
+
+[MIT](./LICENSE)
diff --git a/node_modules/deep-extend/index.js b/node_modules/deep-extend/index.js
new file mode 100644
index 0000000..762d81e
--- /dev/null
+++ b/node_modules/deep-extend/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/deep-extend');
diff --git a/node_modules/deep-extend/lib/deep-extend.js b/node_modules/deep-extend/lib/deep-extend.js
new file mode 100644
index 0000000..651fd8d
--- /dev/null
+++ b/node_modules/deep-extend/lib/deep-extend.js
@@ -0,0 +1,150 @@
+/*!
+ * @description Recursive object extending
+ * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
+ * @license MIT
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013-2018 Viacheslav Lotsmanov
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+'use strict';
+
+function isSpecificValue(val) {
+ return (
+ val instanceof Buffer
+ || val instanceof Date
+ || val instanceof RegExp
+ ) ? true : false;
+}
+
+function cloneSpecificValue(val) {
+ if (val instanceof Buffer) {
+ var x = Buffer.alloc
+ ? Buffer.alloc(val.length)
+ : new Buffer(val.length);
+ val.copy(x);
+ return x;
+ } else if (val instanceof Date) {
+ return new Date(val.getTime());
+ } else if (val instanceof RegExp) {
+ return new RegExp(val);
+ } else {
+ throw new Error('Unexpected situation');
+ }
+}
+
+/**
+ * Recursive cloning array.
+ */
+function deepCloneArray(arr) {
+ var clone = [];
+ arr.forEach(function (item, index) {
+ if (typeof item === 'object' && item !== null) {
+ if (Array.isArray(item)) {
+ clone[index] = deepCloneArray(item);
+ } else if (isSpecificValue(item)) {
+ clone[index] = cloneSpecificValue(item);
+ } else {
+ clone[index] = deepExtend({}, item);
+ }
+ } else {
+ clone[index] = item;
+ }
+ });
+ return clone;
+}
+
+function safeGetProperty(object, property) {
+ return property === '__proto__' ? undefined : object[property];
+}
+
+/**
+ * Extening object that entered in first argument.
+ *
+ * Returns extended object or false if have no target object or incorrect type.
+ *
+ * If you wish to clone source object (without modify it), just use empty new
+ * object as first argument, like this:
+ * deepExtend({}, yourObj_1, [yourObj_N]);
+ */
+var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
+ if (arguments.length < 1 || typeof arguments[0] !== 'object') {
+ return false;
+ }
+
+ if (arguments.length < 2) {
+ return arguments[0];
+ }
+
+ var target = arguments[0];
+
+ // convert arguments to array and cut off target object
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ var val, src, clone;
+
+ args.forEach(function (obj) {
+ // skip argument if isn't an object, is null, or is an array
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
+ return;
+ }
+
+ Object.keys(obj).forEach(function (key) {
+ src = safeGetProperty(target, key); // source value
+ val = safeGetProperty(obj, key); // new value
+
+ // recursion prevention
+ if (val === target) {
+ return;
+
+ /**
+ * if new value isn't object then just overwrite by new value
+ * instead of extending.
+ */
+ } else if (typeof val !== 'object' || val === null) {
+ target[key] = val;
+ return;
+
+ // just clone arrays (and recursive clone objects inside)
+ } else if (Array.isArray(val)) {
+ target[key] = deepCloneArray(val);
+ return;
+
+ // custom cloning and overwrite for specific objects
+ } else if (isSpecificValue(val)) {
+ target[key] = cloneSpecificValue(val);
+ return;
+
+ // overwrite by new value if source isn't object or array
+ } else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
+ target[key] = deepExtend({}, val);
+ return;
+
+ // source value and new value is objects both, extending...
+ } else {
+ target[key] = deepExtend(src, val);
+ return;
+ }
+ });
+ });
+
+ return target;
+};
diff --git a/node_modules/deep-extend/package.json b/node_modules/deep-extend/package.json
new file mode 100644
index 0000000..5f2195f
--- /dev/null
+++ b/node_modules/deep-extend/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "deep-extend",
+ "description": "Recursive object extending",
+ "license": "MIT",
+ "version": "0.6.0",
+ "homepage": "https://github.com/unclechu/node-deep-extend",
+ "keywords": [
+ "deep-extend",
+ "extend",
+ "deep",
+ "recursive",
+ "xtend",
+ "clone",
+ "merge",
+ "json"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://raw.githubusercontent.com/unclechu/node-deep-extend/master/LICENSE"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/unclechu/node-deep-extend.git"
+ },
+ "author": "Viacheslav Lotsmanov <lotsmanov89@gmail.com>",
+ "bugs": "https://github.com/unclechu/node-deep-extend/issues",
+ "contributors": [
+ {
+ "name": "Romain Prieto",
+ "url": "https://github.com/rprieto"
+ },
+ {
+ "name": "Max Maximov",
+ "url": "https://github.com/maxmaximov"
+ },
+ {
+ "name": "Marshall Bowers",
+ "url": "https://github.com/maxdeviant"
+ },
+ {
+ "name": "Misha Wakerman",
+ "url": "https://github.com/mwakerman"
+ }
+ ],
+ "main": "lib/deep-extend.js",
+ "engines": {
+ "node": ">=4.0.0"
+ },
+ "scripts": {
+ "test": "./node_modules/.bin/mocha"
+ },
+ "devDependencies": {
+ "mocha": "5.2.0",
+ "should": "13.2.1"
+ },
+ "files": [
+ "index.js",
+ "lib/"
+ ]
+}
diff --git a/node_modules/find-replace/LICENSE b/node_modules/find-replace/LICENSE
new file mode 100644
index 0000000..203018f
--- /dev/null
+++ b/node_modules/find-replace/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/find-replace/README.hbs b/node_modules/find-replace/README.hbs
new file mode 100644
index 0000000..76bac7c
--- /dev/null
+++ b/node_modules/find-replace/README.hbs
@@ -0,0 +1,11 @@
+[![view on npm](http://img.shields.io/npm/v/find-replace.svg)](https://www.npmjs.org/package/find-replace)
+[![npm module downloads](http://img.shields.io/npm/dt/find-replace.svg)](https://www.npmjs.org/package/find-replace)
+[![Build Status](https://travis-ci.org/75lb/find-replace.svg?branch=master)](https://travis-ci.org/75lb/find-replace)
+[![Dependency Status](https://david-dm.org/75lb/find-replace.svg)](https://david-dm.org/75lb/find-replace)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/find-replace/README.md b/node_modules/find-replace/README.md
new file mode 100644
index 0000000..b61b4e3
--- /dev/null
+++ b/node_modules/find-replace/README.md
@@ -0,0 +1,43 @@
+[![view on npm](http://img.shields.io/npm/v/find-replace.svg)](https://www.npmjs.org/package/find-replace)
+[![npm module downloads](http://img.shields.io/npm/dt/find-replace.svg)](https://www.npmjs.org/package/find-replace)
+[![Build Status](https://travis-ci.org/75lb/find-replace.svg?branch=master)](https://travis-ci.org/75lb/find-replace)
+[![Dependency Status](https://david-dm.org/75lb/find-replace.svg)](https://david-dm.org/75lb/find-replace)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_find-replace"></a>
+
+## find-replace
+Find and either replace or remove items in an array.
+
+**Example**
+```js
+> const findReplace = require('find-replace')
+> const numbers = [ 1, 2, 3]
+
+> findReplace(numbers, n => n === 2, 'two')
+[ 1, 'two', 3 ]
+
+> findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+[ 1, [ 'two', 'zwei' ], 3 ]
+
+> findReplace(numbers, n => n === 2, 'two', 'zwei')
+[ 1, 'two', 'zwei', 3 ]
+
+> findReplace(numbers, n => n === 2) // no replacement, so remove
+[ 1, 3 ]
+```
+<a name="exp_module_find-replace--findReplace"></a>
+
+### findReplace(array, testFn, [...replaceWith]) ⇒ <code>array</code> ⏏
+**Kind**: Exported function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| array | <code>array</code> | The input array |
+| testFn | <code>testFn</code> | A predicate function which, if returning `true` causes the current item to be operated on. |
+| [...replaceWith] | <code>any</code> | If specified, found values will be replaced with these values, else removed. |
+
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/find-replace/dist/index.js b/node_modules/find-replace/dist/index.js
new file mode 100644
index 0000000..7203b91
--- /dev/null
+++ b/node_modules/find-replace/dist/index.js
@@ -0,0 +1,124 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.findReplace = factory());
+}(this, function () { 'use strict';
+
+ /**
+ * Takes any input and guarantees an array back.
+ *
+ * - converts array-like objects (e.g. `arguments`) to a real array
+ * - converts `undefined` to an empty array
+ * - converts any another other, singular value (including `null`) into an array containing that value
+ * - ignores input which is already an array
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * @param {*} - the input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+ function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ } else {
+ if (input === undefined) {
+ return []
+ } else if (isArrayLike(input)) {
+ return Array.prototype.slice.call(input)
+ } else {
+ return [ input ]
+ }
+ }
+ }
+
+ /**
+ * Find and either replace or remove items in an array.
+ *
+ * @module find-replace
+ * @example
+ * > const findReplace = require('find-replace')
+ * > const numbers = [ 1, 2, 3]
+ *
+ * > findReplace(numbers, n => n === 2, 'two')
+ * [ 1, 'two', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+ * [ 1, [ 'two', 'zwei' ], 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, 'two', 'zwei')
+ * [ 1, 'two', 'zwei', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2) // no replacement, so remove
+ * [ 1, 3 ]
+ */
+
+ /**
+ * @param {array} - The input array
+ * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on.
+ * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed.
+ * @returns {array}
+ * @alias module:find-replace
+ */
+ function findReplace (array, testFn) {
+ const found = [];
+ const replaceWiths = arrayify(arguments);
+ replaceWiths.splice(0, 2);
+
+ arrayify(array).forEach((value, index) => {
+ let expanded = [];
+ replaceWiths.forEach(replaceWith => {
+ if (typeof replaceWith === 'function') {
+ expanded = expanded.concat(replaceWith(value));
+ } else {
+ expanded.push(replaceWith);
+ }
+ });
+
+ if (testFn(value)) {
+ found.push({
+ index: index,
+ replaceWithValue: expanded
+ });
+ }
+ });
+
+ found.reverse().forEach(item => {
+ const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue);
+ array.splice.apply(array, spliceArgs);
+ });
+
+ return array
+ }
+
+ return findReplace;
+
+}));
diff --git a/node_modules/find-replace/dist/index.mjs b/node_modules/find-replace/dist/index.mjs
new file mode 100644
index 0000000..715c1dd
--- /dev/null
+++ b/node_modules/find-replace/dist/index.mjs
@@ -0,0 +1,116 @@
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - converts array-like objects (e.g. `arguments`) to a real array
+ * - converts `undefined` to an empty array
+ * - converts any another other, singular value (including `null`) into an array containing that value
+ * - ignores input which is already an array
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - the input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ } else {
+ if (input === undefined) {
+ return []
+ } else if (isArrayLike(input)) {
+ return Array.prototype.slice.call(input)
+ } else {
+ return [ input ]
+ }
+ }
+}
+
+/**
+ * Find and either replace or remove items in an array.
+ *
+ * @module find-replace
+ * @example
+ * > const findReplace = require('find-replace')
+ * > const numbers = [ 1, 2, 3]
+ *
+ * > findReplace(numbers, n => n === 2, 'two')
+ * [ 1, 'two', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+ * [ 1, [ 'two', 'zwei' ], 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, 'two', 'zwei')
+ * [ 1, 'two', 'zwei', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2) // no replacement, so remove
+ * [ 1, 3 ]
+ */
+
+/**
+ * @param {array} - The input array
+ * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on.
+ * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed.
+ * @returns {array}
+ * @alias module:find-replace
+ */
+function findReplace (array, testFn) {
+ const found = [];
+ const replaceWiths = arrayify(arguments);
+ replaceWiths.splice(0, 2);
+
+ arrayify(array).forEach((value, index) => {
+ let expanded = [];
+ replaceWiths.forEach(replaceWith => {
+ if (typeof replaceWith === 'function') {
+ expanded = expanded.concat(replaceWith(value));
+ } else {
+ expanded.push(replaceWith);
+ }
+ });
+
+ if (testFn(value)) {
+ found.push({
+ index: index,
+ replaceWithValue: expanded
+ });
+ }
+ });
+
+ found.reverse().forEach(item => {
+ const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue);
+ array.splice.apply(array, spliceArgs);
+ });
+
+ return array
+}
+
+export default findReplace;
diff --git a/node_modules/find-replace/index.mjs b/node_modules/find-replace/index.mjs
new file mode 100644
index 0000000..dde6bd0
--- /dev/null
+++ b/node_modules/find-replace/index.mjs
@@ -0,0 +1,62 @@
+import arrayify from './node_modules/array-back/index.mjs'
+
+/**
+ * Find and either replace or remove items in an array.
+ *
+ * @module find-replace
+ * @example
+ * > const findReplace = require('find-replace')
+ * > const numbers = [ 1, 2, 3]
+ *
+ * > findReplace(numbers, n => n === 2, 'two')
+ * [ 1, 'two', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, [ 'two', 'zwei' ])
+ * [ 1, [ 'two', 'zwei' ], 3 ]
+ *
+ * > findReplace(numbers, n => n === 2, 'two', 'zwei')
+ * [ 1, 'two', 'zwei', 3 ]
+ *
+ * > findReplace(numbers, n => n === 2) // no replacement, so remove
+ * [ 1, 3 ]
+ */
+
+/**
+ * @param {array} - The input array
+ * @param {testFn} - A predicate function which, if returning `true` causes the current item to be operated on.
+ * @param [replaceWith] {...any} - If specified, found values will be replaced with these values, else removed.
+ * @returns {array}
+ * @alias module:find-replace
+ */
+function findReplace (array, testFn) {
+ const found = []
+ const replaceWiths = arrayify(arguments)
+ replaceWiths.splice(0, 2)
+
+ arrayify(array).forEach((value, index) => {
+ let expanded = []
+ replaceWiths.forEach(replaceWith => {
+ if (typeof replaceWith === 'function') {
+ expanded = expanded.concat(replaceWith(value))
+ } else {
+ expanded.push(replaceWith)
+ }
+ })
+
+ if (testFn(value)) {
+ found.push({
+ index: index,
+ replaceWithValue: expanded
+ })
+ }
+ })
+
+ found.reverse().forEach(item => {
+ const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue)
+ array.splice.apply(array, spliceArgs)
+ })
+
+ return array
+}
+
+export default findReplace
diff --git a/node_modules/find-replace/package.json b/node_modules/find-replace/package.json
new file mode 100644
index 0000000..4bebb38
--- /dev/null
+++ b/node_modules/find-replace/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "find-replace",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "3.0.0",
+ "description": "Find and either replace or remove items in an array",
+ "repository": "https://github.com/75lb/find-replace.git",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "find",
+ "replace",
+ "array",
+ "remove",
+ "splice"
+ ],
+ "engines": {
+ "node": ">=4.0.0"
+ },
+ "scripts": {
+ "test": "test-runner test.js",
+ "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo",
+ "dist": "rollup index.mjs -f umd -n findReplace -o dist/index.js && rollup index.mjs -f esm -o dist/index.mjs"
+ },
+ "devDependencies": {
+ "jsdoc-to-markdown": "^4.0.1",
+ "rollup": "^1.7.0",
+ "test-runner": "^0.5.1"
+ },
+ "dependencies": {
+ "array-back": "^3.0.1"
+ },
+ "files": [
+ "index.mjs",
+ "dist"
+ ]
+}
diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js
new file mode 100644
index 0000000..5139728
--- /dev/null
+++ b/node_modules/has-flag/index.js
@@ -0,0 +1,8 @@
+'use strict';
+module.exports = (flag, argv) => {
+ argv = argv || process.argv;
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
+ const pos = argv.indexOf(prefix + flag);
+ const terminatorPos = argv.indexOf('--');
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+};
diff --git a/node_modules/has-flag/license b/node_modules/has-flag/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/has-flag/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/has-flag/package.json b/node_modules/has-flag/package.json
new file mode 100644
index 0000000..e1eb17a
--- /dev/null
+++ b/node_modules/has-flag/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "has-flag",
+ "version": "3.0.0",
+ "description": "Check if argv has a specific flag",
+ "license": "MIT",
+ "repository": "sindresorhus/has-flag",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "has",
+ "check",
+ "detect",
+ "contains",
+ "find",
+ "flag",
+ "cli",
+ "command-line",
+ "argv",
+ "process",
+ "arg",
+ "args",
+ "argument",
+ "arguments",
+ "getopt",
+ "minimist",
+ "optimist"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/node_modules/has-flag/readme.md b/node_modules/has-flag/readme.md
new file mode 100644
index 0000000..677893c
--- /dev/null
+++ b/node_modules/has-flag/readme.md
@@ -0,0 +1,70 @@
+# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
+
+> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
+
+Correctly stops looking after an `--` argument terminator.
+
+
+## Install
+
+```
+$ npm install has-flag
+```
+
+
+## Usage
+
+```js
+// foo.js
+const hasFlag = require('has-flag');
+
+hasFlag('unicorn');
+//=> true
+
+hasFlag('--unicorn');
+//=> true
+
+hasFlag('f');
+//=> true
+
+hasFlag('-f');
+//=> true
+
+hasFlag('foo=bar');
+//=> true
+
+hasFlag('foo');
+//=> false
+
+hasFlag('rainbow');
+//=> false
+```
+
+```
+$ node foo.js -f --unicorn --foo=bar -- --rainbow
+```
+
+
+## API
+
+### hasFlag(flag, [argv])
+
+Returns a boolean for whether the flag exists.
+
+#### flag
+
+Type: `string`
+
+CLI flag to look for. The `--` prefix is optional.
+
+#### argv
+
+Type: `string[]`<br>
+Default: `process.argv`
+
+CLI arguments.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/lodash.camelcase/LICENSE b/node_modules/lodash.camelcase/LICENSE
new file mode 100644
index 0000000..e0c69d5
--- /dev/null
+++ b/node_modules/lodash.camelcase/LICENSE
@@ -0,0 +1,47 @@
+Copyright jQuery Foundation and other contributors <https://jquery.org/>
+
+Based on Underscore.js, copyright Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/node_modules/lodash.camelcase/README.md b/node_modules/lodash.camelcase/README.md
new file mode 100644
index 0000000..333d437
--- /dev/null
+++ b/node_modules/lodash.camelcase/README.md
@@ -0,0 +1,18 @@
+# lodash.camelcase v4.3.0
+
+The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module.
+
+## Installation
+
+Using npm:
+```bash
+$ {sudo -H} npm i -g npm
+$ npm i --save lodash.camelcase
+```
+
+In Node.js:
+```js
+var camelCase = require('lodash.camelcase');
+```
+
+See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.camelcase) for more details.
diff --git a/node_modules/lodash.camelcase/index.js b/node_modules/lodash.camelcase/index.js
new file mode 100644
index 0000000..b6d8b3c
--- /dev/null
+++ b/node_modules/lodash.camelcase/index.js
@@ -0,0 +1,599 @@
+/**
+ * lodash (Custom Build) <https://lodash.com/>
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
+ * Released under MIT license <https://lodash.com/license>
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0;
+
+/** `Object#toString` result references. */
+var symbolTag = '[object Symbol]';
+
+/** Used to match words composed of alphanumeric characters. */
+var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+
+/** Used to match Latin Unicode letters (excluding mathematical operators). */
+var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
+
+/** Used to compose unicode character classes. */
+var rsAstralRange = '\\ud800-\\udfff',
+ rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
+ rsComboSymbolsRange = '\\u20d0-\\u20f0',
+ rsDingbatRange = '\\u2700-\\u27bf',
+ rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
+ rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
+ rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
+ rsPunctuationRange = '\\u2000-\\u206f',
+ rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
+ rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
+ rsVarRange = '\\ufe0e\\ufe0f',
+ rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
+
+/** Used to compose unicode capture groups. */
+var rsApos = "['\u2019]",
+ rsAstral = '[' + rsAstralRange + ']',
+ rsBreak = '[' + rsBreakRange + ']',
+ rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
+ rsDigits = '\\d+',
+ rsDingbat = '[' + rsDingbatRange + ']',
+ rsLower = '[' + rsLowerRange + ']',
+ rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
+ rsNonAstral = '[^' + rsAstralRange + ']',
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
+ rsUpper = '[' + rsUpperRange + ']',
+ rsZWJ = '\\u200d';
+
+/** Used to compose unicode regexes. */
+var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
+ rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+ reOptMod = rsModifier + '?',
+ rsOptVar = '[' + rsVarRange + ']?',
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
+ rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+/** Used to match apostrophes. */
+var reApos = RegExp(rsApos, 'g');
+
+/**
+ * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
+ * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
+ */
+var reComboMark = RegExp(rsCombo, 'g');
+
+/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+/** Used to match complex or compound words. */
+var reUnicodeWord = RegExp([
+ rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
+ rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
+ rsUpper + '+' + rsOptUpperContr,
+ rsDigits,
+ rsEmoji
+].join('|'), 'g');
+
+/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
+
+/** Used to detect strings that need a more robust regexp to match words. */
+var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+
+/** Used to map Latin Unicode letters to basic Latin letters. */
+var deburredLetters = {
+ // Latin-1 Supplement block.
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss',
+ // Latin Extended-A block.
+ '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
+ '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
+ '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
+ '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
+ '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
+ '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
+ '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
+ '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
+ '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
+ '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
+ '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
+ '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
+ '\u0134': 'J', '\u0135': 'j',
+ '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
+ '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
+ '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
+ '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
+ '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
+ '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
+ '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
+ '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
+ '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
+ '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
+ '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
+ '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
+ '\u0163': 't', '\u0165': 't', '\u0167': 't',
+ '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
+ '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
+ '\u0174': 'W', '\u0175': 'w',
+ '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
+ '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
+ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
+ '\u0132': 'IJ', '\u0133': 'ij',
+ '\u0152': 'Oe', '\u0153': 'oe',
+ '\u0149': "'n", '\u017f': 'ss'
+};
+
+/** Detect free variable `global` from Node.js. */
+var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+/** Detect free variable `self`. */
+var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+/** Used as a reference to the global object. */
+var root = freeGlobal || freeSelf || Function('return this')();
+
+/**
+ * A specialized version of `_.reduce` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+function arrayReduce(array, iteratee, accumulator, initAccum) {
+ var index = -1,
+ length = array ? array.length : 0;
+
+ if (initAccum && length) {
+ accumulator = array[++index];
+ }
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
+}
+
+/**
+ * Converts an ASCII `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function asciiToArray(string) {
+ return string.split('');
+}
+
+/**
+ * Splits an ASCII `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+function asciiWords(string) {
+ return string.match(reAsciiWord) || [];
+}
+
+/**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+}
+
+/**
+ * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
+ * letters to basic Latin letters.
+ *
+ * @private
+ * @param {string} letter The matched letter to deburr.
+ * @returns {string} Returns the deburred letter.
+ */
+var deburrLetter = basePropertyOf(deburredLetters);
+
+/**
+ * Checks if `string` contains Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+ */
+function hasUnicode(string) {
+ return reHasUnicode.test(string);
+}
+
+/**
+ * Checks if `string` contains a word composed of Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a word is found, else `false`.
+ */
+function hasUnicodeWord(string) {
+ return reHasUnicodeWord.test(string);
+}
+
+/**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function stringToArray(string) {
+ return hasUnicode(string)
+ ? unicodeToArray(string)
+ : asciiToArray(string);
+}
+
+/**
+ * Converts a Unicode `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function unicodeToArray(string) {
+ return string.match(reUnicode) || [];
+}
+
+/**
+ * Splits a Unicode `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+function unicodeWords(string) {
+ return string.match(reUnicodeWord) || [];
+}
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/** Built-in value references. */
+var Symbol = root.Symbol;
+
+/** Used to convert symbols to primitives and strings. */
+var symbolProto = Symbol ? Symbol.prototype : undefined,
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
+
+/**
+ * The base implementation of `_.slice` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = end > length ? length : end;
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.toString` which doesn't convert nullish
+ * values to empty strings.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+function baseToString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return symbolToString ? symbolToString.call(value) : '';
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+}
+
+/**
+ * Casts `array` to a slice if it's needed.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {number} start The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the cast slice.
+ */
+function castSlice(array, start, end) {
+ var length = array.length;
+ end = end === undefined ? length : end;
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
+}
+
+/**
+ * Creates a function like `_.lowerFirst`.
+ *
+ * @private
+ * @param {string} methodName The name of the `String` case method to use.
+ * @returns {Function} Returns the new case function.
+ */
+function createCaseFirst(methodName) {
+ return function(string) {
+ string = toString(string);
+
+ var strSymbols = hasUnicode(string)
+ ? stringToArray(string)
+ : undefined;
+
+ var chr = strSymbols
+ ? strSymbols[0]
+ : string.charAt(0);
+
+ var trailing = strSymbols
+ ? castSlice(strSymbols, 1).join('')
+ : string.slice(1);
+
+ return chr[methodName]() + trailing;
+ };
+}
+
+/**
+ * Creates a function like `_.camelCase`.
+ *
+ * @private
+ * @param {Function} callback The function to combine each word.
+ * @returns {Function} Returns the new compounder function.
+ */
+function createCompounder(callback) {
+ return function(string) {
+ return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
+ };
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
+}
+
+/**
+ * Converts `value` to a string. An empty string is returned for `null`
+ * and `undefined` values. The sign of `-0` is preserved.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ * @example
+ *
+ * _.toString(null);
+ * // => ''
+ *
+ * _.toString(-0);
+ * // => '-0'
+ *
+ * _.toString([1, 2, 3]);
+ * // => '1,2,3'
+ */
+function toString(value) {
+ return value == null ? '' : baseToString(value);
+}
+
+/**
+ * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the camel cased string.
+ * @example
+ *
+ * _.camelCase('Foo Bar');
+ * // => 'fooBar'
+ *
+ * _.camelCase('--foo-bar--');
+ * // => 'fooBar'
+ *
+ * _.camelCase('__FOO_BAR__');
+ * // => 'fooBar'
+ */
+var camelCase = createCompounder(function(result, word, index) {
+ word = word.toLowerCase();
+ return result + (index ? capitalize(word) : word);
+});
+
+/**
+ * Converts the first character of `string` to upper case and the remaining
+ * to lower case.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to capitalize.
+ * @returns {string} Returns the capitalized string.
+ * @example
+ *
+ * _.capitalize('FRED');
+ * // => 'Fred'
+ */
+function capitalize(string) {
+ return upperFirst(toString(string).toLowerCase());
+}
+
+/**
+ * Deburrs `string` by converting
+ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+ * letters to basic Latin letters and removing
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to deburr.
+ * @returns {string} Returns the deburred string.
+ * @example
+ *
+ * _.deburr('déjà vu');
+ * // => 'deja vu'
+ */
+function deburr(string) {
+ string = toString(string);
+ return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
+}
+
+/**
+ * Converts the first character of `string` to upper case.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.upperFirst('fred');
+ * // => 'Fred'
+ *
+ * _.upperFirst('FRED');
+ * // => 'FRED'
+ */
+var upperFirst = createCaseFirst('toUpperCase');
+
+/**
+ * Splits `string` into an array of its words.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to inspect.
+ * @param {RegExp|string} [pattern] The pattern to match words.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the words of `string`.
+ * @example
+ *
+ * _.words('fred, barney, & pebbles');
+ * // => ['fred', 'barney', 'pebbles']
+ *
+ * _.words('fred, barney, & pebbles', /[^, ]+/g);
+ * // => ['fred', 'barney', '&', 'pebbles']
+ */
+function words(string, pattern, guard) {
+ string = toString(string);
+ pattern = guard ? undefined : pattern;
+
+ if (pattern === undefined) {
+ return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
+ }
+ return string.match(pattern) || [];
+}
+
+module.exports = camelCase;
diff --git a/node_modules/lodash.camelcase/package.json b/node_modules/lodash.camelcase/package.json
new file mode 100644
index 0000000..aca63e0
--- /dev/null
+++ b/node_modules/lodash.camelcase/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "lodash.camelcase",
+ "version": "4.3.0",
+ "description": "The lodash method `_.camelCase` exported as a module.",
+ "homepage": "https://lodash.com/",
+ "icon": "https://lodash.com/icon.svg",
+ "license": "MIT",
+ "keywords": "lodash-modularized, camelcase",
+ "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
+ "contributors": [
+ "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
+ "Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)",
+ "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
+ ],
+ "repository": "lodash/lodash",
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+}
diff --git a/node_modules/node-wifi/.eslintrc.json b/node_modules/node-wifi/.eslintrc.json
new file mode 100644
index 0000000..b9d7713
--- /dev/null
+++ b/node_modules/node-wifi/.eslintrc.json
@@ -0,0 +1,7 @@
+{
+ "extends": ["prettier", "eslint:recommended", "plugin:node/recommended"],
+ "plugins": ["jest"],
+ "env": {
+ "jest/globals": true
+ }
+}
diff --git a/node_modules/node-wifi/.prettierignore b/node_modules/node-wifi/.prettierignore
new file mode 100644
index 0000000..30d74d2
--- /dev/null
+++ b/node_modules/node-wifi/.prettierignore
@@ -0,0 +1 @@
+test \ No newline at end of file
diff --git a/node_modules/node-wifi/.prettierrc.json b/node_modules/node-wifi/.prettierrc.json
new file mode 100644
index 0000000..36b4861
--- /dev/null
+++ b/node_modules/node-wifi/.prettierrc.json
@@ -0,0 +1,7 @@
+{
+ "tabWidth": 2,
+ "semi": true,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "arrowParens": "avoid"
+}
diff --git a/node_modules/node-wifi/CHANGELOG.md b/node_modules/node-wifi/CHANGELOG.md
new file mode 100644
index 0000000..4fd2d48
--- /dev/null
+++ b/node_modules/node-wifi/CHANGELOG.md
@@ -0,0 +1,145 @@
+# Changelog
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+### [2.0.16](https://github.com/friedrith/node-wifi/compare/v2.0.16-alpha.0...v2.0.16) (2021-10-22)
+
+### [2.0.16-alpha.0](https://github.com/friedrith/node-wifi/compare/v2.0.15...v2.0.16-alpha.0) (2021-10-21)
+
+
+### Bug Fixes
+
+* hash integrity ([c33b4f3](https://github.com/friedrith/node-wifi/commit/c33b4f3842ff185fcfcbe3abf93178be8d947ed1))
+* quick but remove bssid for macOS Monterey ([a450bec](https://github.com/friedrith/node-wifi/commit/a450becd7b29692f0dc7668d9769e5c391193463))
+* vulnerable dependency ([5bb555d](https://github.com/friedrith/node-wifi/commit/5bb555dd9f2aca16c5520bdce9a9ec9025f91637))
+
+### [2.0.15](https://github.com/friedrith/node-wifi/compare/v2.0.14...v2.0.15) (2021-08-11)
+
+
+### Bug Fixes
+
+* **windows:** connect network for non-admin users ([#164](https://github.com/friedrith/node-wifi/issues/164)) ([08440d4](https://github.com/friedrith/node-wifi/commit/08440d4353f40d9229ceb91c6ce9f1e950f32994)), closes [#159](https://github.com/friedrith/node-wifi/issues/159)
+
+### [2.0.14](https://github.com/friedrith/node-wifi/compare/v2.0.13...v2.0.14) (2020-10-11)
+
+
+### Bug Fixes
+
+* dependencies vulnerabilities ([1066263](https://github.com/friedrith/node-wifi/commit/10662634725a314c5f585a33abf61cff3ea299f9))
+* mac connect for quasar electron apps ([8005de9](https://github.com/friedrith/node-wifi/commit/8005de94dd1d0d1220d6fa09a163f97c4a22deda))
+* **dependencies:** vulnerabilities ([#133](https://github.com/friedrith/node-wifi/issues/133)) ([47ad8a2](https://github.com/friedrith/node-wifi/commit/47ad8a220e7c691c4195d9d7b89ff204005e3d80))
+* **dependencies:** vulnerabilities ([#135](https://github.com/friedrith/node-wifi/issues/135)) ([9a2a50e](https://github.com/friedrith/node-wifi/commit/9a2a50ee9b503d8b6ed78d82f094ab3ea1ecc114))
+* **macos:** scripts ([#132](https://github.com/friedrith/node-wifi/issues/132)) ([36c938f](https://github.com/friedrith/node-wifi/commit/36c938f58cf66c377b631d15056d1fe359541b5d))
+* **macos/scan:** parse networks when shifted ([0fa69c7](https://github.com/friedrith/node-wifi/commit/0fa69c7aaaca44ea83c4019dab342396e742a581))
+* windows wifi scan issue fix for first network ([#138](https://github.com/friedrith/node-wifi/issues/138)) ([f6e878d](https://github.com/friedrith/node-wifi/commit/f6e878d48b91410929c5fe5f0a0ff39e34e50c56))
+
+### [2.0.13](https://github.com/friedrith/node-wifi/compare/v2.0.12...v2.0.13) (2020-07-01)
+
+
+### Bug Fixes
+
+* wifi connect issue fix for Windows ([8d992a6](https://github.com/friedrith/node-wifi/commit/8d992a6))
+
+### [2.0.12](https://github.com/friedrith/node-wifi/compare/v2.0.11...v2.0.12) (2019-09-06)
+
+
+### Bug Fixes
+
+* security vulnerability for cli (windows, mac and linux) ([a6668ca](https://github.com/friedrith/node-wifi/commit/a6668ca))
+* windows connection profile execute ([84549cb](https://github.com/friedrith/node-wifi/commit/84549cb)), closes [#78](https://github.com/friedrith/node-wifi/issues/78)
+
+### [2.0.11](https://github.com/friedrith/node-wifi/compare/v2.0.10...v2.0.11) (2019-09-01)
+
+
+### Bug Fixes
+
+* fix vulnerabilities ([f4b3965](https://github.com/friedrith/node-wifi/commit/f4b3965))
+
+### [2.0.10](https://github.com/friedrith/node-wifi/compare/v2.0.8...v2.0.10) (2019-09-01)
+
+### [2.0.9](https://github.com/friedrith/node-wifi/compare/v2.0.8...v2.0.9) (2019-09-01)
+
+### 2.0.8 (2019-09-01)
+
+### Bug Fixes
+
+- **dependencies:** bump lodash from 3.10.1 to 4.17.11 [#75](https://github.com/friedrith/node-wifi/issues/75) ([04a9477](https://github.com/friedrith/node-wifi/commit/04a9477))
+- **lint:** travis build ([08ab90e](https://github.com/friedrith/node-wifi/commit/08ab90e))
+- adapt chalk string syntax ([d27b027](https://github.com/friedrith/node-wifi/commit/d27b027))
+
+### 2.0.7
+
+### Bug Fixes
+
+- bug #66
+- bug #50
+
+### 2.0.6
+
+### Bug Fixes
+
+- bug #65
+- bug #73
+
+### 2.0.5
+
+- new license LGPL-3.0
+- add quality result which is as signal level but in percentage
+- change the environment settings for en_US
+- add new function to delete a previous profile #51
+
+### Bug Fixes
+
+- bug #38
+- errors while scanning on raspberry or ASUS Tinker Board issue #41
+
+### 2.0.4
+
+- change urls in package.json because of the author's login changed
+
+### Bug Fixes
+
+- bug #29
+
+### 2.0.3
+
+### Bug Fixes
+
+- bug #26
+
+### 2.0.2
+
+### Bug Fixes
+
+- bug #24
+
+### 2.0.1
+
+- improve stability of windows scan and current connection
+
+## 2.0.0
+
+- add disconnection feature on windows (issue #16)
+- add new fields in scan results (bssid equals to mac, channel, security_flags)
+- improve stability of linux scan
+
+### 1.2.5
+
+### Bug Fixes
+
+- bug #13
+
+### 1.2.4
+
+### Bug Fixes
+
+- bug introduced during #7 fix
+
+## 1.2.3
+
+- improve environment variables management
+
+### Bug Fixes
+
+- bug disconnection #9
+- bug #7
diff --git a/node_modules/node-wifi/CONTRIBUTING.md b/node_modules/node-wifi/CONTRIBUTING.md
new file mode 100644
index 0000000..a70b5bb
--- /dev/null
+++ b/node_modules/node-wifi/CONTRIBUTING.md
@@ -0,0 +1,99 @@
+# Contributing to Node-wifi
+
+:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
+
+## Found an Issue?
+
+Thank you for reporting any issues you find. We do our best to test and make `node-wifi` as solid as possible, but any reported issue is a real help.
+
+Please follow these guidelines when reporting issues:
+
+- Provide a title in the format of `<Error> when <Task>`
+- Tag your issue with the tag `bug`
+- Provide a short summary of what you are trying to do
+- Provide the log of the encountered error if applicable
+- Provide the exact version of `node-wifi`.
+- Be awesome and consider contributing a [pull request](#want-to-contribute)
+
+## Want to contribute?
+
+You consider contributing changes to `node-wifi` – we dig that!
+Please consider these guidelines when filing a pull request:
+
+- Follow the [Coding Rules](#coding-rules)
+- Follow the [Commit Rules](#commit-rules)
+- Make sure you rebased the current master branch when filing the pull request
+- Follow [Test guidelines](#tests)
+- Squash your commits when filing the pull request
+- Provide a short title with a maximum of 100 characters
+- Provide a more detailed description containing
+ _ What you want to achieve
+ _ What you changed
+ _ What you added
+ _ What you removed
+- For significant changes, post also an issue before to know if your idea has a chance to be accepted
+- Consider your development for windows, linux and macOS platforms at the same time
+ because having a module compatible with all platforms is the main concern of `node-wifi`.
+
+## Coding Rules
+
+To keep the code base of commitlint neat and tidy the following rules apply to every change
+
+- `prettier` is king
+- `eslint` is awesome
+- Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra)
+- Be awesome
+
+> use commands `npm run eslint` and `npm run format` to be sure your code
+> respect coding rules.
+
+> You can also use `npm run format:fix` to fix prettier errors
+
+## Commit Rules
+
+To help everyone with understanding the commit history of commitlint the following commit rules are enforced.
+
+- [conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/)
+- present tense
+- maximum of 100 characters
+- for bugs, includes the github tag of the issue in the description.
+- message format of `$type($scope): $message`
+
+These are the authorized types:
+
+- build
+- ci
+- chore
+- docs
+- feat
+- fix
+- perf
+- refactor
+- revert
+- style
+- test
+
+## Test
+
+If you add a feature or fix a bug, you need to provide a test verifying your
+improvement. You can launch tests using `npm run test`.
+
+If you fix a bug related to a parser, please provide a log of a command standard
+output. For example for a scan, use `node scripts/scan.js > file.log` to generate a
+log file. Check unit tests for more details.
+
+## Versioning
+
+`node-wifi` use [standard-version](https://github.com/conventional-changelog/standard-version) to handle versioning
+automatically. So you just need to follow commit rules and once the maintainer will want to release a version, he will use commands:
+
+```bash
+git pull origin master
+npm run release
+git push --follow-tags origin master && npm publish
+```
+
+> Please do not use these commands if you don't have write capabilities on the repository. We want to
+> have versions synchronized with npm so these commands should be executed in the same time.
+
+**May the force be with you !!**
diff --git a/node_modules/node-wifi/LICENSE b/node_modules/node-wifi/LICENSE
new file mode 100644
index 0000000..65ad969
--- /dev/null
+++ b/node_modules/node-wifi/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 gatsbyjs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/node-wifi/README.md b/node_modules/node-wifi/README.md
new file mode 100644
index 0000000..3a4fdeb
--- /dev/null
+++ b/node_modules/node-wifi/README.md
@@ -0,0 +1,196 @@
+<div align="center">
+<p>
+<img src="https://raw.githubusercontent.com/friedrith/assets/master/node-wifi/logo.png" alt="node-wifi" />
+<br>
+<br>
+<img src="https://img.shields.io/github/workflow/status/friedrith/node-wifi/build" alt="build" />
+<img src="https://img.shields.io/bundlephobia/min/node-wifi" alt="size" >
+<img src="https://img.shields.io/npm/v/node-wifi?color=green&label=npm%20package" alt= "version">
+</p>
+</div>
+
+> We think about switching to ES Modules only for next major release. We would like to have your opinion on this. Please consider leave a comment in the [discussion thread](https://github.com/friedrith/node-wifi/discussions/170).
+
+**I am looking for maintainers who could help me to handle all improvements and
+bug fixes about this project because the hardware/os dependencies make it quite
+hard to test.**
+
+The node-wifi module allows macOS, windows and linux users to interact with surrounding wifi networks through various methods. These methods include scanning for wifi access points and connecting to these access points.
+
+<div align="center">
+
+| Features | Linux | Mac | Windows |
+| ----------------------------- | ----- | --- | ------- |
+| Connect | ✓ | ✓ | ✓ |
+| Scan | ✓ | ✓ | ✓ |
+| List current wifi connections | ✓ | ✓ | ✓ |
+| Disconnect | ✓ | | ✓ |
+| Delete connection information | ✓ | ✓ | |
+
+</div>
+
+We wish to be clear in saying that this module is inspired from [node-wifi-control](https://github.com/msolters/wifi-control-node) but with some slight modifications to certain functions such as the various OS-specific parsers for terminal output as we noticed that these parsers did not work well on certain operating systems.
+
+> As everything with hardware dependencies, weird behaviors may happen depending of your configuration. You should never hesitate to notify us about a specificity of your OS/Hardware/Wifi card/whatever.
+
+---
+
+## Install
+
+```bash
+# Use as a module
+npm install node-wifi
+```
+
+## Getting started
+
+```javascript
+const wifi = require('node-wifi');
+
+// Initialize wifi module
+// Absolutely necessary even to set interface to null
+wifi.init({
+ iface: null // network interface, choose a random wifi interface if set to null
+});
+
+// Scan networks
+wifi.scan((error, networks) => {
+ if (error) {
+ console.log(error);
+ } else {
+ console.log(networks);
+ /*
+ networks = [
+ {
+ ssid: '...',
+ bssid: '...',
+ mac: '...', // equals to bssid (for retrocompatibility)
+ channel: <number>,
+ frequency: <number>, // in MHz
+ signal_level: <number>, // in dB
+ quality: <number>, // same as signal level but in %
+ security: 'WPA WPA2' // format depending on locale for open networks in Windows
+ security_flags: '...' // encryption protocols (format currently depending of the OS)
+ mode: '...' // network mode like Infra (format currently depending of the OS)
+ },
+ ...
+ ];
+ */
+ }
+});
+
+// Connect to a network
+wifi.connect({ ssid: 'ssid', password: 'password' }, () => {
+ console.log('Connected');
+ // on windows, the callback is called even if the connection failed due to netsh limitations
+ // if your software may work on windows, you should use `wifi.getCurrentConnections` to check if the connection succeeded
+});
+
+// Disconnect from a network
+// not available on all os for now
+wifi.disconnect(error => {
+ if (error) {
+ console.log(error);
+ } else {
+ console.log('Disconnected');
+ }
+});
+
+// Delete a saved network
+// not available on all os for now
+wifi.deleteConnection({ ssid: 'ssid' }, error => {
+ if (error) {
+ console.log(error);
+ } else {
+ console.log('Deleted');
+ }
+});
+
+// List the current wifi connections
+wifi.getCurrentConnections((error, currentConnections) => {
+ if (error) {
+ console.log(error);
+ } else {
+ console.log(currentConnections);
+ /*
+ // you may have several connections
+ [
+ {
+ iface: '...', // network interface used for the connection, not available on macOS
+ ssid: '...',
+ bssid: '...',
+ mac: '...', // equals to bssid (for retrocompatibility)
+ channel: <number>,
+ frequency: <number>, // in MHz
+ signal_level: <number>, // in dB
+ quality: <number>, // same as signal level but in %
+ security: '...' //
+ security_flags: '...' // encryption protocols (format currently depending of the OS)
+ mode: '...' // network mode like Infra (format currently depending of the OS)
+ }
+ ]
+ */
+ }
+});
+
+// All functions also return promise if there is no callback given
+wifi
+ .scan()
+ .then(networks => {
+ // networks
+ })
+ .catch(error => {
+ // error
+ });
+```
+
+
+## Use as CLI
+
+`node-wifi` is also usable as a CLI tool with the library [node-wifi-cli](https://github.com/friedrith/node-wifi-cli).
+
+## Platforms compatibility
+
+This project is tested with operating systems:
+
+- macOS Catalina 10.15.5
+- macOS Big Sur 11.5.1
+- linux Ubuntu 18.04.3 LTS
+
+> Do not hesitate to create a pull request to add the OS you are using.
+
+## Dependencies
+
+Linux:
+
+- network-manager (nmcli)
+
+Windows:
+
+- netsh
+
+MacOS:
+
+- airport
+- networksetup
+
+## Contribute
+
+Please read [development guidelines](./CONTRIBUTING.md) before proposing a pull request.
+
+## Roadmap
+
+- [x] add conventional commits
+- [x] plug to travis
+- [x] add github templates
+- [x] add eslint
+- [x] add prettier
+- [x] switch to MIT license
+- [x] generate changelog and release note
+- [x] stdout how to reproduce bug
+- [x] use github actions
+- [ ] add unit tests (in progress)
+- [ ] rewrite the library using ES7 (in progress)
+- [ ] harmonize security flags and modes
+- [ ] install commitizen
+- [ ] use xml to stabilize parsers
diff --git a/node_modules/node-wifi/bin/help.js b/node_modules/node-wifi/bin/help.js
new file mode 100644
index 0000000..eefc261
--- /dev/null
+++ b/node_modules/node-wifi/bin/help.js
@@ -0,0 +1,78 @@
+const optionDefinitions = [
+ {
+ name: 'scan',
+ type: Boolean,
+ description:
+ 'Scan for wifi networks. It returns a JSON formatted response with ssid, bssid, frequency, signal level and security for every network detected.'
+ },
+ {
+ name: 'connect',
+ type: Boolean,
+ description:
+ 'Connect to a wifi network. It needs options {bold --ssid} and {bold --password}. A specific interface may be selected by adding option {bold --iface}'
+ },
+ {
+ name: 'disconnect',
+ type: Boolean,
+ description:
+ 'Disconnect from a wifi network. A specific interface may be selected by adding option {bold --iface}'
+ },
+ {
+ name: 'current',
+ type: Boolean,
+ description:
+ 'List the current wifi connections. A specific interface may be selected by adding option {bold --iface}'
+ },
+ {
+ name: 'delete',
+ type: Boolean,
+ description:
+ 'Delete the wifi config related to a specific network identified by a ssid. It needs options {bold --ssid}. A specific interface may be selected by adding option {bold --iface}'
+ },
+ {
+ name: 'ssid',
+ type: String,
+ typeLabel: '{underline ssid}',
+ description: 'Ssid to connect to the wifi.'
+ },
+ {
+ name: 'password',
+ type: String,
+ typeLabel: '{underline password}',
+ description: 'Password to connect to the wifi.'
+ },
+ {
+ name: 'iface',
+ type: String,
+ typeLabel: '{underline interface}',
+ description: 'Network interface to connect to the wifi.'
+ },
+ {
+ name: 'help',
+ alias: 'h',
+ type: Boolean,
+ description: 'Show the help.'
+ },
+ {
+ name: 'version',
+ alias: 'v',
+ type: Boolean,
+ description: 'Display the current version of node-wifi.'
+ }
+];
+
+const sections = [
+ {
+ header: 'Wifi',
+ content: 'Multi-OS tool to manage wifi.'
+ },
+ {
+ header: 'Options',
+ optionList: optionDefinitions
+ }
+];
+
+module.exports = {
+ sections,
+ optionDefinitions
+};
diff --git a/node_modules/node-wifi/bin/wifi.js b/node_modules/node-wifi/bin/wifi.js
new file mode 100755
index 0000000..a97cd76
--- /dev/null
+++ b/node_modules/node-wifi/bin/wifi.js
@@ -0,0 +1,128 @@
+#!/usr/bin/env node
+/* eslint-disable no-process-exit */
+
+'use strict';
+
+const commandLineArgs = require('command-line-args');
+const getUsage = require('command-line-usage');
+
+const packageJson = require('../package.json');
+
+const wifi = require('../src/wifi');
+const { sections, optionDefinitions } = require('./help');
+
+const usage = getUsage(sections);
+
+let options = null;
+
+const fgRed = '\x1b[31m'; // cf https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
+
+console.error(
+ `${fgRed}[Deprecated] node-wifi CLI is deprecated and will be removed in the next major release. Use node-wifi-cli instead.`
+);
+
+try {
+ options = commandLineArgs(optionDefinitions);
+} catch (e) {
+ console.error('Bad options, please see the help with option -h', e);
+ process.exit(2);
+}
+
+if (options.version) {
+ console.log(`Version ${packageJson.version}`);
+ process.exit(0);
+}
+
+if (options.help) {
+ console.log(usage);
+ process.exit(0);
+}
+
+let cmds = 0;
+
+if (options.connect) cmds++;
+if (options.disconnect) cmds++;
+if (options.scan) cmds++;
+if (options.current) cmds++;
+if (options.delete) cmds++;
+
+if (cmds > 1) {
+ console.error('You cannot do several operations at the same time');
+ process.exit(2);
+}
+
+if (
+ !options.connect &&
+ !options.scan &&
+ !options.disconnect &&
+ !options.current &&
+ !options.delete
+) {
+ console.log(usage);
+ process.exit(2);
+}
+
+wifi.init({
+ iface: options.iface
+});
+
+if (options.scan) {
+ wifi.scan((error, resp) => {
+ if (error) {
+ console.error(error);
+ process.exit(2);
+ } else {
+ console.log(resp);
+ }
+ });
+} else if (options.connect) {
+ if (!options.ssid || !options.password) {
+ console.error(usage);
+ process.exit(2);
+ }
+
+ const accessPoint = {
+ ssid: options.ssid,
+ password: options.password
+ };
+
+ wifi.connect(accessPoint, error => {
+ if (error) {
+ console.error(error);
+ process.exit(2);
+ }
+ });
+} else if (options.disconnect) {
+ wifi.disconnect(error => {
+ if (error) {
+ console.error(error);
+ process.exit(2);
+ }
+ });
+} else if (options.current) {
+ wifi.getCurrentConnections((error, currentConnections) => {
+ if (error) {
+ console.log(error);
+ process.exit(2);
+ } else {
+ console.log(currentConnections);
+ }
+ });
+} else if (options.delete) {
+ console.log('ok');
+ if (!options.ssid) {
+ console.error(usage);
+ process.exit(2);
+ }
+
+ const accessPoint = {
+ ssid: options.ssid
+ };
+
+ wifi.deleteConnection(accessPoint, error => {
+ if (error) {
+ console.error(error);
+ process.exit(2);
+ }
+ });
+}
diff --git a/node_modules/node-wifi/package.json b/node_modules/node-wifi/package.json
new file mode 100644
index 0000000..b448bf1
--- /dev/null
+++ b/node_modules/node-wifi/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "node-wifi",
+ "version": "2.0.16",
+ "description": "NodeJS tool to manage wifi",
+ "keywords": [
+ "wifi",
+ "multiplatform",
+ "node"
+ ],
+ "author": "Thibault Friedrich",
+ "contributors": [
+ "Thibault Friedrich <thibault.friedrich@gmail.com> (https://thibaultfriedrich.io)"
+ ],
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/friedrith/node-wifi.git"
+ },
+ "bugs": {
+ "url": "https://github.com/friedrith/node-wifi/issues"
+ },
+ "publishConfig": {
+ "registry": "https://registry.npmjs.org/"
+ },
+ "bin": {
+ "wifi": "bin/wifi.js"
+ },
+ "main": "src/wifi.js",
+ "directories": {
+ "test": "test"
+ },
+ "type": "commonjs",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "dependencies": {
+ "command-line-args": "^5.2.0",
+ "command-line-usage": "^6.1.1"
+ },
+ "devDependencies": {
+ "dotenv": "^10.0.0",
+ "eslint": "^7.32.0",
+ "eslint-config-prettier": "^8.3.0",
+ "eslint-plugin-jest": "^24.4.0",
+ "eslint-plugin-node": "^11.1.0",
+ "jest": "^27.0.6",
+ "prettier": "^2.3.2",
+ "standard-version": "^9.3.1"
+ },
+ "scripts": {
+ "test": "jest",
+ "lint": "eslint {src,bin}/**/*.js",
+ "format": "prettier --check '{src,bin}/**/*.js'",
+ "format:fix": "prettier --write '{src,bin}/**/*.js'",
+ "release": "standard-version"
+ }
+}
diff --git a/node_modules/node-wifi/src/__test__/unlogger.js b/node_modules/node-wifi/src/__test__/unlogger.js
new file mode 100644
index 0000000..d87f291
--- /dev/null
+++ b/node_modules/node-wifi/src/__test__/unlogger.js
@@ -0,0 +1,12 @@
+const fs = require('fs');
+
+module.exports = path =>
+ new Promise((resolve, reject) => {
+ fs.readFile(path, 'utf8', (error, data) => {
+ if (error) {
+ reject();
+ } else {
+ resolve(data.replace(/.*\n/, ''));
+ }
+ });
+ });
diff --git a/node_modules/node-wifi/src/env.js b/node_modules/node-wifi/src/env.js
new file mode 100644
index 0000000..b333b28
--- /dev/null
+++ b/node_modules/node-wifi/src/env.js
@@ -0,0 +1,5 @@
+module.exports = Object.assign(process.env, {
+ LANG: 'en_US.UTF-8',
+ LC_ALL: 'en_US.UTF-8',
+ LC_MESSAGES: 'en_US.UTF-8'
+});
diff --git a/node_modules/node-wifi/src/index.js b/node_modules/node-wifi/src/index.js
new file mode 100644
index 0000000..67e57cb
--- /dev/null
+++ b/node_modules/node-wifi/src/index.js
@@ -0,0 +1,52 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+
+const platform = require('./platform');
+
+let config = {
+ debug: false,
+ iface: null
+};
+
+const init = newConfig => {
+ config = {
+ ...config,
+ ...newConfig
+ };
+};
+
+const notAvailable = () => {
+ throw new Error('ERROR : not available for this OS');
+};
+
+const scan = () => {
+ if (!platform().scan) {
+ notAvailable();
+ }
+
+ const { command, parse } = platform().scan;
+
+ const scanWifi = config =>
+ execute(command(config)).then(output => parse(output));
+
+ return promiser(scanWifi)(config)();
+};
+
+const connect = accessPoint => {
+ if (!platform().connect) {
+ notAvailable();
+ }
+
+ const { command, parse } = platform().connect;
+
+ const connectWifi = config =>
+ execute(command(config)).then(output => parse(output));
+
+ return promiser(connectWifi)(config)(accessPoint);
+};
+
+module.exports = {
+ init,
+ scan,
+ connect
+};
diff --git a/node_modules/node-wifi/src/linux-connect.js b/node_modules/node-wifi/src/linux-connect.js
new file mode 100644
index 0000000..164c121
--- /dev/null
+++ b/node_modules/node-wifi/src/linux-connect.js
@@ -0,0 +1,45 @@
+const execFile = require('child_process').execFile;
+const env = require('./env');
+
+function connectToWifi(config, ap, callback) {
+ const args = [];
+ args.push('-w');
+ args.push('10');
+ args.push('device');
+ args.push('wifi');
+ args.push('connect');
+ args.push(ap.ssid);
+ args.push('password');
+ args.push(ap.password);
+
+ if (config.iface) {
+ args.push('ifname');
+ args.push(config.iface);
+ }
+
+ execFile('nmcli', args, { env }, (err, resp) => {
+ // Errors from nmcli came from stdout, we test presence of 'Error: ' string
+ if (resp.includes('Error: ')) {
+ err = new Error(resp.replace('Error: ', ''));
+ }
+ callback && callback(err);
+ });
+}
+
+module.exports = config => {
+ return (ap, callback) => {
+ if (callback) {
+ connectToWifi(config, ap, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ connectToWifi(config, ap, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/linux-current-connections.js b/node_modules/node-wifi/src/linux-current-connections.js
new file mode 100644
index 0000000..cec7005
--- /dev/null
+++ b/node_modules/node-wifi/src/linux-current-connections.js
@@ -0,0 +1,75 @@
+const execFile = require('child_process').execFile;
+const networkUtils = require('./utils/network-utils');
+const env = require('./env');
+
+function getCurrentConnection(config, callback) {
+ const args = [];
+ args.push('--terse');
+ args.push('--fields');
+ args.push(
+ 'active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags,device'
+ );
+ args.push('device');
+ args.push('wifi');
+
+ if (config.iface) {
+ args.push('list');
+ args.push('ifname');
+ args.push(config.iface);
+ }
+
+ execFile('nmcli', args, { env }, (err, scanResults) => {
+ if (err) {
+ callback && callback(err);
+ return;
+ }
+
+ const lines = scanResults.split('\n');
+
+ const networks = [];
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i] != '') {
+ const fields = lines[i].replace(/\\:/g, '&&').split(':');
+ if (fields[0] == 'yes') {
+ networks.push({
+ iface: fields[10].replace(/&&/g, ':'),
+ ssid: fields[1].replace(/&&/g, ':'),
+ bssid: fields[2].replace(/&&/g, ':'),
+ mac: fields[2].replace(/&&/g, ':'), // for retrocompatibility with version 1.x
+ mode: fields[3].replace(/&&/g, ':'),
+ channel: parseInt(fields[4].replace(/&&/g, ':')),
+ frequency: parseInt(fields[5].replace(/&&/g, ':')),
+ signal_level: networkUtils.dBFromQuality(
+ fields[6].replace(/&&/g, ':')
+ ),
+ quality: parseFloat(fields[6].replace(/&&/g, ':')),
+ security: fields[7].replace(/&&/g, ':'),
+ security_flags: {
+ wpa: fields[8].replace(/&&/g, ':'),
+ rsn: fields[9].replace(/&&/g, ':')
+ }
+ });
+ }
+ }
+ }
+ callback && callback(null, networks);
+ });
+}
+
+module.exports = config => {
+ return callback => {
+ if (callback) {
+ getCurrentConnection(config, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ getCurrentConnection(config, (err, connections) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(connections);
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/linux-delete.js b/node_modules/node-wifi/src/linux-delete.js
new file mode 100644
index 0000000..ed2356c
--- /dev/null
+++ b/node_modules/node-wifi/src/linux-delete.js
@@ -0,0 +1,33 @@
+const execFile = require('child_process').execFile;
+const env = require('./env');
+
+function deleteConnection(config, ap, callback) {
+ const args = [];
+ args.push('connection');
+ args.push('delete');
+ args.push('id');
+
+ args.push(ap.ssid);
+
+ execFile('nmcli', args, env, err => {
+ callback && callback(err);
+ });
+}
+
+module.exports = config => {
+ return (ap, callback) => {
+ if (callback) {
+ deleteConnection(config, ap, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ deleteConnection(config, ap, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/linux-disconnect.js b/node_modules/node-wifi/src/linux-disconnect.js
new file mode 100644
index 0000000..22ee4f6
--- /dev/null
+++ b/node_modules/node-wifi/src/linux-disconnect.js
@@ -0,0 +1,34 @@
+const execFile = require('child_process').execFile;
+const env = require('./env');
+
+function disconnect(config, callback) {
+ const args = [];
+ args.push('device');
+ args.push('disconnect');
+
+ if (config.iface) {
+ args.push(config.iface);
+ }
+
+ execFile('nmcli', args, { env }, err => {
+ callback && callback(err);
+ });
+}
+
+module.exports = config => {
+ return callback => {
+ if (callback) {
+ disconnect(config, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ disconnect(config, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/linux-scan.js b/node_modules/node-wifi/src/linux-scan.js
new file mode 100644
index 0000000..a3d3bc0
--- /dev/null
+++ b/node_modules/node-wifi/src/linux-scan.js
@@ -0,0 +1,9 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+const command = require('./linux/scan/command.js');
+const parse = require('./linux/scan/parser');
+
+const scanWifi = config =>
+ execute(command(config)).then(output => parse(output));
+
+module.exports = promiser(scanWifi);
diff --git a/node_modules/node-wifi/src/linux/__logs__/scan-01.log b/node_modules/node-wifi/src/linux/__logs__/scan-01.log
new file mode 100644
index 0000000..009b346
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/__logs__/scan-01.log
@@ -0,0 +1,16 @@
+$ nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list
+no:Linksys01777:31\:23\:03\:1A\:9F\:1C:Infra:11:2462 MHz:100:WPA2:(none):pair_ccmp group_ccmp psk
+no:Linksys01777-invité:31\:23\:03\:18\:9F\:1C:Infra:11:2462 MHz:100::(none):(none)
+no:EBOX_6070:00\:21\:6A\:75\:60\:22:Infra:11:2462 MHz:100:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+yes:Linksys01777_5GHz:31\:23\:03\:1A\:9F\:1D:Infra:36:5180 MHz:75:WPA2:(none):pair_ccmp group_ccmp psk
+no:NERMNET:61\:FF\:7B\:43\:B5\:27:Infra:1:2412 MHz:64:WPA2:(none):pair_tkip pair_ccmp group_tkip psk
+no:NERMNET:61\:FF\:7B\:43\:B5\:26:Infra:149:5745 MHz:64:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+no:VIRGIN172:B1\:EE\:0E\:E4\:FA\:1E:Infra:6:2437 MHz:62:WPA2:(none):pair_ccmp group_ccmp psk
+no:NERMNET:91\:48\:27\:4B\:7C\:5A:Infra:13:2472 MHz:55:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+no:VIRGIN660:D1\:D7\:75\:A2\:BC\:F6:Infra:6:2437 MHz:54:WPA2:(none):pair_ccmp group_ccmp psk
+no:VIDEOTRON9021:A1\:E4\:CB\:FB\:42\:38:Infra:11:2462 MHz:40:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E7:Infra:44:5220 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E5:Infra:100:5500 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no::A1\:6A\:BB\:E9\:FC\:E5:Infra:100:5500 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E6:Infra:1:2412 MHz:25:WPA2:(none):pair_ccmp group_ccmp psk
+
diff --git a/node_modules/node-wifi/src/linux/index.js b/node_modules/node-wifi/src/linux/index.js
new file mode 100644
index 0000000..a3b3d57
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/index.js
@@ -0,0 +1,3 @@
+const scan = require('./scan/index');
+
+module.exports = { scan };
diff --git a/node_modules/node-wifi/src/linux/scan/__logs__/scan-01.log b/node_modules/node-wifi/src/linux/scan/__logs__/scan-01.log
new file mode 100644
index 0000000..009b346
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/__logs__/scan-01.log
@@ -0,0 +1,16 @@
+$ nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list
+no:Linksys01777:31\:23\:03\:1A\:9F\:1C:Infra:11:2462 MHz:100:WPA2:(none):pair_ccmp group_ccmp psk
+no:Linksys01777-invité:31\:23\:03\:18\:9F\:1C:Infra:11:2462 MHz:100::(none):(none)
+no:EBOX_6070:00\:21\:6A\:75\:60\:22:Infra:11:2462 MHz:100:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+yes:Linksys01777_5GHz:31\:23\:03\:1A\:9F\:1D:Infra:36:5180 MHz:75:WPA2:(none):pair_ccmp group_ccmp psk
+no:NERMNET:61\:FF\:7B\:43\:B5\:27:Infra:1:2412 MHz:64:WPA2:(none):pair_tkip pair_ccmp group_tkip psk
+no:NERMNET:61\:FF\:7B\:43\:B5\:26:Infra:149:5745 MHz:64:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+no:VIRGIN172:B1\:EE\:0E\:E4\:FA\:1E:Infra:6:2437 MHz:62:WPA2:(none):pair_ccmp group_ccmp psk
+no:NERMNET:91\:48\:27\:4B\:7C\:5A:Infra:13:2472 MHz:55:WPA1 WPA2:pair_tkip pair_ccmp group_tkip psk:pair_tkip pair_ccmp group_tkip psk
+no:VIRGIN660:D1\:D7\:75\:A2\:BC\:F6:Infra:6:2437 MHz:54:WPA2:(none):pair_ccmp group_ccmp psk
+no:VIDEOTRON9021:A1\:E4\:CB\:FB\:42\:38:Infra:11:2462 MHz:40:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E7:Infra:44:5220 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E5:Infra:100:5500 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no::A1\:6A\:BB\:E9\:FC\:E5:Infra:100:5500 MHz:30:WPA2:(none):pair_ccmp group_ccmp psk
+no:BELL320:A1\:6A\:BB\:E9\:FC\:E6:Infra:1:2412 MHz:25:WPA2:(none):pair_ccmp group_ccmp psk
+
diff --git a/node_modules/node-wifi/src/linux/scan/__test__/command.spec.js b/node_modules/node-wifi/src/linux/scan/__test__/command.spec.js
new file mode 100644
index 0000000..ea630ff
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/__test__/command.spec.js
@@ -0,0 +1,33 @@
+const command = require('../command');
+
+describe('linux scan command', () => {
+ it('should generate basic command without iface', () => {
+ expect(command({ iface: null })).toEqual({
+ cmd: 'nmcli',
+ args: [
+ '--terse',
+ '--fields',
+ 'active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags',
+ 'device',
+ 'wifi',
+ 'list'
+ ]
+ });
+ });
+
+ it('should generate basic command with iface', () => {
+ expect(command({ iface: 'wlan0' })).toEqual({
+ cmd: 'nmcli',
+ args: [
+ '--terse',
+ '--fields',
+ 'active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags',
+ 'device',
+ 'wifi',
+ 'list',
+ 'ifname',
+ 'wlan0'
+ ]
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/linux/scan/__test__/parser.spec.js b/node_modules/node-wifi/src/linux/scan/__test__/parser.spec.js
new file mode 100644
index 0000000..955dbd8
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/__test__/parser.spec.js
@@ -0,0 +1,196 @@
+const path = require('path');
+const unlog = require('../../../__test__/unlogger');
+const parse = require('../parser');
+
+const log = filename => path.resolve(__dirname, '../__logs__/', filename);
+
+describe('parse linux scan output', () => {
+ it('should return wifi networks', async () => {
+ const output = await unlog(log('scan-01.log'));
+
+ const networks = parse(output);
+
+ expect(networks).toEqual([
+ {
+ ssid: 'Linksys01777',
+ bssid: '31:23:03:1A:9F:1C',
+ mac: '31:23:03:1A:9F:1C',
+ mode: 'Infra',
+ channel: 11,
+ frequency: 2462,
+ signal_level: -50,
+ quality: 100,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'Linksys01777-invité',
+ bssid: '31:23:03:18:9F:1C',
+ mac: '31:23:03:18:9F:1C',
+ mode: 'Infra',
+ channel: 11,
+ frequency: 2462,
+ signal_level: -50,
+ quality: 100,
+ security: '',
+ security_flags: { wpa: '(none)', rsn: '(none)' }
+ },
+ {
+ ssid: 'EBOX_6070',
+ bssid: '00:21:6A:75:60:22',
+ mac: '00:21:6A:75:60:22',
+ mode: 'Infra',
+ channel: 11,
+ frequency: 2462,
+ signal_level: -50,
+ quality: 100,
+ security: 'WPA1 WPA2',
+ security_flags: {
+ wpa: 'pair_tkip pair_ccmp group_tkip psk',
+ rsn: 'pair_tkip pair_ccmp group_tkip psk'
+ }
+ },
+ {
+ ssid: 'Linksys01777_5GHz',
+ bssid: '31:23:03:1A:9F:1D',
+ mac: '31:23:03:1A:9F:1D',
+ mode: 'Infra',
+ channel: 36,
+ frequency: 5180,
+ signal_level: -62.5,
+ quality: 75,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'NERMNET',
+ bssid: '61:FF:7B:43:B5:27',
+ mac: '61:FF:7B:43:B5:27',
+ mode: 'Infra',
+ channel: 1,
+ frequency: 2412,
+ signal_level: -68,
+ quality: 64,
+ security: 'WPA2',
+ security_flags: {
+ wpa: '(none)',
+ rsn: 'pair_tkip pair_ccmp group_tkip psk'
+ }
+ },
+ {
+ ssid: 'NERMNET',
+ bssid: '61:FF:7B:43:B5:26',
+ mac: '61:FF:7B:43:B5:26',
+ mode: 'Infra',
+ channel: 149,
+ frequency: 5745,
+ signal_level: -68,
+ quality: 64,
+ security: 'WPA1 WPA2',
+ security_flags: {
+ wpa: 'pair_tkip pair_ccmp group_tkip psk',
+ rsn: 'pair_tkip pair_ccmp group_tkip psk'
+ }
+ },
+ {
+ ssid: 'VIRGIN172',
+ bssid: 'B1:EE:0E:E4:FA:1E',
+ mac: 'B1:EE:0E:E4:FA:1E',
+ mode: 'Infra',
+ channel: 6,
+ frequency: 2437,
+ signal_level: -69,
+ quality: 62,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'NERMNET',
+ bssid: '91:48:27:4B:7C:5A',
+ mac: '91:48:27:4B:7C:5A',
+ mode: 'Infra',
+ channel: 13,
+ frequency: 2472,
+ signal_level: -72.5,
+ quality: 55,
+ security: 'WPA1 WPA2',
+ security_flags: {
+ wpa: 'pair_tkip pair_ccmp group_tkip psk',
+ rsn: 'pair_tkip pair_ccmp group_tkip psk'
+ }
+ },
+ {
+ ssid: 'VIRGIN660',
+ bssid: 'D1:D7:75:A2:BC:F6',
+ mac: 'D1:D7:75:A2:BC:F6',
+ mode: 'Infra',
+ channel: 6,
+ frequency: 2437,
+ signal_level: -73,
+ quality: 54,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'VIDEOTRON9021',
+ bssid: 'A1:E4:CB:FB:42:38',
+ mac: 'A1:E4:CB:FB:42:38',
+ mode: 'Infra',
+ channel: 11,
+ frequency: 2462,
+ signal_level: -80,
+ quality: 40,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'BELL320',
+ bssid: 'A1:6A:BB:E9:FC:E7',
+ mac: 'A1:6A:BB:E9:FC:E7',
+ mode: 'Infra',
+ channel: 44,
+ frequency: 5220,
+ signal_level: -85,
+ quality: 30,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'BELL320',
+ bssid: 'A1:6A:BB:E9:FC:E5',
+ mac: 'A1:6A:BB:E9:FC:E5',
+ mode: 'Infra',
+ channel: 100,
+ frequency: 5500,
+ signal_level: -85,
+ quality: 30,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: '',
+ bssid: 'A1:6A:BB:E9:FC:E5',
+ mac: 'A1:6A:BB:E9:FC:E5',
+ mode: 'Infra',
+ channel: 100,
+ frequency: 5500,
+ signal_level: -85,
+ quality: 30,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ },
+ {
+ ssid: 'BELL320',
+ bssid: 'A1:6A:BB:E9:FC:E6',
+ mac: 'A1:6A:BB:E9:FC:E6',
+ mode: 'Infra',
+ channel: 1,
+ frequency: 2412,
+ signal_level: -87.5,
+ quality: 25,
+ security: 'WPA2',
+ security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
+ }
+ ]);
+ });
+});
diff --git a/node_modules/node-wifi/src/linux/scan/command.js b/node_modules/node-wifi/src/linux/scan/command.js
new file mode 100644
index 0000000..8558270
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/command.js
@@ -0,0 +1,22 @@
+const command = config => {
+ const args = [
+ '--terse',
+ '--fields',
+ 'active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags',
+ 'device',
+ 'wifi',
+ 'list'
+ ];
+
+ if (config.iface) {
+ args.push('ifname');
+ args.push(config.iface);
+ }
+
+ return {
+ cmd: 'nmcli',
+ args
+ };
+};
+
+module.exports = command;
diff --git a/node_modules/node-wifi/src/linux/scan/index.js b/node_modules/node-wifi/src/linux/scan/index.js
new file mode 100644
index 0000000..822c85d
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/index.js
@@ -0,0 +1,4 @@
+const command = require('./command');
+const parse = require('./parser');
+
+module.exports = { command, parse };
diff --git a/node_modules/node-wifi/src/linux/scan/parser.js b/node_modules/node-wifi/src/linux/scan/parser.js
new file mode 100644
index 0000000..97f8490
--- /dev/null
+++ b/node_modules/node-wifi/src/linux/scan/parser.js
@@ -0,0 +1,51 @@
+const { dBFromPercentage } = require('../../utils/percentage-db');
+
+const matchBssid = line =>
+ line.match(
+ /[A-F0-9]{2}\\:[A-F0-9]{2}\\:[A-F0-9]{2}\\:[A-F0-9]{2}\\:[A-F0-9]{2}\\:[A-F0-9]{2}/
+ );
+
+const parse = stdout =>
+ stdout
+ .split('\n')
+ .filter(line => line !== '' && line.includes(':'))
+ .filter(line => matchBssid(line))
+ .map(line => {
+ const match = matchBssid(line);
+ const bssid = match[0].replace(/\\:/g, ':');
+
+ const fields = line.replace(match[0]).split(':');
+
+ const [
+ // eslint-disable-next-line no-unused-vars
+ active,
+ ssid,
+ // eslint-disable-next-line no-unused-vars
+ bssidAlreadyProcessed,
+ mode,
+ channel,
+ frequency,
+ quality,
+ security,
+ security_flags_wpa,
+ security_flags_rsn
+ ] = fields;
+
+ return {
+ ssid,
+ bssid,
+ mac: bssid, // for retrocompatibility with version 1.x
+ mode,
+ channel: parseInt(channel),
+ frequency: parseInt(frequency),
+ signal_level: dBFromPercentage(quality),
+ quality: parseInt(quality),
+ security: security !== '(none)' ? security : 'none',
+ security_flags: {
+ wpa: security_flags_wpa,
+ rsn: security_flags_rsn
+ }
+ };
+ });
+
+module.exports = parse;
diff --git a/node_modules/node-wifi/src/mac-connect.js b/node_modules/node-wifi/src/mac-connect.js
new file mode 100644
index 0000000..4b30c9a
--- /dev/null
+++ b/node_modules/node-wifi/src/mac-connect.js
@@ -0,0 +1,8 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+const connectWifiCommand = require('./macOS/connect/command.js');
+
+const connectWifi = (config, accessPoint) =>
+ execute(connectWifiCommand(config, accessPoint));
+
+module.exports = promiser(connectWifi);
diff --git a/node_modules/node-wifi/src/mac-current-connections.js b/node_modules/node-wifi/src/mac-current-connections.js
new file mode 100644
index 0000000..10dc5f6
--- /dev/null
+++ b/node_modules/node-wifi/src/mac-current-connections.js
@@ -0,0 +1,9 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+const command = require('./macOS/current-connections/command.js');
+const parse = require('./macOS/current-connections/parser');
+
+const currentConnectionWifi = config =>
+ execute(command(config)).then(output => parse(output));
+
+module.exports = promiser(currentConnectionWifi);
diff --git a/node_modules/node-wifi/src/mac-delete.js b/node_modules/node-wifi/src/mac-delete.js
new file mode 100644
index 0000000..c95a7f2
--- /dev/null
+++ b/node_modules/node-wifi/src/mac-delete.js
@@ -0,0 +1,9 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+const command = require('./macOS/delete/command.js');
+const parse = require('./macOS/delete/parser');
+
+const disconnectWifi = (config, accessPoint) =>
+ execute(command(config, accessPoint)).then(output => parse(output));
+
+module.exports = promiser(disconnectWifi);
diff --git a/node_modules/node-wifi/src/mac-scan.js b/node_modules/node-wifi/src/mac-scan.js
new file mode 100644
index 0000000..8894e6e
--- /dev/null
+++ b/node_modules/node-wifi/src/mac-scan.js
@@ -0,0 +1,9 @@
+const execute = require('./utils/executer');
+const promiser = require('./utils/promiser');
+const command = require('./macOS/scan/command.js');
+const parse = require('./macOS/scan/parser');
+
+const scanWifi = config =>
+ execute(command(config)).then(output => parse(output));
+
+module.exports = promiser(scanWifi);
diff --git a/node_modules/node-wifi/src/macOS/__logs__/current-connections-01.log b/node_modules/node-wifi/src/macOS/__logs__/current-connections-01.log
new file mode 100644
index 0000000..962c231
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/__logs__/current-connections-01.log
@@ -0,0 +1,17 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --getinfo
+ agrCtlRSSI: -50
+ agrExtRSSI: 0
+ agrCtlNoise: -92
+ agrExtNoise: 0
+ state: running
+ op mode: station
+ lastTxRate: 650
+ maxRate: 867
+lastAssocStatus: 0
+ 802.11 auth: open
+ link auth: wpa2-psk
+ BSSID: 31:23:3:1a:9f:1d
+ SSID: Linksys01227_5GHz
+ MCS: 7
+ channel: 36,80
+
diff --git a/node_modules/node-wifi/src/macOS/__logs__/delete-01.log b/node_modules/node-wifi/src/macOS/__logs__/delete-01.log
new file mode 100644
index 0000000..a68c10c
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/__logs__/delete-01.log
@@ -0,0 +1,3 @@
+$ /usr/sbin/networksetup -removepreferredwirelessnetwork en0 SSID
+Network SSID was not found in the preferred networks list
+
diff --git a/node_modules/node-wifi/src/macOS/__logs__/scan-01.log b/node_modules/node-wifi/src/macOS/__logs__/scan-01.log
new file mode 100644
index 0000000..0065777
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/__logs__/scan-01.log
@@ -0,0 +1,6 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ foo-bar f6:d1:6d:b3:d2:88 -86 6 Y ca WPA2(PSK/AES/AES)
+ VIRGO1732 c1:ee:0e:e4:fa:1f -86 36 Y CA WPA2(PSK/AES/AES)
+ NERMNET 34:e8:94:1e:fc:5c -55 1 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
+ NERMNET 45:ff:7b:43:b5:26 -64 149 Y US WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
diff --git a/node_modules/node-wifi/src/macOS/__logs__/scan-shifted.log b/node_modules/node-wifi/src/macOS/__logs__/scan-shifted.log
new file mode 100644
index 0000000..5677ddc
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/__logs__/scan-shifted.log
@@ -0,0 +1,7 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ NERMNET 18:ff:7b:43:b5:26 -64 149 Y US WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
+ Linksys02787-invité 12:23:03:18:9f:1c -33 11 Y US NONE
+ Linksys02787 10:23:03:1a:9f:1c -33 11 Y US WPA2(PSK/AES/AES)
+ NERMNET 18:ff:7b:43:b5:27 -53 1,+1 Y -- WPA2(PSK/TKIP,AES/TKIP)
+ \ No newline at end of file
diff --git a/node_modules/node-wifi/src/macOS/__logs__/scan-space.log b/node_modules/node-wifi/src/macOS/__logs__/scan-space.log
new file mode 100644
index 0000000..476b783
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/__logs__/scan-space.log
@@ -0,0 +1,5 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ Linksys02787 10:23:03:1a:9f:1c -33 11 Y US WPA2(PSK/AES/AES)
+ Terminus 1 1e:27:e2:fa:c6:32 -26 4 Y -- WPA2(PSK/AES/AES)
+ Linksys02787_5GHz 10:23:03:1a:9f:1d -51 36 Y US WPA2(PSK/AES/AES)
diff --git a/node_modules/node-wifi/src/macOS/connect/__test__/command.spec.js b/node_modules/node-wifi/src/macOS/connect/__test__/command.spec.js
new file mode 100644
index 0000000..358f07d
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/connect/__test__/command.spec.js
@@ -0,0 +1,23 @@
+const command = require('../command');
+
+describe('mac Os connect command', () => {
+ it('should generate command with default interface', () => {
+ const config = { iface: null };
+ const accessPoint = { ssid: 'foo', password: 'bar' };
+
+ expect(command(config, accessPoint)).toEqual({
+ cmd: '/usr/sbin/networksetup',
+ args: ['-setairportnetwork', 'en0', 'foo', 'bar']
+ });
+ });
+
+ it('should generate command with configured interface', () => {
+ const config = { iface: 'en2' };
+ const accessPoint = { ssid: 'foo', password: 'bar' };
+
+ expect(command(config, accessPoint)).toEqual({
+ cmd: '/usr/sbin/networksetup',
+ args: ['-setairportnetwork', 'en2', 'foo', 'bar']
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/connect/command.js b/node_modules/node-wifi/src/macOS/connect/command.js
new file mode 100644
index 0000000..e7d696b
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/connect/command.js
@@ -0,0 +1,15 @@
+const command = (config, accessPoint) => {
+ const args = ['-setairportnetwork'];
+
+ args.push(config.iface || 'en0');
+
+ args.push(accessPoint.ssid);
+ args.push(accessPoint.password);
+
+ return {
+ cmd: '/usr/sbin/networksetup',
+ args
+ };
+};
+
+module.exports = command;
diff --git a/node_modules/node-wifi/src/macOS/connect/index.js b/node_modules/node-wifi/src/macOS/connect/index.js
new file mode 100644
index 0000000..716a9d7
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/connect/index.js
@@ -0,0 +1,3 @@
+const command = require('./command');
+
+module.exports = { command };
diff --git a/node_modules/node-wifi/src/macOS/current-connections/__logs__/current-connections-01.log b/node_modules/node-wifi/src/macOS/current-connections/__logs__/current-connections-01.log
new file mode 100644
index 0000000..962c231
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/__logs__/current-connections-01.log
@@ -0,0 +1,17 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --getinfo
+ agrCtlRSSI: -50
+ agrExtRSSI: 0
+ agrCtlNoise: -92
+ agrExtNoise: 0
+ state: running
+ op mode: station
+ lastTxRate: 650
+ maxRate: 867
+lastAssocStatus: 0
+ 802.11 auth: open
+ link auth: wpa2-psk
+ BSSID: 31:23:3:1a:9f:1d
+ SSID: Linksys01227_5GHz
+ MCS: 7
+ channel: 36,80
+
diff --git a/node_modules/node-wifi/src/macOS/current-connections/__test__/command.spec.js b/node_modules/node-wifi/src/macOS/current-connections/__test__/command.spec.js
new file mode 100644
index 0000000..98dd779
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/__test__/command.spec.js
@@ -0,0 +1,10 @@
+const command = require('../command');
+
+describe('mac Os get current connections command', () => {
+ it('should generate basic command', () => {
+ expect(command()).toEqual({
+ cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
+ args: ['--getinfo']
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/current-connections/__test__/parser.spec.js b/node_modules/node-wifi/src/macOS/current-connections/__test__/parser.spec.js
new file mode 100644
index 0000000..539cf04
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/__test__/parser.spec.js
@@ -0,0 +1,27 @@
+const path = require('path');
+const unlog = require('../../../__test__/unlogger');
+const parse = require('../parser');
+
+const log = filename => path.resolve(__dirname, '../__logs__/', filename);
+
+describe('parse macOS get current connections output', () => {
+ it('should return current wifi networks', async () => {
+ const output = await unlog(log('current-connections-01.log'));
+
+ const connections = parse(output);
+
+ expect(connections).toEqual([
+ {
+ mac: '31:23:03:1a:9f:1d',
+ bssid: '31:23:03:1a:9f:1d',
+ ssid: 'Linksys01227_5GHz',
+ channel: '36,80',
+ frequency: 5180,
+ quality: 100,
+ signal_level: -50,
+ security: 'wpa2-psk',
+ security_flags: []
+ }
+ ]);
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/current-connections/command.js b/node_modules/node-wifi/src/macOS/current-connections/command.js
new file mode 100644
index 0000000..0ffe1ac
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/command.js
@@ -0,0 +1,6 @@
+const command = () => ({
+ cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
+ args: ['--getinfo']
+});
+
+module.exports = command;
diff --git a/node_modules/node-wifi/src/macOS/current-connections/index.js b/node_modules/node-wifi/src/macOS/current-connections/index.js
new file mode 100644
index 0000000..822c85d
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/index.js
@@ -0,0 +1,4 @@
+const command = require('./command');
+const parse = require('./parser');
+
+module.exports = { command, parse };
diff --git a/node_modules/node-wifi/src/macOS/current-connections/parser.js b/node_modules/node-wifi/src/macOS/current-connections/parser.js
new file mode 100644
index 0000000..c48abdf
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/current-connections/parser.js
@@ -0,0 +1,61 @@
+const { percentageFromDB } = require('../../utils/percentage-db');
+const frequencyFromChannel = require('../../utils/frequency-from-channel');
+
+const agrCtlRSSIRegex = /[ ]*agrCtlRSSI: (.*)/;
+const BSSIDRegex = /[ ]*BSSID: ([0-9A-Fa-f:]*)/;
+const SSIDRegex = /[ ]*SSID: (.*)/;
+const securityRegex = /[ ]*link auth: (.*)/;
+const channelRegex = /[ ]*channel: (.*)/;
+
+const formatMacAddress = mac =>
+ mac
+ .split(':')
+ .map(part => (part.length === 1 ? `0${part}` : part))
+ .join(':');
+
+const parse = stdout => {
+ const lines = stdout.split('\n');
+
+ const connections = [];
+ let connection = {};
+ lines.forEach(line => {
+ const matchAgrCtlRSSI = line.match(agrCtlRSSIRegex);
+ if (matchAgrCtlRSSI) {
+ connection.signal_level = parseInt(matchAgrCtlRSSI[1]);
+ connection.quality = percentageFromDB(connection.signal_level);
+ return;
+ }
+
+ const matchBSSID = line.match(BSSIDRegex);
+ if (matchBSSID) {
+ connection.bssid = formatMacAddress(matchBSSID[1]);
+ connection.mac = connection.bssid; // for retrocompatibility
+ return;
+ }
+
+ const matchSSID = line.match(SSIDRegex);
+ if (matchSSID) {
+ connection.ssid = matchSSID[1];
+ return;
+ }
+
+ const matchSecurity = line.match(securityRegex);
+ if (matchSecurity) {
+ connection.security = matchSecurity[1];
+ connection.security_flags = [];
+ return;
+ }
+
+ const matchChannel = line.match(channelRegex);
+ if (matchChannel) {
+ connection.channel = matchChannel[1];
+ connection.frequency = frequencyFromChannel(connection.channel);
+ connections.push(connection);
+ connection = {};
+ }
+ });
+
+ return connections;
+};
+
+module.exports = parse;
diff --git a/node_modules/node-wifi/src/macOS/delete/__logs__/delete-01.log b/node_modules/node-wifi/src/macOS/delete/__logs__/delete-01.log
new file mode 100644
index 0000000..a68c10c
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/__logs__/delete-01.log
@@ -0,0 +1,3 @@
+$ /usr/sbin/networksetup -removepreferredwirelessnetwork en0 SSID
+Network SSID was not found in the preferred networks list
+
diff --git a/node_modules/node-wifi/src/macOS/delete/__test__/command.spec.js b/node_modules/node-wifi/src/macOS/delete/__test__/command.spec.js
new file mode 100644
index 0000000..37c7540
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/__test__/command.spec.js
@@ -0,0 +1,21 @@
+const command = require('../command');
+
+describe('mac Os delete connection command', () => {
+ it('should generate basic command without iface', () => {
+ const config = { iface: null };
+ const accessPoint = { ssid: 'ssid' };
+ expect(command(config, accessPoint)).toEqual({
+ cmd: '/usr/sbin/networksetup',
+ args: ['-removepreferredwirelessnetwork', 'en0', 'ssid']
+ });
+ });
+
+ it('should generate basic command without iface', () => {
+ const config = { iface: 'en2' };
+ const accessPoint = { ssid: 'ssid' };
+ expect(command(config, accessPoint)).toEqual({
+ cmd: '/usr/sbin/networksetup',
+ args: ['-removepreferredwirelessnetwork', 'en2', 'ssid']
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/delete/__test__/parser.spec.js b/node_modules/node-wifi/src/macOS/delete/__test__/parser.spec.js
new file mode 100644
index 0000000..da6b35d
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/__test__/parser.spec.js
@@ -0,0 +1,15 @@
+const path = require('path');
+const unlog = require('../../../__test__/unlogger');
+const parse = require('../parser');
+
+const log = filename => path.resolve(__dirname, '../__logs__/', filename);
+
+describe('parse macOS delete output', () => {
+ it('should throw error', async () => {
+ const output = await unlog(log('delete-01.log'));
+
+ expect(() => parse(output)).toThrow(
+ 'Network SSID was not found in the preferred networks list'
+ );
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/delete/command.js b/node_modules/node-wifi/src/macOS/delete/command.js
new file mode 100644
index 0000000..e5e2b00
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/command.js
@@ -0,0 +1,14 @@
+const command = (config, accessPoint) => {
+ const args = ['-removepreferredwirelessnetwork'];
+
+ args.push(config.iface || 'en0');
+
+ args.push(accessPoint.ssid);
+
+ return {
+ cmd: '/usr/sbin/networksetup',
+ args
+ };
+};
+
+module.exports = command;
diff --git a/node_modules/node-wifi/src/macOS/delete/index.js b/node_modules/node-wifi/src/macOS/delete/index.js
new file mode 100644
index 0000000..716a9d7
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/index.js
@@ -0,0 +1,3 @@
+const command = require('./command');
+
+module.exports = { command };
diff --git a/node_modules/node-wifi/src/macOS/delete/parser.js b/node_modules/node-wifi/src/macOS/delete/parser.js
new file mode 100644
index 0000000..a73938f
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/delete/parser.js
@@ -0,0 +1,10 @@
+const parse = stdout => {
+ if (
+ stdout &&
+ stdout.includes('was not found in the preferred networks list')
+ ) {
+ throw new Error(stdout.trim());
+ }
+};
+
+module.exports = parse;
diff --git a/node_modules/node-wifi/src/macOS/index.js b/node_modules/node-wifi/src/macOS/index.js
new file mode 100644
index 0000000..304fd2a
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/index.js
@@ -0,0 +1,6 @@
+const scan = require('./scan');
+const connect = require('./connect');
+const getCurrentConnections = require('./current-connections');
+const deleteConnection = require('./delete');
+
+module.exports = { scan, connect, getCurrentConnections, deleteConnection };
diff --git a/node_modules/node-wifi/src/macOS/scan/__logs__/airport-xml-2.log b/node_modules/node-wifi/src/macOS/scan/__logs__/airport-xml-2.log
new file mode 100644
index 0000000..e929e2a
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__logs__/airport-xml-2.log
@@ -0,0 +1,3104 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan --xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<array>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b0:f8:70</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>44</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>44</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAdlZHVyb2FtAQaYJLBIYGwDASwwFAEAAA+sBAEAAA+sBAEAAA+sASgALRqt
+ ARf/////AAAAAAAAAAAAAAAAAAAAAAAAAD0WLAAEAAAAAAAAAAAAAAAAAAAA
+ AAAAAH8IBAAIAAAAAEC/DJB5gw+q/wAAqv8AIMAFAAAAAADDAgAp3RgAUPIC
+ AQGAAAOkAAAnpAAAQkNeAGIyLwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-89</integer>
+ <key>SSID</key>
+ <data>
+ ZWR1cm9hbQ==
+ </data>
+ <key>SSID_STR</key>
+ <string>eduroam</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b0:f8:72</string>
+ <key>CAPABILITIES</key>
+ <integer>1</integer>
+ <key>CHANNEL</key>
+ <integer>44</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>44</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAtFVFMtSW52aXRlcwEGmCSwSGBsAwEsLRqtARf/////AAAAAAAAAAAAAAAA
+ AAAAAAAAAD0WLAAEAAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5
+ gw+q/wAAqv8AIMAFAAAAAADDAgAp3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIy
+ LwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSSI</key>
+ <integer>-88</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUludml0ZXM=
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Invites</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:be:52:b2</string>
+ <key>CAPABILITIES</key>
+ <integer>1</integer>
+ <key>CHANNEL</key>
+ <integer>157</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OP_MODE</key>
+ <integer>1</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>157</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAtFVFMtSW52aXRlcwEGmCSwSGBsAwGdLRqtARf/////AAAAAAAAAAAAAAAA
+ AAAAAAAAAD0WnQAVAAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5
+ gw+q/wAAqv8AIMAFAAAAAADDAgA/3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIy
+ LwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSSI</key>
+ <integer>-87</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUludml0ZXM=
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Invites</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:be:52:b1</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>157</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OP_MODE</key>
+ <integer>1</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>157</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AApFVFMtQ2FtcHVzAQaYJLBIYGwDAZ0FBAABAAAwFAEAAA+sBAEAAA+sBAEA
+ AA+sASgACwUDAApodi0arQEX/////wAAAAAAAAAAAAAAAAAAAAAAAAA9Fp0A
+ FQAAAAAAAAAAAAAAAAAAAAAAAAB/CAQACAAAAABAvwyQeYMPqv8AAKr/ACDA
+ BQAAAAAAwwIAP90YAFDyAgEBgAADpAAAJ6QAAEJDXgBiMi8A3QcAC4YBBAgP
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>QBSS_LOAD_IE</key>
+ <dict>
+ <key>QBSS_AAC</key>
+ <integer>30312</integer>
+ <key>QBSS_CHAN_UTIL</key>
+ <integer>10</integer>
+ <key>QBSS_STA_COUNT</key>
+ <integer>3</integer>
+ </dict>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-87</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUNhbXB1cw==
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Campus</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:be:52:b0</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>157</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OP_MODE</key>
+ <integer>1</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>157</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAdlZHVyb2FtAQaYJLBIYGwDAZ0FBAABAAAwFAEAAA+sBAEAAA+sBAEAAA+s
+ ASgALRqtARf/////AAAAAAAAAAAAAAAAAAAAAAAAAD0WnQAVAAAAAAAAAAAA
+ AAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5gw+q/wAAqv8AIMAFAAAAAADDAgA/
+ 3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIyLwDdBwALhgEECA8=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-87</integer>
+ <key>SSID</key>
+ <data>
+ ZWR1cm9hbQ==
+ </data>
+ <key>SSID_STR</key>
+ <string>eduroam</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b0:f8:71</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>44</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>44</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AApFVFMtQ2FtcHVzAQaYJLBIYGwDASwwFAEAAA+sBAEAAA+sBAEAAA+sASgA
+ CwUCAAWhdy0arQEX/////wAAAAAAAAAAAAAAAAAAAAAAAAA9FiwABAAAAAAA
+ AAAAAAAAAAAAAAAAAAB/CAQACAAAAABAvwyQeYMPqv8AAKr/ACDABQAAAAAA
+ wwIAKd0YAFDyAgEBgAADpAAAJ6QAAEJDXgBiMi8A
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>QBSS_LOAD_IE</key>
+ <dict>
+ <key>QBSS_AAC</key>
+ <integer>30625</integer>
+ <key>QBSS_CHAN_UTIL</key>
+ <integer>5</integer>
+ <key>QBSS_STA_COUNT</key>
+ <integer>2</integer>
+ </dict>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-87</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUNhbXB1cw==
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Campus</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>17</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>40</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>17</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>44</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>17</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>48</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>17</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>56</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>60</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>64</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>104</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>108</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>112</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>116</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>136</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>140</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>144</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>24</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>153</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>157</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>161</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>165</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>1</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>APPLE_IE</key>
+ <dict>
+ <key>APPLE_IE_PRODUCT_ID</key>
+ <integer>119</integer>
+ <key>APPLE_IE_VERSION</key>
+ <integer>1</integer>
+ <key>APPLE_IE_WOW_SUPPORTED</key>
+ <true/>
+ <key>APPLE_IE_WSC_CAP</key>
+ <true/>
+ </dict>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>24:a0:74:7a:18:81</string>
+ <key>CAPABILITIES</key>
+ <integer>4369</integer>
+ <key>CHANNEL</key>
+ <integer>149</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>1040</integer>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>2543</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ ////AAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>149</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <true/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>1</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <true/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AA5sYWJvQTM0ODQgNUdoegEIjBKYJLBIYGwFBAIDAAAHRkNBICQBESgBESwB
+ ETABETQBGDgBGDwBGEABGGQBGGgBGGwBGHABGHQBGIQBGIgBGIwBGJABGJUB
+ HpkBHp0BHqEBHqUBHgAgAQAjAhkAMBgBAAAPrAICAAAPrAQAD6wCAQAAD6wC
+ AAAtGu8JF////wAAAAAAAAAAAAAAAAAAAAAAAAAAPRaVDQAAAAAAAAAAAAAA
+ AAAAAAAAAAAAfwgAAAAAAAAAQL8MslmCD+r/AADq/wAAwAUBmwAAAMMEAgIC
+ At0LABfyAQABAQAAAAfdBwADkwF3AyDdDgAX8gcAAQEGJKB0ehiB3QkAEBgC
+ AAAcAADdFgBQ8gEBAABQ8gIBAABQ8gIBAABQ8gLdGABQ8gIBAYAAA6QAACek
+ AABCQ14AYjIvAEYFAgABAAA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>6</integer>
+ <integer>9</integer>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>2</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-84</integer>
+ <key>SSID</key>
+ <data>
+ bGFib0EzNDg0IDVHaHo=
+ </data>
+ <key>SSID_STR</key>
+ <string>laboA3484 5Ghz</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260200882</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ 6v8AAOr/AAA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>-101</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>1</integer>
+ </dict>
+ <key>WPA_IE</key>
+ <dict>
+ <key>IE_KEY_WPA_AUTHSELS</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_WPA_MCIPHER</key>
+ <integer>2</integer>
+ <key>IE_KEY_WPA_UCIPHERS</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_WPA_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b1:1:b2</string>
+ <key>CAPABILITIES</key>
+ <integer>1</integer>
+ <key>CHANNEL</key>
+ <integer>132</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>132</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAtFVFMtSW52aXRlcwEGmCSwSGBsAwGEBxJDQSAkBBc0BB5kBSSEBCSVBSQg
+ AQAjAg8ALRqtARf/////AAAAAAAAAAAAAAAAAAAAAAAAAD0WhAAEAAAAAAAA
+ AAAAAAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5gw+q/wAAqv8AIMAFAAAAAADD
+ AgA+3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIyLwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSSI</key>
+ <integer>-82</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUludml0ZXM=
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Invites</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b1:1:b1</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>132</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>132</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AApFVFMtQ2FtcHVzAQaYJLBIYGwDAYQHEkNBICQEFzQEHmQFJIQEJJUFJCAB
+ ACMCDwAwFAEAAA+sBAEAAA+sBAEAAA+sASgACwUFABqhdy0arQEX/////wAA
+ AAAAAAAAAAAAAAAAAAAAAAA9FoQABAAAAAAAAAAAAAAAAAAAAAAAAAB/CAQA
+ CAAAAABAvwyQeYMPqv8AAKr/ACDABQAAAAAAwwIAPt0YAFDyAgEBgAADpAAA
+ J6QAAEJDXgBiMi8A
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>QBSS_LOAD_IE</key>
+ <dict>
+ <key>QBSS_AAC</key>
+ <integer>30625</integer>
+ <key>QBSS_CHAN_UTIL</key>
+ <integer>26</integer>
+ <key>QBSS_STA_COUNT</key>
+ <integer>5</integer>
+ </dict>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-82</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUNhbXB1cw==
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Campus</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>bc:9f:e4:b1:1:b0</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>132</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>132</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAdlZHVyb2FtAQaYJLBIYGwDAYQHEkNBICQEFzQEHmQFJIQEJJUFJCABACMC
+ DwAwFAEAAA+sBAEAAA+sBAEAAA+sASgALRqtARf/////AAAAAAAAAAAAAAAA
+ AAAAAAAAAD0WhAAEAAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5
+ gw+q/wAAqv8AIMAFAAAAAADDAgA+3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIy
+ LwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-82</integer>
+ <key>SSID</key>
+ <data>
+ ZWR1cm9hbQ==
+ </data>
+ <key>SSID_STR</key>
+ <string>eduroam</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>d8:47:32:af:ae:ff</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>149</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>1040</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>111</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ //8AAAEAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>149</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>1</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <true/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AA9UUC1MaW5rX0FGMDBfNUcBCIwSmCSwSGBsAwGVLRpvABf//wAAAQAAAAAA
+ AAAAAAAAAAAAAAAAAD0WlQUAAAAAAAAAAAAAAAAAAAAAAAAAADAUAQAAD6wE
+ AQAAD6wEAQAAD6wCAAB/CAAACAAAAAAA3RgAUPICAQEAAAOkAAAnpAAAQkNe
+ AGIyLwC/DLABwDH6/wwD+v8MA8AFAZsA+v/dkwBQ8gQQSgABEBBEAAECEDsA
+ AQMQRwAQOIMwkjCSGIOcd9hHMq+vxBAhAAdUUC1MaW5rECMACkFyY2hlciBD
+ NTAQJAADNC4wEEIAAzEuMBBUAAgABgBQ8gQAARARACBBQzEyMDAgV2lyZWxl
+ c3MgRHVhbCBCYW5kIFJvdXRlchAIAAIhDBA8AAECEEkABgA3KgABIN0HAAxD
+ AAAAAN0HAAznAAAAAA==
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>6</integer>
+ <integer>9</integer>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-67</integer>
+ <key>SSID</key>
+ <data>
+ VFAtTGlua19BRjAwXzVH
+ </data>
+ <key>SSID_STR</key>
+ <string>TP-Link_AF00_5G</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>834666928</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ +v8MA/r/DAM=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>-6</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>-101</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>1</integer>
+ </dict>
+ <key>WPS_PROB_RESP_IE</key>
+ <dict>
+ <key>IE_KEY_WPS_CFG_METHODS</key>
+ <integer>8460</integer>
+ <key>IE_KEY_WPS_DEV_NAME</key>
+ <string>AC1200 Wireless Dual Band Router</string>
+ <key>IE_KEY_WPS_DEV_NAME_DATA</key>
+ <data>
+ QUMxMjAwIFdpcmVsZXNzIER1YWwgQmFuZCBSb3V0ZXI=
+ </data>
+ <key>IE_KEY_WPS_MANUFACTURER</key>
+ <string>TP-Link</string>
+ <key>IE_KEY_WPS_MODEL_NAME</key>
+ <string>Archer C50</string>
+ <key>IE_KEY_WPS_MODEL_NUM</key>
+ <string>4.0</string>
+ <key>IE_KEY_WPS_PRIMARY_DEV_TYPE</key>
+ <dict>
+ <key>WPS_DEV_TYPE_CAT</key>
+ <integer>6</integer>
+ <key>WPS_DEV_TYPE_OUI</key>
+ <data>
+ AFDyBA==
+ </data>
+ <key>WPS_DEV_TYPE_SUB_CAT</key>
+ <integer>1</integer>
+ </dict>
+ <key>IE_KEY_WPS_RESP_TYPE</key>
+ <integer>3</integer>
+ <key>IE_KEY_WPS_RF_BANDS</key>
+ <integer>2</integer>
+ <key>IE_KEY_WPS_SC_STATE</key>
+ <integer>2</integer>
+ <key>IE_KEY_WPS_SERIAL_NUM</key>
+ <string>1.0</string>
+ <key>IE_KEY_WPS_UUID_E</key>
+ <data>
+ OIMwkjCSGIOcd9hHMq+vxA==
+ </data>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:72</string>
+ <key>CAPABILITIES</key>
+ <integer>1</integer>
+ <key>CHANNEL</key>
+ <integer>136</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>136</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAtFVFMtSW52aXRlcwEGmCSwSGBsAwGIBQQAAQAABxJDQSAkBBc0BB5kBSSE
+ BCSVBSQgAQAjAg8ALRqtARf/////AAAAAAAAAAAAAAAAAAAAAAAAAD0WiAAE
+ AAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAAAEC/DJB5gw+q/wAAqv8AIMAF
+ AAAAAADDAgA+3RgAUPICAQGAAAOkAAAnpAAAQkNeAGIyLwDdBwALhgEECA8=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSSI</key>
+ <integer>-66</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUludml0ZXM=
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Invites</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:71</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>136</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>136</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AApFVFMtQ2FtcHVzAQaYJLBIYGwDAYgFBAABAAAHEkNBICQEFzQEHmQFJIQE
+ JJUFJCABACMCDwAwFAEAAA+sBAEAAA+sBAEAAA+sASgACwUCAAHZeC0arQEX
+ /////wAAAAAAAAAAAAAAAAAAAAAAAAA9FogABAAAAAAAAAAAAAAAAAAAAAAA
+ AAB/CAQACAAAAABAvwyQeYMPqv8AAKr/ACDABQAAAAAAwwIAPt0YAFDyAgEB
+ gAADpAAAJ6QAAEJDXgBiMi8A3QcAC4YBBAgP
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>QBSS_LOAD_IE</key>
+ <dict>
+ <key>QBSS_AAC</key>
+ <integer>30937</integer>
+ <key>QBSS_CHAN_UTIL</key>
+ <integer>1</integer>
+ <key>QBSS_STA_COUNT</key>
+ <integer>2</integer>
+ </dict>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-66</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUNhbXB1cw==
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Campus</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>80211D_IE</key>
+ <dict>
+ <key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
+ <array>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>23</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>52</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>30</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>100</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>132</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>IE_KEY_80211D_FIRST_CHANNEL</key>
+ <integer>149</integer>
+ <key>IE_KEY_80211D_MAX_POWER</key>
+ <integer>36</integer>
+ <key>IE_KEY_80211D_NUM_CHANNELS</key>
+ <integer>5</integer>
+ </dict>
+ </array>
+ <key>IE_KEY_80211D_COUNTRY_CODE</key>
+ <string>CA</string>
+ </dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:70</string>
+ <key>CAPABILITIES</key>
+ <integer>17</integer>
+ <key>CHANNEL</key>
+ <integer>136</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>18</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ /////wAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>136</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAdlZHVyb2FtAQaYJLBIYGwDAYgFBAABAAAHEkNBICQEFzQEHmQFJIQEJJUF
+ JCABACMCDwAwFAEAAA+sBAEAAA+sBAEAAA+sASgALRqtARf/////AAAAAAAA
+ AAAAAAAAAAAAAAAAAD0WiAAEAAAAAAAAAAAAAAAAAAAAAAAAAH8IBAAIAAAA
+ AEC/DJB5gw+q/wAAqv8AIMAFAAAAAADDAgA+3RgAUPICAQGAAAOkAAAnpAAA
+ QkNeAGIyLwDdBwALhgEECA8=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-66</integer>
+ <key>SSID</key>
+ <data>
+ ZWR1cm9hbQ==
+ </data>
+ <key>SSID_STR</key>
+ <string>eduroam</string>
+ <key>VHT_CAPS</key>
+ <dict>
+ <key>INFO</key>
+ <integer>260274576</integer>
+ <key>SUPPORTED_MCS_SET</key>
+ <data>
+ qv8AAKr/ACA=
+ </data>
+ </dict>
+ <key>VHT_OP</key>
+ <dict>
+ <key>BASIC_MCS_SET</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG0</key>
+ <integer>0</integer>
+ <key>CHANNEL_CENTER_FREQUENCY_SEG1</key>
+ <integer>0</integer>
+ <key>CHANNEL_WIDTH</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>0:25:9c:da:c6:38</string>
+ <key>CAPABILITIES</key>
+ <integer>1073</integer>
+ <key>CHANNEL</key>
+ <integer>8</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>10</integer>
+ <key>IE</key>
+ <data>
+ AARNQVJTAQiChIuWDBIYJAMBCDAUAQAAD6wEAQAAD6wEAQAAD6wCAAAqAQAy
+ BDBIYGzdCQADfwEBAAD/f90KAAN/BAEAAgBAAN10AFDyBBBKAAEQEEQAAQIQ
+ OwABAxBHABAAAAAAAAAQAAAAACWc2sY4ECEADExpbmtzeXMgSW5jLhAjAAdX
+ UlQ1NEcyECQAB3YxLjUuMDEQQgABMBBUAAgABgBQ8gQAARARAAdXUlQ1NEcy
+ EAgAAgCEEDwAAQE=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>1</integer>
+ <integer>2</integer>
+ <integer>5</integer>
+ <integer>11</integer>
+ <integer>6</integer>
+ <integer>9</integer>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>2</integer>
+ </array>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-65</integer>
+ <key>SSID</key>
+ <data>
+ TUFSUw==
+ </data>
+ <key>SSID_STR</key>
+ <string>MARS</string>
+ <key>WPS_PROB_RESP_IE</key>
+ <dict>
+ <key>IE_KEY_WPS_CFG_METHODS</key>
+ <integer>132</integer>
+ <key>IE_KEY_WPS_DEV_NAME</key>
+ <string>WRT54G2</string>
+ <key>IE_KEY_WPS_DEV_NAME_DATA</key>
+ <data>
+ V1JUNTRHMg==
+ </data>
+ <key>IE_KEY_WPS_MANUFACTURER</key>
+ <string>Linksys Inc.</string>
+ <key>IE_KEY_WPS_MODEL_NAME</key>
+ <string>WRT54G2</string>
+ <key>IE_KEY_WPS_MODEL_NUM</key>
+ <string>v1.5.01</string>
+ <key>IE_KEY_WPS_PRIMARY_DEV_TYPE</key>
+ <dict>
+ <key>WPS_DEV_TYPE_CAT</key>
+ <integer>6</integer>
+ <key>WPS_DEV_TYPE_OUI</key>
+ <data>
+ AFDyBA==
+ </data>
+ <key>WPS_DEV_TYPE_SUB_CAT</key>
+ <integer>1</integer>
+ </dict>
+ <key>IE_KEY_WPS_RESP_TYPE</key>
+ <integer>3</integer>
+ <key>IE_KEY_WPS_RF_BANDS</key>
+ <integer>1</integer>
+ <key>IE_KEY_WPS_SC_STATE</key>
+ <integer>2</integer>
+ <key>IE_KEY_WPS_SERIAL_NUM</key>
+ <string>0</string>
+ <key>IE_KEY_WPS_UUID_E</key>
+ <data>
+ AAAAAAAAEAAAAAAlnNrGOA==
+ </data>
+ </dict>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:62</string>
+ <key>CAPABILITIES</key>
+ <integer>1057</integer>
+ <key>CHANNEL</key>
+ <integer>1</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>10</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ //8AAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>1</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAtFVFMtSW52aXRlcwEGmCSwSGBsAwEBKgEELRqtARf//wAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAD0WAQAEAAAAAAAAAAAAAAAAAAAAAAAAAEoOFAAKACwByAAU
+ AAUAGQB/CAUACAAAAABA3R4AkEwECL8MkAGAA///AAD//wAAwAUAAAAAAMMC
+ ADbdGABQ8gIBAYAAA6QAACekAABCQ14AYjIvAA==
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSSI</key>
+ <integer>-64</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUludml0ZXM=
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Invites</string>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:61</string>
+ <key>CAPABILITIES</key>
+ <integer>1041</integer>
+ <key>CHANNEL</key>
+ <integer>1</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>10</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ //8AAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>1</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AApFVFMtQ2FtcHVzAQaYJLBIYGwDAQEqAQQwFAEAAA+sBAEAAA+sBAEAAA+s
+ ASgACwUBAALZeC0arQEX//8AAAAAAAAAAAAAAAAAAAAAAAAAAAA9FgEABAAA
+ AAAAAAAAAAAAAAAAAAAAAABKDhQACgAsAcgAFAAFABkAfwgFAAgAAAAAQN0e
+ AJBMBAi/DJABgAP//wAA//8AAMAFAAAAAADDAgA23RgAUPICAQGAAAOkAAAn
+ pAAAQkNeAGIyLwA=
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>QBSS_LOAD_IE</key>
+ <dict>
+ <key>QBSS_AAC</key>
+ <integer>30937</integer>
+ <key>QBSS_CHAN_UTIL</key>
+ <integer>2</integer>
+ <key>QBSS_STA_COUNT</key>
+ <integer>1</integer>
+ </dict>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-64</integer>
+ <key>SSID</key>
+ <data>
+ RVRTLUNhbXB1cw==
+ </data>
+ <key>SSID_STR</key>
+ <string>ETS-Campus</string>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>AP_MODE</key>
+ <integer>2</integer>
+ <key>BEACON_INT</key>
+ <integer>100</integer>
+ <key>BSSID</key>
+ <string>f4:2e:7f:18:c7:60</string>
+ <key>CAPABILITIES</key>
+ <integer>1073</integer>
+ <key>CHANNEL</key>
+ <integer>1</integer>
+ <key>CHANNEL_FLAGS</key>
+ <integer>10</integer>
+ <key>EXT_CAPS</key>
+ <dict>
+ <key>BSS_TRANS_MGMT</key>
+ <integer>1</integer>
+ </dict>
+ <key>HT_CAPS_IE</key>
+ <dict>
+ <key>AMPDU_PARAMS</key>
+ <integer>23</integer>
+ <key>ASEL_CAPS</key>
+ <integer>0</integer>
+ <key>CAPS</key>
+ <integer>429</integer>
+ <key>EXT_CAPS</key>
+ <integer>0</integer>
+ <key>MCS_SET</key>
+ <data>
+ //8AAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>TXBF_CAPS</key>
+ <integer>0</integer>
+ </dict>
+ <key>HT_IE</key>
+ <dict>
+ <key>HT_BASIC_MCS_SET</key>
+ <data>
+ AAAAAAAAAAAAAAAAAAAAAA==
+ </data>
+ <key>HT_DUAL_BEACON</key>
+ <false/>
+ <key>HT_DUAL_CTS_PROT</key>
+ <false/>
+ <key>HT_LSIG_TXOP_PROT_FULL</key>
+ <false/>
+ <key>HT_NON_GF_STAS_PRESENT</key>
+ <true/>
+ <key>HT_OBSS_NON_HT_STAS_PRESENT</key>
+ <false/>
+ <key>HT_OP_MODE</key>
+ <integer>0</integer>
+ <key>HT_PCO_ACTIVE</key>
+ <false/>
+ <key>HT_PCO_PHASE</key>
+ <false/>
+ <key>HT_PRIMARY_CHAN</key>
+ <integer>1</integer>
+ <key>HT_PSMP_STAS_ONLY</key>
+ <false/>
+ <key>HT_RIFS_MODE</key>
+ <false/>
+ <key>HT_SECONDARY_BEACON</key>
+ <false/>
+ <key>HT_SECONDARY_CHAN_OFFSET</key>
+ <integer>0</integer>
+ <key>HT_SERVICE_INT</key>
+ <integer>0</integer>
+ <key>HT_STA_CHAN_WIDTH</key>
+ <false/>
+ <key>HT_TX_BURST_LIMIT</key>
+ <false/>
+ </dict>
+ <key>IE</key>
+ <data>
+ AAdlZHVyb2FtAQaYJLBIYGwDAQEqAQQwFAEAAA+sBAEAAA+sBAEAAA+sASgA
+ LRqtARf//wAAAAAAAAAAAAAAAAAAAAAAAAAAAD0WAQAEAAAAAAAAAAAAAAAA
+ AAAAAAAAAEoOFAAKACwByAAUAAUAGQB/CAUACAAAAABA3R4AkEwECL8MkAGA
+ A///AAD//wAAwAUAAAAAAMMCADbdGABQ8gIBAYAAA6QAACekAABCQ14AYjIv
+ AA==
+ </data>
+ <key>NOISE</key>
+ <integer>-92</integer>
+ <key>RATES</key>
+ <array>
+ <integer>12</integer>
+ <integer>18</integer>
+ <integer>24</integer>
+ <integer>36</integer>
+ <integer>48</integer>
+ <integer>54</integer>
+ </array>
+ <key>RSN_IE</key>
+ <dict>
+ <key>IE_KEY_RSN_AUTHSELS</key>
+ <array>
+ <integer>1</integer>
+ </array>
+ <key>IE_KEY_RSN_CAPS</key>
+ <dict>
+ <key>GTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>MFP_CAPABLE</key>
+ <false/>
+ <key>MFP_REQUIRED</key>
+ <false/>
+ <key>NO_PAIRWISE</key>
+ <false/>
+ <key>PRE_AUTH</key>
+ <false/>
+ <key>PTKSA_REPLAY_COUNTERS</key>
+ <integer>4</integer>
+ <key>RSN_CAPABILITIES</key>
+ <integer>40</integer>
+ </dict>
+ <key>IE_KEY_RSN_MCIPHER</key>
+ <integer>4</integer>
+ <key>IE_KEY_RSN_UCIPHERS</key>
+ <array>
+ <integer>4</integer>
+ </array>
+ <key>IE_KEY_RSN_VERSION</key>
+ <integer>1</integer>
+ </dict>
+ <key>RSSI</key>
+ <integer>-64</integer>
+ <key>SSID</key>
+ <data>
+ ZWR1cm9hbQ==
+ </data>
+ <key>SSID_STR</key>
+ <string>eduroam</string>
+ </dict>
+ <dict>
+ <key>AGE</key>
+ <integer>0</integer>
+ <key>APPLE_SWAP</key>
+ <true/>
+ <key>APPLE_SWAP_IE</key>
+ <dict>
+ <key>SWAP_IE_FEATURES</key>
+ <data>
+ AQAA
+ </data>
+ <key>SWAP_IE_FEATURE_INTERNET_CONNECTION_SHARING_ENABLED</key>
+ <true/>
+ <key>SWAP_IE_FEATURE_VERSION</key>
+ <integer>1</integer>
+ <key>SWAP_IE_MODEL_IDENTIFIER</key>
+ <string>iMac15,1
diff --git a/node_modules/node-wifi/src/macOS/scan/__logs__/scan-01.log b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-01.log
new file mode 100644
index 0000000..0065777
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-01.log
@@ -0,0 +1,6 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ foo-bar f6:d1:6d:b3:d2:88 -86 6 Y ca WPA2(PSK/AES/AES)
+ VIRGO1732 c1:ee:0e:e4:fa:1f -86 36 Y CA WPA2(PSK/AES/AES)
+ NERMNET 34:e8:94:1e:fc:5c -55 1 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
+ NERMNET 45:ff:7b:43:b5:26 -64 149 Y US WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
diff --git a/node_modules/node-wifi/src/macOS/scan/__logs__/scan-monterey.log b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-monterey.log
new file mode 100644
index 0000000..b8ad8a7
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-monterey.log
@@ -0,0 +1,6 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ XXXX-AMPLIFI -81 36 Y -- WPA2(PSK/AES/AES)
+ XXXX-AMPLIFI -65 36 Y -- WPA2(PSK/AES/AES)
+ XXXX-2.4GHz -27 11 Y -- WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
+ XXXX-5GHz -33 149 Y -- WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP) \ No newline at end of file
diff --git a/node_modules/node-wifi/src/macOS/scan/__logs__/scan-shifted.log b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-shifted.log
new file mode 100644
index 0000000..5677ddc
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-shifted.log
@@ -0,0 +1,7 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ NERMNET 18:ff:7b:43:b5:26 -64 149 Y US WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
+ Linksys02787-invité 12:23:03:18:9f:1c -33 11 Y US NONE
+ Linksys02787 10:23:03:1a:9f:1c -33 11 Y US WPA2(PSK/AES/AES)
+ NERMNET 18:ff:7b:43:b5:27 -53 1,+1 Y -- WPA2(PSK/TKIP,AES/TKIP)
+ \ No newline at end of file
diff --git a/node_modules/node-wifi/src/macOS/scan/__logs__/scan-space.log b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-space.log
new file mode 100644
index 0000000..476b783
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__logs__/scan-space.log
@@ -0,0 +1,5 @@
+$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan
+ SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
+ Linksys02787 10:23:03:1a:9f:1c -33 11 Y US WPA2(PSK/AES/AES)
+ Terminus 1 1e:27:e2:fa:c6:32 -26 4 Y -- WPA2(PSK/AES/AES)
+ Linksys02787_5GHz 10:23:03:1a:9f:1d -51 36 Y US WPA2(PSK/AES/AES)
diff --git a/node_modules/node-wifi/src/macOS/scan/__test__/command.spec.js b/node_modules/node-wifi/src/macOS/scan/__test__/command.spec.js
new file mode 100644
index 0000000..17da860
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__test__/command.spec.js
@@ -0,0 +1,10 @@
+const command = require('../command');
+
+describe('mac Os scan command', () => {
+ it('should generate basic command', () => {
+ expect(command()).toEqual({
+ cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
+ args: ['--scan']
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/scan/__test__/parser.spec.js b/node_modules/node-wifi/src/macOS/scan/__test__/parser.spec.js
new file mode 100644
index 0000000..7f5fca3
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/__test__/parser.spec.js
@@ -0,0 +1,208 @@
+const path = require('path');
+const unlog = require('../../../__test__/unlogger');
+const parse = require('../parser');
+
+const log = filename => path.resolve(__dirname, '../__logs__/', filename);
+
+describe('parse macOS scan output', () => {
+ it('should return wifi networks', async () => {
+ const output = await unlog(log('scan-01.log'));
+
+ const networks = parse(output);
+
+ expect(networks).toEqual([
+ {
+ mac: 'f6:d1:6d:b3:d2:88',
+ bssid: 'f6:d1:6d:b3:d2:88',
+ ssid: 'foo-bar',
+ channel: 6,
+ frequency: 2437,
+ quality: 28,
+ signal_level: '-86',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: 'c1:ee:0e:e4:fa:1f',
+ bssid: 'c1:ee:0e:e4:fa:1f',
+ ssid: 'VIRGO1732',
+ channel: 36,
+ frequency: 5180,
+ quality: 28,
+ signal_level: '-86',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '34:e8:94:1e:fc:5c',
+ bssid: '34:e8:94:1e:fc:5c',
+ ssid: 'NERMNET',
+ channel: 1,
+ frequency: 2412,
+ quality: 90,
+ signal_level: '-55',
+ security: 'WPA WPA2',
+ security_flags: ['(PSK/AES,TKIP/TKIP)', '(PSK/AES,TKIP/TKIP)']
+ },
+ {
+ mac: '45:ff:7b:43:b5:26',
+ bssid: '45:ff:7b:43:b5:26',
+ ssid: 'NERMNET',
+ channel: 149,
+ frequency: 5745,
+ quality: 72,
+ signal_level: '-64',
+ security: 'WPA WPA2',
+ security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
+ }
+ ]);
+ });
+
+ it('should return wifi networks with shifted lines', async () => {
+ const output = await unlog(log('scan-shifted.log'));
+
+ const networks = parse(output);
+
+ expect(networks).toEqual([
+ {
+ mac: '18:ff:7b:43:b5:26',
+ bssid: '18:ff:7b:43:b5:26',
+ ssid: 'NERMNET',
+ channel: 149,
+ frequency: 5745,
+ quality: 72,
+ signal_level: '-64',
+ security: 'WPA WPA2',
+ security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
+ },
+ {
+ mac: '12:23:03:18:9f:1c',
+ bssid: '12:23:03:18:9f:1c',
+ ssid: 'Linksys02787-invité',
+ channel: 11,
+ frequency: 2462,
+ quality: 134,
+ signal_level: '-33',
+ security: 'NONE',
+ security_flags: []
+ },
+ {
+ mac: '10:23:03:1a:9f:1c',
+ bssid: '10:23:03:1a:9f:1c',
+ ssid: 'Linksys02787',
+ channel: 11,
+ frequency: 2462,
+ quality: 134,
+ signal_level: '-33',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '18:ff:7b:43:b5:27',
+ bssid: '18:ff:7b:43:b5:27',
+ ssid: 'NERMNET',
+ channel: 1,
+ frequency: 2412,
+ quality: 94,
+ signal_level: '-53',
+ security: 'WPA2',
+ security_flags: ['(PSK/TKIP,AES/TKIP)']
+ }
+ ]);
+ });
+
+ it('should return wifi networks with space in ssid', async () => {
+ const output = await unlog(log('scan-space.log'));
+
+ const networks = parse(output);
+
+ expect(networks).toEqual([
+ {
+ mac: '10:23:03:1a:9f:1c',
+ bssid: '10:23:03:1a:9f:1c',
+ ssid: 'Linksys02787',
+ channel: 11,
+ frequency: 2462,
+ quality: 134,
+ signal_level: '-33',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '1e:27:e2:fa:c6:32',
+ bssid: '1e:27:e2:fa:c6:32',
+ ssid: 'Terminus 1',
+ channel: 4,
+ frequency: 2427,
+ quality: 148,
+ signal_level: '-26',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '10:23:03:1a:9f:1d',
+ bssid: '10:23:03:1a:9f:1d',
+ ssid: 'Linksys02787_5GHz',
+ channel: 36,
+ frequency: 5180,
+ quality: 98,
+ signal_level: '-51',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ }
+ ]);
+ });
+
+ it('should return wifi networks on macOS Monterey', async () => {
+ const output = await unlog(log('scan-monterey.log'));
+
+ const networks = parse(output);
+
+ expect(networks).toEqual([
+ {
+ mac: '',
+ bssid: '',
+ ssid: 'XXXX-AMPLIFI',
+ channel: 36,
+ frequency: 5180,
+ quality: 38,
+ signal_level: '-81',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '',
+ bssid: '',
+ ssid: 'XXXX-AMPLIFI',
+ channel: 36,
+ frequency: 5180,
+ quality: 70,
+ signal_level: '-65',
+ security: 'WPA2',
+ security_flags: ['(PSK/AES/AES)']
+ },
+ {
+ mac: '',
+ bssid: '',
+ ssid: 'XXXX-2.4GHz',
+ channel: 11,
+ frequency: 2462,
+ quality: 146,
+ signal_level: '-27',
+ security: 'WPA WPA2',
+ security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
+ },
+ {
+ mac: '',
+ bssid: '',
+ ssid: 'XXXX-5GHz',
+ channel: 149,
+ frequency: 5745,
+ quality: 134,
+ signal_level: '-33',
+ security: 'WPA WPA2',
+ security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
+ }
+ ]);
+ });
+});
diff --git a/node_modules/node-wifi/src/macOS/scan/command.js b/node_modules/node-wifi/src/macOS/scan/command.js
new file mode 100644
index 0000000..b91da45
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/command.js
@@ -0,0 +1,6 @@
+const command = () => ({
+ cmd: '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',
+ args: ['--scan']
+});
+
+module.exports = command;
diff --git a/node_modules/node-wifi/src/macOS/scan/index.js b/node_modules/node-wifi/src/macOS/scan/index.js
new file mode 100644
index 0000000..822c85d
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/index.js
@@ -0,0 +1,4 @@
+const command = require('./command');
+const parse = require('./parser');
+
+module.exports = { command, parse };
diff --git a/node_modules/node-wifi/src/macOS/scan/parser.js b/node_modules/node-wifi/src/macOS/scan/parser.js
new file mode 100644
index 0000000..7df0421
--- /dev/null
+++ b/node_modules/node-wifi/src/macOS/scan/parser.js
@@ -0,0 +1,73 @@
+const { percentageFromDB } = require('../../utils/percentage-db');
+const frequencyFromChannel = require('../../utils/frequency-from-channel');
+
+const isNotEmpty = line => line.trim() !== '';
+
+const parseSecurity = security => {
+ const securities =
+ security === 'NONE'
+ ? [{ protocole: 'NONE', flag: '' }]
+ : security
+ .split(' ')
+ .map(s => s.match(/(.*)\((.*)\)/))
+ .filter(Boolean)
+ .map(([, protocole, flag]) => ({
+ protocole,
+ flag
+ }));
+
+ return {
+ security: securities.map(s => s.protocole).join(' '),
+ security_flags: securities.filter(s => s.flag).map(s => `(${s.flag})`)
+ };
+};
+
+const parse = stdout => {
+ const lines = stdout.split('\n');
+
+ const [, ...otherLines] = lines;
+
+ const networks = otherLines
+ .filter(isNotEmpty)
+ .map(line => line.trim())
+ .map(line => {
+ const match = line.match(
+ /(.*)\s+([a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}|)\s+(-[0-9]+)\s+([0-9]+).*\s+([A-Z]+)\s+([a-zA-Z-]+)\s+([A-Z0-9(,)\s/]+)/
+ );
+
+ if (match) {
+ const [
+ ,
+ ssid,
+ bssid,
+ rssi,
+ channelStr,
+ // eslint-disable-next-line no-unused-vars
+ ht,
+ // eslint-disable-next-line no-unused-vars
+ countryCode,
+ security
+ ] = match;
+
+ const channel = parseInt(channelStr);
+
+ return {
+ mac: bssid, // for retrocompatibility
+ bssid,
+ ssid: ssid.trim(),
+ channel,
+ frequency: frequencyFromChannel(channel),
+ signal_level: rssi,
+ quality: percentageFromDB(rssi),
+ ...parseSecurity(security)
+ };
+ }
+
+ return false;
+ })
+ .filter(Boolean);
+
+ return networks;
+};
+
+module.exports = parse;
diff --git a/node_modules/node-wifi/src/platform.js b/node_modules/node-wifi/src/platform.js
new file mode 100644
index 0000000..d1db2e2
--- /dev/null
+++ b/node_modules/node-wifi/src/platform.js
@@ -0,0 +1,21 @@
+const linux = require('./linux');
+const macOS = require('./macOS');
+
+module.exports = () => {
+ let platform;
+
+ switch (process.platform) {
+ case 'linux':
+ platform = linux;
+ break;
+ case 'darwin':
+ platform = macOS;
+ break;
+ case 'win32':
+ break;
+ default:
+ throw new Error('ERROR : UNRECOGNIZED OS');
+ }
+
+ return platform;
+};
diff --git a/node_modules/node-wifi/src/utils/__test__/frequency-from-channel.spec.js b/node_modules/node-wifi/src/utils/__test__/frequency-from-channel.spec.js
new file mode 100644
index 0000000..e925be9
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/__test__/frequency-from-channel.spec.js
@@ -0,0 +1,11 @@
+const frequencyFromChannel = require('../frequency-from-channel');
+
+describe('frequencyFromChannel', () => {
+ it('should return 2437Hz', () => {
+ expect(frequencyFromChannel(6)).toEqual(2437);
+ });
+
+ it('should return 5180Hz', () => {
+ expect(frequencyFromChannel(36)).toEqual(5180);
+ });
+});
diff --git a/node_modules/node-wifi/src/utils/__test__/percentage-db.spec.js b/node_modules/node-wifi/src/utils/__test__/percentage-db.spec.js
new file mode 100644
index 0000000..f6f9b9d
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/__test__/percentage-db.spec.js
@@ -0,0 +1,13 @@
+const { percentageFromDB, dBFromPercentage } = require('../percentage-db');
+
+describe('qualityFromDB', () => {
+ it('should return quality when dB is string', () => {
+ expect(percentageFromDB('-86')).toEqual(28);
+ });
+});
+
+describe('dBFromQuality', () => {
+ it('should return dB when quality is string', () => {
+ expect(dBFromPercentage('28')).toEqual(-86);
+ });
+});
diff --git a/node_modules/node-wifi/src/utils/__test__/promiser.spec.js b/node_modules/node-wifi/src/utils/__test__/promiser.spec.js
new file mode 100644
index 0000000..b2754e4
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/__test__/promiser.spec.js
@@ -0,0 +1,66 @@
+const promiser = require('../promiser');
+
+const config = { foo: 'foo' };
+
+describe('promiser', () => {
+ it('should execute function without error and return promise if no callback provided', async () => {
+ const func = jest.fn(() => Promise.resolve('bar'));
+
+ const result = await promiser(func)(config)();
+
+ expect(func).toHaveBeenCalledWith(config);
+ expect(result).toEqual('bar');
+ });
+
+ it('should execute function with error and return promise if no callback provided', async () => {
+ expect.assertions(2);
+
+ const func = jest.fn(() => Promise.reject('error'));
+ try {
+ await promiser(func)(config)();
+ } catch (error) {
+ expect(func).toHaveBeenCalledWith(config);
+ expect(error).toEqual('error');
+ }
+ });
+
+ it('should execute function without error and call callback', done => {
+ const func = jest.fn(() => Promise.resolve('bar'));
+
+ promiser(func)(config)((error, result) => {
+ expect(func).toHaveBeenCalledWith(config);
+ expect(result).toEqual('bar');
+ done();
+ });
+ });
+
+ it('should execute function with error and return promise if no callback provided', done => {
+ const func = jest.fn(() => Promise.reject('error'));
+ promiser(func)(config)(error => {
+ expect(func).toHaveBeenCalledWith(config);
+ expect(error).toEqual('error');
+ done();
+ });
+ });
+
+ it('should execute function without error with all args and return promise if no callback provided', async () => {
+ const func = jest.fn(() => Promise.resolve('bar'));
+ const arg = { ssid: 'foo', password: 'bar' };
+
+ const result = await promiser(func)(config)(arg);
+
+ expect(func).toHaveBeenCalledWith(config, arg);
+ expect(result).toEqual('bar');
+ });
+
+ it('should execute function without error and call callback', done => {
+ const func = jest.fn(() => Promise.resolve('bar'));
+ const arg = { ssid: 'foo', password: 'bar' };
+
+ promiser(func)(config)(arg, (error, result) => {
+ expect(func).toHaveBeenCalledWith(config, arg);
+ expect(result).toEqual('bar');
+ done();
+ });
+ });
+});
diff --git a/node_modules/node-wifi/src/utils/executer.js b/node_modules/node-wifi/src/utils/executer.js
new file mode 100644
index 0000000..ebc9396
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/executer.js
@@ -0,0 +1,13 @@
+const { execFile } = require('child_process');
+const env = require('../env');
+
+module.exports = ({ cmd, args }) =>
+ new Promise((resolve, reject) => {
+ execFile(cmd, args, { env }, (error, output) => {
+ if (error) {
+ reject(error);
+ } else {
+ resolve(output);
+ }
+ });
+ });
diff --git a/node_modules/node-wifi/src/utils/frequency-from-channel.js b/node_modules/node-wifi/src/utils/frequency-from-channel.js
new file mode 100644
index 0000000..61e7e41
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/frequency-from-channel.js
@@ -0,0 +1,40 @@
+const channels = {};
+
+// cf [wlan channels frequency](https://en.wikipedia.org/wiki/List_of_WLAN_channels)
+
+let frequency = 2412;
+
+for (let i = 1; i < 15; i++) {
+ channels[i] = frequency;
+ frequency = frequency + 5;
+}
+
+frequency = 5180;
+
+for (let j = 36; j <= 64; j += 2) {
+ channels[j] = frequency;
+ frequency += 10;
+}
+
+frequency = 5500;
+
+for (let k = 100; k <= 144; k += 2) {
+ channels[k] = frequency;
+ frequency += 10;
+}
+
+frequency = 5745;
+
+for (let l = 149; l <= 161; l += 2) {
+ channels[l] = frequency;
+ frequency += 10;
+}
+
+frequency = 5825;
+
+for (let m = 165; m <= 173; m += 4) {
+ channels[m] = frequency;
+ frequency += 20;
+}
+
+module.exports = channel => channels[parseInt(channel)];
diff --git a/node_modules/node-wifi/src/utils/network-utils.js b/node_modules/node-wifi/src/utils/network-utils.js
new file mode 100644
index 0000000..f8b917f
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/network-utils.js
@@ -0,0 +1,54 @@
+const channels = {};
+
+// cf [wlan channels frequency](https://en.wikipedia.org/wiki/List_of_WLAN_channels)
+
+let frequency = 2412;
+
+for (let i = 1; i < 15; i++) {
+ channels[i] = frequency.toString();
+ frequency = frequency + 5;
+}
+
+frequency = 5180;
+
+for (let j = 36; j <= 64; j += 2) {
+ channels[j] = frequency.toString();
+ frequency += 10;
+}
+
+frequency = 5500;
+
+for (let k = 100; k <= 144; k += 2) {
+ channels[k] = frequency.toString();
+ frequency += 10;
+}
+
+frequency = 5745;
+
+for (let l = 149; l <= 161; l += 2) {
+ channels[l] = frequency.toString();
+ frequency += 10;
+}
+
+frequency = 5825;
+
+for (let m = 165; m <= 173; m += 4) {
+ channels[m] = frequency.toString();
+ frequency += 20;
+}
+
+function frequencyFromChannel(channelId) {
+ return channels[parseInt(channelId)];
+}
+
+function dBFromQuality(quality) {
+ return parseFloat(quality) / 2 - 100;
+}
+
+function qualityFromDB(db) {
+ return 2 * (parseFloat(db) + 100);
+}
+
+exports.frequencyFromChannel = frequencyFromChannel;
+exports.dBFromQuality = dBFromQuality;
+exports.qualityFromDB = qualityFromDB;
diff --git a/node_modules/node-wifi/src/utils/percentage-db.js b/node_modules/node-wifi/src/utils/percentage-db.js
new file mode 100644
index 0000000..dfb8fb0
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/percentage-db.js
@@ -0,0 +1,10 @@
+// cf [relation between quality and dB](https://www.netspotapp.com/what-is-rssi-level.html)
+
+const percentageFromDB = db => 2 * (parseFloat(db) + 100);
+
+const dBFromPercentage = quality => parseFloat(quality) / 2 - 100;
+
+module.exports = {
+ percentageFromDB,
+ dBFromPercentage
+};
diff --git a/node_modules/node-wifi/src/utils/promiser.js b/node_modules/node-wifi/src/utils/promiser.js
new file mode 100644
index 0000000..237e6dd
--- /dev/null
+++ b/node_modules/node-wifi/src/utils/promiser.js
@@ -0,0 +1,33 @@
+const extractArgs = allArgs => {
+ const callbackIndex = allArgs.length - 1;
+ if (callbackIndex >= 0 && typeof allArgs[callbackIndex] === 'function') {
+ return {
+ callback: allArgs[callbackIndex],
+ args: allArgs.slice(0, callbackIndex)
+ };
+ }
+
+ return {
+ callback: null,
+ args: allArgs
+ };
+};
+
+module.exports =
+ func =>
+ config =>
+ (...allArgs) => {
+ const { args, callback } = extractArgs(allArgs);
+
+ if (typeof callback === 'function') {
+ func(config, ...args)
+ .then(response => {
+ callback(null, response);
+ })
+ .catch(error => {
+ callback(error);
+ });
+ } else {
+ return func(config, ...args);
+ }
+ };
diff --git a/node_modules/node-wifi/src/wifi.js b/node_modules/node-wifi/src/wifi.js
new file mode 100644
index 0000000..3f0af56
--- /dev/null
+++ b/node_modules/node-wifi/src/wifi.js
@@ -0,0 +1,94 @@
+const windowsConnect = require('./windows-connect.js');
+const windowsScan = require('./windows-scan.js');
+const windowsDisconnect = require('./windows-disconnect.js');
+const windowsGetCurrentConnections = require('./windows-current-connections');
+const linuxConnect = require('./linux-connect');
+const linuxDisconnect = require('./linux-disconnect');
+const linuxDelete = require('./linux-delete');
+const linuxGetCurrentConnections = require('./linux-current-connections');
+const linuxScan = require('./linux-scan.js');
+const macConnect = require('./mac-connect.js');
+const macScan = require('./mac-scan.js');
+const macDelete = require('./mac-delete');
+const macGetCurrentConnections = require('./mac-current-connections');
+
+const config = {
+ debug: false,
+ iface: null
+};
+
+function init(options) {
+ if (options && options.debug) {
+ config.debug = options.debug;
+ }
+
+ if (options && options.iface) {
+ config.iface = options.iface;
+ }
+
+ let scan = () => {
+ throw new Error('ERROR : not available for this OS');
+ };
+ let connect = () => {
+ throw new Error('ERROR : not available for this OS');
+ };
+ let disconnect = () => {
+ throw new Error('ERROR : not available for this OS');
+ };
+ let deleteConnection = () => {
+ throw new Error('ERROR : not available for this OS');
+ };
+ let getCurrentConnections = () => {
+ throw new Error('ERROR : not available for this OS');
+ };
+
+ switch (process.platform) {
+ case 'linux':
+ connect = linuxConnect(config);
+ scan = linuxScan(config);
+ disconnect = linuxDisconnect(config);
+ deleteConnection = linuxDelete(config);
+ getCurrentConnections = linuxGetCurrentConnections(config);
+ break;
+ case 'darwin':
+ connect = macConnect(config);
+ scan = macScan(config);
+ deleteConnection = macDelete(config);
+ getCurrentConnections = macGetCurrentConnections(config);
+ break;
+ case 'win32':
+ connect = windowsConnect(config);
+ scan = windowsScan(config);
+ disconnect = windowsDisconnect(config);
+ getCurrentConnections = windowsGetCurrentConnections(config);
+ break;
+ default:
+ throw new Error('ERROR : UNRECOGNIZED OS');
+ }
+ exports.scan = scan;
+ exports.connect = connect;
+ exports.disconnect = disconnect;
+ exports.deleteConnection = deleteConnection;
+ exports.getCurrentConnections = getCurrentConnections;
+}
+
+exports.init = init;
+exports.scan = () => {
+ throw new Error('ERROR : use init before');
+};
+
+exports.connect = () => {
+ throw new Error('ERROR : use init before');
+};
+
+exports.disconnect = () => {
+ throw new Error('ERROR : use init before');
+};
+
+exports.getCurrentConnections = () => {
+ throw new Error('ERROR : use init before');
+};
+
+exports.deleteConnection = () => {
+ throw new Error('ERROR : use init before');
+};
diff --git a/node_modules/node-wifi/src/windows-connect.js b/node_modules/node-wifi/src/windows-connect.js
new file mode 100644
index 0000000..11e80c1
--- /dev/null
+++ b/node_modules/node-wifi/src/windows-connect.js
@@ -0,0 +1,136 @@
+const fs = require('fs');
+const execFile = require('child_process').execFile;
+const env = require('./env');
+const scan = require('./windows-scan');
+const path = require('path');
+const os = require('os');
+const profileFilename = path.join(os.tmpdir(), 'nodeWifiConnect.xml');
+
+function execCommand(cmd, params) {
+ return new Promise((resolve, reject) => {
+ execFile(cmd, params, { env, shell: true }, (err, stdout, stderr) => {
+ if (err) {
+ // Add command output to error, so it's easier to handle
+ err.stdout = stdout;
+ err.stderr = stderr;
+
+ reject(err);
+ } else {
+ resolve(stdout);
+ }
+ });
+ });
+}
+
+function connectToWifi(config, ap, callback) {
+ scan(config)()
+ .then(networks => {
+ const selectedAp = networks.find(network => {
+ return network.ssid === ap.ssid;
+ });
+
+ if (selectedAp === undefined) {
+ throw 'SSID not found';
+ }
+
+ fs.writeFileSync(
+ profileFilename,
+ win32WirelessProfileBuilder(selectedAp, ap.password)
+ );
+ })
+ .then(() => {
+ return execCommand('netsh', [
+ 'wlan',
+ 'add',
+ 'profile',
+ `filename=${profileFilename}`
+ ]);
+ })
+ .then(() => {
+ const cmd = 'netsh';
+ const params = [
+ 'wlan',
+ 'connect',
+ `ssid="${ap.ssid}"`,
+ `name="${ap.ssid}"`
+ ];
+ if (config.iface) {
+ params.push(`interface="${config.iface}"`);
+ }
+ return execCommand(cmd, params);
+ })
+ .then(() => {
+ return execCommand(`del ${profileFilename}`);
+ })
+ .then(() => {
+ callback && callback();
+ })
+ .catch(err => {
+ execFile(
+ 'netsh',
+ ['wlan', 'delete', `profile "${ap.ssid}"`],
+ { env },
+ () => {
+ callback && callback(err);
+ }
+ );
+ });
+}
+
+function getHexSsid(plainTextSsid) {
+ let i, j, ref, hex;
+
+ hex = '';
+
+ for (
+ i = j = 0, ref = plainTextSsid.length - 1;
+ ref >= 0 ? j <= ref : j >= ref;
+ i = ref >= 0 ? ++j : --j
+ ) {
+ hex += plainTextSsid.charCodeAt(i).toString(16);
+ }
+
+ return hex;
+}
+
+function win32WirelessProfileBuilder(selectedAp, key) {
+ let profile_content = `<?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>${
+ selectedAp.ssid
+ }</name> <SSIDConfig> <SSID> <hex>${getHexSsid(
+ selectedAp.ssid
+ )}</hex> <name>${selectedAp.ssid}</name> </SSID> </SSIDConfig>`;
+
+ if (selectedAp.security.includes('WPA2')) {
+ profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
+ } else if (selectedAp.security.includes('WPA')) {
+ profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPAPSK</authentication> <encryption>TKIP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
+ } else {
+ if (selectedAp.security_flags.includes('WEP')) {
+ profile_content += `<connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>true</autoSwitch> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>WEP</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>false</protected> <keyMaterial>${key}</keyMaterial> </sharedKey> </security> </MSM>`;
+ } else {
+ profile_content +=
+ '<connectionType>ESS</connectionType> <connectionMode>manual</connectionMode> <MSM> <security> <authEncryption> <authentication>open</authentication> <encryption>none</encryption> <useOneX>false</useOneX> </authEncryption> </security> </MSM>';
+ }
+ }
+
+ profile_content += '</WLANProfile>';
+ return profile_content;
+}
+
+module.exports = config => {
+ return (ap, callback) => {
+ if (callback) {
+ connectToWifi(config, ap, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ connectToWifi(config, ap, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/windows-current-connections.js b/node_modules/node-wifi/src/windows-current-connections.js
new file mode 100644
index 0000000..477456b
--- /dev/null
+++ b/node_modules/node-wifi/src/windows-current-connections.js
@@ -0,0 +1,89 @@
+const execFile = require('child_process').execFile;
+const env = require('./env');
+const networkUtils = require('./utils/network-utils.js');
+
+function parseShowInterfaces(stdout) {
+ const lines = stdout.split('\r\n');
+ const connections = [];
+ let i = 3;
+ while (lines.length > i + 18) {
+ const tmpConnection = {};
+ const fields = [
+ 'name',
+ 'description',
+ 'guid',
+ 'mac',
+ 'state',
+ 'ssid',
+ 'bssid',
+ 'mode',
+ 'radio',
+ 'authentication',
+ 'encryption',
+ 'connection',
+ 'channel',
+ 'reception',
+ 'transmission',
+ 'signal',
+ 'profil'
+ ];
+ for (let j = 0; j < fields.length; j++) {
+ const line = lines[i + j];
+ tmpConnection[fields[j]] = line.match(/.*: (.*)/)[1];
+ }
+
+ connections.push({
+ iface: tmpConnection.name,
+ ssid: tmpConnection.ssid,
+ bssid: tmpConnection.bssid,
+ mac: tmpConnection.bssid,
+ mode: tmpConnection.mode,
+ channel: parseInt(tmpConnection.channel),
+ frequency: parseInt(
+ networkUtils.frequencyFromChannel(parseInt(tmpConnection.channel))
+ ),
+ signal_level: networkUtils.dBFromQuality(tmpConnection.signal),
+ quality: parseFloat(tmpConnection.signal),
+ security: tmpConnection.authentication,
+ security_flags: tmpConnection.encryption
+ });
+
+ i = i + 18;
+ }
+
+ return connections;
+}
+
+function getCurrentConnection(config, callback) {
+ const params = ['wlan', 'show', 'interfaces'];
+ execFile('netsh', params, { env }, (err, stdout) => {
+ if (err) {
+ callback && callback(err);
+ } else {
+ try {
+ const connections = parseShowInterfaces(stdout, config);
+ callback && callback(null, connections);
+ } catch (e) {
+ callback && callback(e);
+ }
+ }
+ });
+}
+
+module.exports = config => {
+ return callback => {
+ if (callback) {
+ getCurrentConnection(config, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ getCurrentConnection(config, (err, connections) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(connections);
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/windows-disconnect.js b/node_modules/node-wifi/src/windows-disconnect.js
new file mode 100644
index 0000000..61b2f89
--- /dev/null
+++ b/node_modules/node-wifi/src/windows-disconnect.js
@@ -0,0 +1,31 @@
+const execFile = require('child_process').execFile;
+const env = require('./env');
+
+function disconnect(config, callback) {
+ const cmd = 'netsh';
+ const params = ['wlan', 'disconnect'];
+ if (config.iface) {
+ params.push(`interface="${config.iface}"`);
+ }
+ execFile(cmd, params, { env }, err => {
+ callback && callback(err);
+ });
+}
+
+module.exports = config => {
+ return callback => {
+ if (callback) {
+ disconnect(config, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ disconnect(config, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/node-wifi/src/windows-scan.js b/node_modules/node-wifi/src/windows-scan.js
new file mode 100644
index 0000000..0f570d8
--- /dev/null
+++ b/node_modules/node-wifi/src/windows-scan.js
@@ -0,0 +1,100 @@
+const execFile = require('child_process').execFile;
+const networkUtils = require('./utils/network-utils');
+const env = require('./env');
+
+function scanWifi(config, callback) {
+ try {
+ execFile(
+ 'netsh',
+ ['wlan', 'show', 'networks', 'mode=Bssid'],
+ { env },
+ (err, scanResults) => {
+ if (err) {
+ callback && callback(err);
+ return;
+ }
+
+ scanResults = scanResults
+ .toString('utf8')
+ .split('\r')
+ .join('')
+ .split('\n')
+ .slice(4, scanResults.length);
+
+ let numNetworks = -1;
+ let currentLine = 0;
+ let networkTmp;
+ const networksTmp = [];
+ let network;
+ const networks = [];
+ let i;
+
+ for (i = 0; i < scanResults.length; i++) {
+ if (scanResults[i] === '') {
+ numNetworks++;
+ networkTmp = scanResults.slice(currentLine, i);
+ networksTmp.push(networkTmp);
+ currentLine = i + 1;
+ }
+ }
+
+ for (i = 0; i < numNetworks; i++) {
+ // skip empty networks
+ if (networksTmp[i] && networksTmp[i].length > 0) {
+ network = parse(networksTmp[i]);
+ networks.push(network);
+ }
+ }
+
+ callback && callback(null, networks);
+ }
+ );
+ } catch (e) {
+ callback && callback(e);
+ }
+}
+
+function parse(networkTmp) {
+ const network = {};
+
+ network.mac = networkTmp[4] ? networkTmp[4].match(/.*?:\s(.*)/)[1] : '';
+ network.bssid = network.mac;
+ network.ssid = networkTmp[0] ? networkTmp[0].match(/.*?:\s(.*)/)[1] : '';
+ network.channel = networkTmp[7]
+ ? parseInt(networkTmp[7].match(/.*?:\s(.*)/)[1])
+ : -1;
+ network.frequency = network.channel
+ ? parseInt(networkUtils.frequencyFromChannel(network.channel))
+ : 0;
+ network.signal_level = networkTmp[5]
+ ? networkUtils.dBFromQuality(networkTmp[5].match(/.*?:\s(.*)/)[1])
+ : Number.MIN_VALUE;
+ network.quality = networkTmp[5]
+ ? parseFloat(networkTmp[5].match(/.*?:\s(.*)/)[1])
+ : 0;
+ network.security = networkTmp[2] ? networkTmp[2].match(/.*?:\s(.*)/)[1] : '';
+ network.security_flags = networkTmp[3]
+ ? networkTmp[3].match(/.*?:\s(.*)/)[1]
+ : '';
+ network.mode = 'Unknown';
+
+ return network;
+}
+
+module.exports = config => {
+ return callback => {
+ if (callback) {
+ scanWifi(config, callback);
+ } else {
+ return new Promise((resolve, reject) => {
+ scanWifi(config, (err, networks) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(networks);
+ }
+ });
+ });
+ }
+ };
+};
diff --git a/node_modules/reduce-flatten/.travis.yml b/node_modules/reduce-flatten/.travis.yml
new file mode 100644
index 0000000..0517f82
--- /dev/null
+++ b/node_modules/reduce-flatten/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
diff --git a/node_modules/reduce-flatten/LICENSE b/node_modules/reduce-flatten/LICENSE
new file mode 100644
index 0000000..fb6a17a
--- /dev/null
+++ b/node_modules/reduce-flatten/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016-18 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/reduce-flatten/README.hbs b/node_modules/reduce-flatten/README.hbs
new file mode 100644
index 0000000..aecf981
--- /dev/null
+++ b/node_modules/reduce-flatten/README.hbs
@@ -0,0 +1,11 @@
+[![view on npm](http://img.shields.io/npm/v/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
+[![npm module downloads](http://img.shields.io/npm/dt/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
+[![Build Status](https://travis-ci.org/75lb/reduce-flatten.svg?branch=master)](https://travis-ci.org/75lb/reduce-flatten)
+[![Dependency Status](https://david-dm.org/75lb/reduce-flatten.svg)](https://david-dm.org/75lb/reduce-flatten)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+* * *
+
+&copy; 2016-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/reduce-flatten/README.md b/node_modules/reduce-flatten/README.md
new file mode 100644
index 0000000..a320006
--- /dev/null
+++ b/node_modules/reduce-flatten/README.md
@@ -0,0 +1,29 @@
+[![view on npm](http://img.shields.io/npm/v/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
+[![npm module downloads](http://img.shields.io/npm/dt/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
+[![Build Status](https://travis-ci.org/75lb/reduce-flatten.svg?branch=master)](https://travis-ci.org/75lb/reduce-flatten)
+[![Dependency Status](https://david-dm.org/75lb/reduce-flatten.svg)](https://david-dm.org/75lb/reduce-flatten)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_reduce-flatten"></a>
+
+## reduce-flatten
+Flatten an array into the supplied array.
+
+**Example**
+```js
+const flatten = require('reduce-flatten')
+```
+<a name="exp_module_reduce-flatten--flatten"></a>
+
+### flatten() ⏏
+**Kind**: Exported function
+**Example**
+```js
+> numbers = [ 1, 2, [ 3, 4 ], 5 ]
+> numbers.reduce(flatten, [])
+[ 1, 2, 3, 4, 5 ]
+```
+
+* * *
+
+&copy; 2016-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/reduce-flatten/index.js b/node_modules/reduce-flatten/index.js
new file mode 100644
index 0000000..f2ee9ed
--- /dev/null
+++ b/node_modules/reduce-flatten/index.js
@@ -0,0 +1,19 @@
+/**
+ * Flatten an array into the supplied array.
+ *
+ * @module reduce-flatten
+ * @example
+ * const flatten = require('reduce-flatten')
+ */
+module.exports = flatten
+
+/**
+ * @alias module:reduce-flatten
+ * @example
+ * > numbers = [ 1, 2, [ 3, 4 ], 5 ]
+ * > numbers.reduce(flatten, [])
+ * [ 1, 2, 3, 4, 5 ]
+ */
+function flatten (prev, curr) {
+ return prev.concat(curr)
+}
diff --git a/node_modules/reduce-flatten/package.json b/node_modules/reduce-flatten/package.json
new file mode 100644
index 0000000..fcb9e50
--- /dev/null
+++ b/node_modules/reduce-flatten/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "reduce-flatten",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "2.0.0",
+ "description": "Flatten an array into the supplied array.",
+ "repository": "https://github.com/75lb/reduce-flatten.git",
+ "license": "MIT",
+ "keywords": [
+ "array",
+ "reduce",
+ "flatten"
+ ],
+ "engines": {
+ "node": ">=6"
+ },
+ "scripts": {
+ "test": "test-runner test.js",
+ "docs": "jsdoc2md -t README.hbs index.js > README.md; echo"
+ },
+ "devDependencies": {
+ "jsdoc-to-markdown": "^4.0.1",
+ "test-runner": "^0.5.0"
+ }
+}
diff --git a/node_modules/reduce-flatten/test.js b/node_modules/reduce-flatten/test.js
new file mode 100644
index 0000000..db2fe68
--- /dev/null
+++ b/node_modules/reduce-flatten/test.js
@@ -0,0 +1,11 @@
+const flatten = require('./')
+const TestRunner = require('test-runner')
+const a = require('assert')
+
+const runner = new TestRunner()
+
+runner.test('flatten', function () {
+ const numbers = [ 1, 2, [ 3, 4 ], 5 ]
+ const result = numbers.reduce(flatten, [])
+ a.deepStrictEqual(result, [ 1, 2, 3, 4, 5 ])
+})
diff --git a/node_modules/supports-color/browser.js b/node_modules/supports-color/browser.js
new file mode 100644
index 0000000..62afa3a
--- /dev/null
+++ b/node_modules/supports-color/browser.js
@@ -0,0 +1,5 @@
+'use strict';
+module.exports = {
+ stdout: false,
+ stderr: false
+};
diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js
new file mode 100644
index 0000000..1704131
--- /dev/null
+++ b/node_modules/supports-color/index.js
@@ -0,0 +1,131 @@
+'use strict';
+const os = require('os');
+const hasFlag = require('has-flag');
+
+const env = process.env;
+
+let forceColor;
+if (hasFlag('no-color') ||
+ hasFlag('no-colors') ||
+ hasFlag('color=false')) {
+ forceColor = false;
+} else if (hasFlag('color') ||
+ hasFlag('colors') ||
+ hasFlag('color=true') ||
+ hasFlag('color=always')) {
+ forceColor = true;
+}
+if ('FORCE_COLOR' in env) {
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
+}
+
+function translateLevel(level) {
+ if (level === 0) {
+ return false;
+ }
+
+ return {
+ level,
+ hasBasic: true,
+ has256: level >= 2,
+ has16m: level >= 3
+ };
+}
+
+function supportsColor(stream) {
+ if (forceColor === false) {
+ return 0;
+ }
+
+ if (hasFlag('color=16m') ||
+ hasFlag('color=full') ||
+ hasFlag('color=truecolor')) {
+ return 3;
+ }
+
+ if (hasFlag('color=256')) {
+ return 2;
+ }
+
+ if (stream && !stream.isTTY && forceColor !== true) {
+ return 0;
+ }
+
+ const min = forceColor ? 1 : 0;
+
+ if (process.platform === 'win32') {
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
+ // libuv that enables 256 color output on Windows. Anything earlier and it
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
+ // that supports 16m/TrueColor.
+ const osRelease = os.release().split('.');
+ if (
+ Number(process.versions.node.split('.')[0]) >= 8 &&
+ Number(osRelease[0]) >= 10 &&
+ Number(osRelease[2]) >= 10586
+ ) {
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
+ }
+
+ return 1;
+ }
+
+ if ('CI' in env) {
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
+ return 1;
+ }
+
+ return min;
+ }
+
+ if ('TEAMCITY_VERSION' in env) {
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
+ }
+
+ if (env.COLORTERM === 'truecolor') {
+ return 3;
+ }
+
+ if ('TERM_PROGRAM' in env) {
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
+
+ switch (env.TERM_PROGRAM) {
+ case 'iTerm.app':
+ return version >= 3 ? 3 : 2;
+ case 'Apple_Terminal':
+ return 2;
+ // No default
+ }
+ }
+
+ if (/-256(color)?$/i.test(env.TERM)) {
+ return 2;
+ }
+
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
+ return 1;
+ }
+
+ if ('COLORTERM' in env) {
+ return 1;
+ }
+
+ if (env.TERM === 'dumb') {
+ return min;
+ }
+
+ return min;
+}
+
+function getSupportLevel(stream) {
+ const level = supportsColor(stream);
+ return translateLevel(level);
+}
+
+module.exports = {
+ supportsColor: getSupportLevel,
+ stdout: getSupportLevel(process.stdout),
+ stderr: getSupportLevel(process.stderr)
+};
diff --git a/node_modules/supports-color/license b/node_modules/supports-color/license
new file mode 100644
index 0000000..e7af2f7
--- /dev/null
+++ b/node_modules/supports-color/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json
new file mode 100644
index 0000000..ad199f5
--- /dev/null
+++ b/node_modules/supports-color/package.json
@@ -0,0 +1,53 @@
+{
+ "name": "supports-color",
+ "version": "5.5.0",
+ "description": "Detect whether a terminal supports color",
+ "license": "MIT",
+ "repository": "chalk/supports-color",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js",
+ "browser.js"
+ ],
+ "keywords": [
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "ansi",
+ "styles",
+ "tty",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "command-line",
+ "support",
+ "supports",
+ "capability",
+ "detect",
+ "truecolor",
+ "16m"
+ ],
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "devDependencies": {
+ "ava": "^0.25.0",
+ "import-fresh": "^2.0.0",
+ "xo": "^0.20.0"
+ },
+ "browser": "browser.js"
+}
diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md
new file mode 100644
index 0000000..f6e4019
--- /dev/null
+++ b/node_modules/supports-color/readme.md
@@ -0,0 +1,66 @@
+# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
+
+> Detect whether a terminal supports color
+
+
+## Install
+
+```
+$ npm install supports-color
+```
+
+
+## Usage
+
+```js
+const supportsColor = require('supports-color');
+
+if (supportsColor.stdout) {
+ console.log('Terminal stdout supports color');
+}
+
+if (supportsColor.stdout.has256) {
+ console.log('Terminal stdout supports 256 colors');
+}
+
+if (supportsColor.stderr.has16m) {
+ console.log('Terminal stderr supports 16 million colors (truecolor)');
+}
+```
+
+
+## API
+
+Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
+
+The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
+
+- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
+- `.level = 2` and `.has256 = true`: 256 color support
+- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
+
+
+## Info
+
+It obeys the `--color` and `--no-color` CLI flags.
+
+Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
+
+Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
+
+
+## Related
+
+- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
+- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
+
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+
+
+## License
+
+MIT
diff --git a/node_modules/systeminformation/LICENSE b/node_modules/systeminformation/LICENSE
new file mode 100644
index 0000000..7477998
--- /dev/null
+++ b/node_modules/systeminformation/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2023 Sebastian Hildebrandt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/systeminformation/README.md b/node_modules/systeminformation/README.md
new file mode 100644
index 0000000..eb49663
--- /dev/null
+++ b/node_modules/systeminformation/README.md
@@ -0,0 +1,1091 @@
+<p align="center">
+ <a href="https://systeminformation.io/">
+ <img src="https://systeminformation.io/assets/logo_inv.png" alt="systeminformation logo" width="102" height="72">
+ </a>
+</p>
+
+<h3 align="center">systeminformation</h3>
+
+<p align="center">
+ System and OS information library for node.js
+ <br>
+ <a href="https://systeminformation.io/"><strong>Explore Systeminformation docs »</strong></a>
+ <br>
+ <br>
+ <a href="https://github.com/sebhildebrandt/systeminformation/issues/new?template=bug_report.md">Report bug</a>
+ ·
+ <a href="https://github.com/sebhildebrandt/systeminformation/issues/new?template=feature_request.md&labels=feature">Request feature</a>
+ ·
+ <a href="https://github.com/sebhildebrandt/systeminformation/blob/master/CHANGELOG.md">Changelog</a>
+</p>
+
+ [![NPM Version][npm-image]][npm-url]
+ [![NPM Downloads][downloads-image]][downloads-url]
+ [![Git Issues][issues-img]][issues-url]
+ [![Closed Issues][closed-issues-img]][closed-issues-url]
+ <img src="docs/assets/no-dependencies.svg" alt="no dependencies">
+ [![Sponsoring][sponsor-badge]][sponsor-url]
+ [![Caretaker][caretaker-image]][caretaker-url]
+ [![MIT license][license-img]][license-url]
+
+## The Systeminformation Project
+This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 6 mio downloads per month, > 150 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
+
+## New Version 5.0
+
+The new Version 5 is here - I spent several weeks finalizing this new version. Any support is highly appreciated - [Buy me a coffee](https://www.buymeacoffee.com/systeminfo)
+
+This next major version release 5.0 comes with new functionality and several improvements and changes (some of them are breaking changes!):
+
+- added audio: get detailed audio device information
+- added bluetooth: get detailed bluetooth device information
+- added dockerImages, dockerVolumes: get detailed information about docker images and volumes
+- added printer: get information from detected printers
+- added usb: get detailed usb controller and device information
+- added wifi interfaces and connections: extended wifi information
+- better uuid function to get unique hardware and OS UUIDs
+- better/extended cpu info detection
+- better/extended system info detection
+- Apple Silicon M1 support
+- better Raspberry-PI detection
+- systeminformation website updated and extended with full documentation and examples [systeminformation.io][systeminformation-url]
+- lot of minor improvements
+
+Breaking Changes in version 5: you will see several breaking changes for the sake of a more consistent API interface and to be future proof. Read the [detailed version 5 changes][changes5-url].
+
+I did a lot of testing on different platforms and machines but of course there might be some issues that I am not aware of. I would be happy if you inform me when you discover any issues. Issues can be [opened here][new-issue].
+
+## Quick Start
+
+Lightweight collection of 50+ functions to retrieve detailed hardware, system and OS information.
+
+- 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, SunOS and Android support
+- 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.
+
+### Installation
+
+```bash
+npm install systeminformation --save
+```
+
+or simpler
+
+```bash
+npm install systeminformation
+```
+
+#### Still need Version 4?
+
+If you need version 4 (for compatibility reasons), you can install version 4 (latest release) like this
+
+```bash
+npm install systeminformation@4 —save
+```
+
+or simpler
+
+```bash
+npm install systeminformation@4
+```
+
+### Usage
+
+All functions (except `version` and `time`) are implemented as asynchronous functions. Here a small example how to use them:
+
+```js
+const si = require('systeminformation');
+
+// promises style - new since version 3
+si.cpu()
+ .then(data => console.log(data))
+ .catch(error => console.error(error));
+```
+
+## News and Changes
+
+### Latest Activity
+
+(last 7 major and minor version releases)
+
+- Version 5.18.0: `fsSize()` added optional drive parameter
+- Version 5.17.0: `graphics()` added positionX, positionY (mac OS)
+- Version 5.16.0: `fsSize()` added rw property
+- Version 5.15.0: `blockDevices()` added device
+- Version 5.14.0: `blockDevices()` added raid group member (linux)
+- Version 5.13.0: `networkConnections()` added process name (mac OS)
+- Version 5.12.0: `cpu()` added performance and efficiency cores
+- Version 5.11.0: `networkInterfaces()` added default property and default parameter
+- Version 5.10.0: basic `android` support
+- Version 5.9.0: `graphics()` added properties (macOS)
+- Version 5.8.0: `disksIO()` added waitTime, waitPercent (linux)
+- Version 5.7.0: `diskLayout()` added S.M.A.R.T for Windows (if installed)
+- Version 5.6.0: `cpuTemperature()` added socket and chipset temp (linux)
+- Version 5.5.0: `dockerVolumes()` added
+- Version 5.4.0: `dockerImages()` added
+- Version 5.3.0: `osInfo()` added remoteSession (win only)
+- Version 5.2.0: `wifiInterfaces()` and `wifiConnections()` added
+- Version 5.1.0: `memLayout()` added ECC flag, `bios()` added language, features (linux)
+- Version 5.0.0: new version 5 - attention there are some breaking changes. See [detailed version 5 changes here][changes5-url].
+- ...
+
+You can find all changes here: [detailed changelog][changelog-url]
+
+## Core concept
+
+[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 a work in progress. It is supposed to be used as a backend/server-side library (it 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, 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!
+
+
+I also created a nice little command line tool called [mmon][mmon-github-url] (micro-monitor) for Linux and macOS, also available via [github][mmon-github-url] and [npm][mmon-npm-url]
+
+
+## Reference
+
+### Function Reference and OS Support
+
+Full function reference with examples can be found at [https://systeminformation.io][systeminformation-url].
+
+#### 1. General
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ------------ | ------------- | ----- | --- | --- | --- | --- | --------------------------------- |
+| si.version() | : string | X | X | X | X | X | lib version (no callback/promise) |
+| si.time() | {...} | X | X | X | X | X | (no callback/promise) |
+| | current | X | X | X | X | X | local (server) time |
+| | uptime | X | X | X | X | X | uptime in number of seconds |
+| | timezone | X | X | X | X | X | e.g. GMT+0200 |
+| | timezoneName | X | X | X | X | X | e.g. CEST |
+
+#### 2. System (HW)
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ---------------- | ------------- | ----- | --- | --- | --- | --- | -------------------------------- |
+| si.system(cb) | {...} | X | X | X | X | | hardware information |
+| | manufacturer | X | X | X | X | | e.g. 'MSI' |
+| | model | X | X | X | X | | model/product e.g. 'MS-7823' |
+| | version | X | X | X | X | | version e.g. '1.0' |
+| | serial | X | X | X | X | | serial number |
+| | uuid | X | X | X | X | | UUID |
+| | sku | X | X | X | X | | SKU number |
+| | virtual | X | X | | X | | is virtual machine |
+| | virtualHost | X | X | | X | | virtual host (if virtual) |
+| | raspberry | X | | | | | optional raspberry revision data |
+| si.bios(cb) | {...} | X | X | X | X | | bios information |
+| | vendor | X | X | X | X | | e.g. 'AMI' |
+| | version | X | X | X | X | | version |
+| | releaseDate | X | X | | X | | release date |
+| | revision | X | X | | X | | revision |
+| | serial | X | | | X | | serial |
+| si.baseboard(cb) | {...} | X | X | X | X | | baseboard information |
+| | manufacturer | X | X | X | X | | e.g. 'ASUS' |
+| | model | X | X | X | X | | model / product name |
+| | version | X | X | X | X | | version |
+| | serial | X | X | X | X | | serial number |
+| | assetTag | X | X | X | X | | asset tag |
+| | memMax | X | | X | X | | max memory in bytes |
+| | memSlots | X | | X | X | | memory slots on baseboard |
+| si.chassis(cb) | {...} | X | X | X | X | | chassis information |
+| | manufacturer | X | X | X | X | | e.g. 'MSI' |
+| | model | X | X | X | X | | model / product name |
+| | type | X | X | X | X | | model / product name |
+| | version | X | X | X | X | | version |
+| | serial | X | X | X | X | | serial number |
+| | assetTag | X | X | X | X | | asset tag |
+| | sku | | | | X | | SKU number |
+
+#### 3. CPU
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ---------------------- | ---------------- | ----- | --- | --- | --- | --- | ----------------------------------- |
+| si.cpu(cb) | {...} | X | X | X | X | | CPU information |
+| | manufacturer | X | X | X | X | | e.g. 'Intel(R)' |
+| | brand | X | X | X | X | | e.g. 'Core(TM)2 Duo' |
+| | speed | X | X | X | X | | in GHz e.g. '3.40' |
+| | speedMin | X | | X | X | | in GHz e.g. '0.80' |
+| | speedMax | X | X | X | X | | in GHz e.g. '3.90' |
+| | governor | X | | | | | e.g. 'powersave' |
+| | cores | X | X | X | X | | # cores |
+| | physicalCores | X | X | X | X | | # physical cores |
+| | efficiencyCores | X | | X | | | # efficiency cores |
+| | performanceCores | X | | X | | | # performance cores |
+| | processors | X | X | X | X | | # processors |
+| | socket | X | X | | X | | socket type e.g. "LGA1356" |
+| | vendor | X | X | X | X | | vendor ID |
+| | family | X | X | X | X | | processor family |
+| | model | X | X | X | X | | processor model |
+| | stepping | X | X | X | X | | processor stepping |
+| | revision | X | | X | X | | revision |
+| | voltage | | X | | | | voltage |
+| | flags | X | X | X | X | | CPU flags |
+| | virtualization | X | X | X | X | | virtualization supported |
+| | cache | X | X | X | X | | cache in bytes (object) |
+| | cache.l1d | X | X | X | X | | L1D (data) size |
+| | cache.l1i | X | X | X | X | | L1I (instruction) size |
+| | cache.l2 | X | X | X | X | | L2 size |
+| | cache.l3 | X | X | X | X | | L3 size |
+| si.cpuFlags(cb) | : string | X | X | X | X | | CPU flags |
+| si.cpuCache(cb) | {...} | X | X | X | X | | CPU cache sizes |
+| | l1d | X | X | X | X | | L1D size |
+| | l1i | X | X | X | X | | L1I size |
+| | l2 | X | X | X | X | | L2 size |
+| | l3 | X | X | X | X | | L3 size |
+| si.cpuCurrentSpeed(cb) | {...} | X | X | X | X | X | current CPU speed (in GHz) |
+| | avg | X | X | X | X | X | avg CPU speed (all cores) |
+| | min | X | X | X | X | X | min CPU speed (all cores) |
+| | max | X | X | X | X | X | max CPU speed (all cores) |
+| | cores | X | X | X | X | X | CPU speed per core (array) |
+| si.cpuTemperature(cb) | {...} | X | X | X* | X | | CPU temperature in C (if supported) |
+| | main | X | X | X | X | | main temperature (avg) |
+| | cores | X | X | X | X | | array of temperatures |
+| | max | X | X | X | X | | max temperature |
+| | socket | X | | | | | array socket temperatures |
+| | chipset | X | | | | | chipset temperature |
+
+#### 4. Memory
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ---------------- | --------------------- | ----- | --- | --- | --- | --- | -------------------------------------- |
+| si.mem(cb) | {...} | X | X | X | X | X | Memory information (in bytes) |
+| | total | X | X | X | X | X | total memory in bytes |
+| | free | X | X | X | X | X | not used in bytes |
+| | used | X | X | X | X | X | used (incl. buffers/cache) |
+| | active | X | X | X | X | X | used actively (excl. buffers/cache) |
+| | buffcache | X | X | X | | X | used by buffers+cache |
+| | buffers | X | | | | | used by buffers |
+| | cached | X | | | | | used by cache |
+| | slab | X | | | | | used by slab |
+| | available | X | X | X | X | X | potentially available (total - active) |
+| | swaptotal | X | X | X | X | X | |
+| | swapused | X | X | X | X | X | |
+| | swapfree | X | X | X | X | X | |
+| si.memLayout(cb) | [{...}] | X | X | X | X | | Memory Layout (array) |
+| | [0].size | X | X | X | X | | size in bytes |
+| | [0].bank | X | X | | X | | memory bank |
+| | [0].type | X | X | X | X | | memory type |
+| | [0].clockSpeed | X | X | X | X | | clock speed |
+| | [0].formFactor | X | X | | X | | form factor |
+| | [0].manufacturer | X | X | X | X | | manufacturer |
+| | [0].partNum | X | X | X | X | | part number |
+| | [0].serialNum | X | X | X | X | | serial number |
+| | [0].voltageConfigured | X | X | | X | | voltage conf. |
+| | [0].voltageMin | X | X | | X | | voltage min |
+| | [0].voltageMax | X | X | | X | | voltage max |
+
+#### 5. Battery
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| -------------- | ---------------- | ----- | --- | --- | --- | --- | --------------------------------- |
+| si.battery(cb) | {...} | X | X | X | X | | battery information |
+| | hasBattery | X | X | X | X | | indicates presence of battery |
+| | cycleCount | X | | X | | | numbers of recharges |
+| | isCharging | X | X | X | X | | indicates if battery is charging |
+| | designedCapacity | X | | X | X | | max capacity of battery (mWh) |
+| | maxCapacity | X | | X | X | | max capacity of battery (mWh) |
+| | currentCapacity | X | | X | X | | current capacity of battery (mWh) |
+| | capacityUnit | X | | X | X | | capacity unit (mWh) |
+| | voltage | X | | X | X | | current voltage of battery (V) |
+| | percent | X | X | X | X | | charging level in percent |
+| | timeRemaining | X | | X | | | minutes left (if discharging) |
+| | acConnected | X | X | X | X | | AC connected |
+| | type | X | | X | | | battery type |
+| | model | X | | X | | | model |
+| | manufacturer | X | | X | | | manufacturer |
+| | serial | X | | X | | | battery serial |
+
+* See known issues if you have a problem with macOS temperature or windows temperature
+
+#### 6. Graphics
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| --------------- | ------------------------- | ----- | --- | --- | --- | --- | ------------------------------------------- |
+| si.graphics(cb) | {...} | X | | X | X | | arrays of graphics controllers and displays |
+| | controllers[] | X | | X | X | | graphics controllers array |
+| | ...[0].vendor | X | | X | X | | e.g. ATI |
+| | ...[0].vendorId | | | X | | | vendor ID |
+| | ...[0].model | X | | X | X | | graphics controller model |
+| | ...[0].deviceId | | | X | | | device ID |
+| | ...[0].bus | X | | X | X | | on which bus (e.g. PCIe) |
+| | ...[0].vram | X | | X | X | | VRAM size (in MB) |
+| | ...[0].vramDynamic | X | | X | X | | true if dynamically allocated ram |
+| | ...[0].external | | | X | | | is external GPU |
+| | ...[0].cores | | | X | | | Apple silicon only |
+| | ...[0].metalVersion | | | X | | | Apple Metal Version |
+| | displays[] | X | | X | X | | monitor/display array |
+| | ...[0].vendor | | | | X | | monitor/display vendor |
+| | ...[0].vendorId | | | X | | | vendor ID |
+| | ...[0].deviceName | | | | X | | e.g. \\\\.\\DISPLAY1 |
+| | ...[0].model | X | | X | X | | monitor/display model |
+| | ...[0].productionYear | | | X | | | production year |
+| | ...[0].serial | | | X | | | serial number |
+| | ...[0].displayId | | | X | | | display ID |
+| | ...[0].main | X | | X | X | | true if main monitor |
+| | ...[0].builtin | X | | X | | | true if built-in monitor |
+| | ...[0].connection | X | | X | X | | e.g. DisplayPort or HDMI |
+| | ...[0].sizeX | X | | | X | | size in mm horizontal |
+| | ...[0].sizeY | X | | | X | | size in mm vertical |
+| | ...[0].pixelDepth | X | | X | X | | color depth in bits |
+| | ...[0].resolutionX | X | | X | X | | pixel horizontal |
+| | ...[0].resolutionY | X | | X | X | | pixel vertical |
+| | ...[0].currentResX | X | | X | X | | current pixel horizontal |
+| | ...[0].currentResY | X | | X | X | | current pixel vertical |
+| | ...[0].positionX | | | X | X | | display position X |
+| | ...[0].positionY | | | X | X | | display position Y |
+| | ...[0].currentRefreshRate | X | | X | X | | current screen refresh rate |
+
+#### 7. Operating System
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| --------------------- | ------------- | ----- | --- | --- | --- | --- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| si.osInfo(cb) | {...} | X | X | X | X | X | OS information |
+| | platform | X | X | X | X | X | 'linux', 'darwin', 'win32', ... |
+| | distro | X | X | X | X | X | |
+| | release | X | X | X | X | X | |
+| | codename | | | X | | | |
+| | kernel | X | X | X | X | X | kernel release - same as os.release() |
+| | arch | X | X | X | X | X | same as os.arch() |
+| | hostname | X | X | X | X | X | same as os.hostname() |
+| | fqdn | X | X | X | X | X | FQDN fully qualified domain name |
+| | codepage | X | X | X | X | | OS build version |
+| | logofile | X | X | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
+| | serial | X | X | X | X | | OS/Host serial number |
+| | build | X | | X | X | | OS build version |
+| | servicepack | | | | X | | service pack version |
+| | uefi | X | X | X | X | | OS started via UEFI |
+| | hypervisor | | | | X | | hyper-v enabled? (win only) |
+| | remoteSession | | | | X | | runs in remote session (win only) |
+| si.uuid(cb) | {...} | X | X | X | X | X | object of several UUIDs |
+| | os | X | X | X | X | | os specific UUID |
+| | hardware | X | X | X | X | | hardware specific UUID |
+| | macs | X | X | X | X | | MAC addresses |
+| si.versions(apps, cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...)<br />apps param is optional for detecting<br />only specific apps/libs<br />(string, comma separated) |
+| si.shell(cb) | : string | X | X | X | X | | standard shell |
+| si.users(cb) | [{...}] | X | X | X | X | X | array of users online |
+| | [0].user | X | X | X | X | X | user name |
+| | [0].tty | X | X | X | X | X | terminal |
+| | [0].date | X | X | X | X | X | login date |
+| | [0].time | X | X | X | X | X | login time |
+| | [0].ip | X | X | X | | X | ip address (remote login) |
+| | [0].command | X | X | X | | X | last command or shell |
+
+#### 8. Current Load, Processes & Services
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ------------------------------------ | ----------------- | ----- | --- | --- | --- | --- | --------------------------------------------------------------------------------------- |
+| si.currentLoad(cb) | {...} | X | | X | X | X | CPU-Load |
+| | avgLoad | X | | X | | X | average load |
+| | currentLoad | X | | X | X | X | CPU load in % |
+| | currentLoadUser | X | | X | X | X | CPU load user in % |
+| | currentLoadSystem | X | | X | X | X | CPU load system in % |
+| | currentLoadNice | X | | X | X | X | CPU load nice in % |
+| | currentLoadIdle | X | | X | X | X | CPU load idle in % |
+| | currentLoadIrq | X | | X | X | X | CPU load system in % |
+| | rawCurrentLoad... | X | | X | X | X | CPU load raw values (ticks) |
+| | cpus[] | X | | X | X | X | current loads per CPU in % + raw ticks |
+| si.fullLoad(cb) | : integer | X | | X | X | | CPU full load since bootup in % |
+| si.processes(cb) | {...} | X | X | X | X | X | # running processes |
+| | all | X | X | X | X | X | # of all processes |
+| | running | X | X | X | | X | # of all processes running |
+| | blocked | X | X | X | | X | # of all processes blocked |
+| | sleeping | X | X | X | | X | # of all processes sleeping |
+| | unknown | | | | X | | # of all processes unknown status |
+| | list[] | X | X | X | X | X | list of all processes incl. details |
+| | ...[0].pid | X | X | X | X | X | process PID |
+| | ...[0].parentPid | X | X | X | X | X | parent process PID |
+| | ...[0].name | X | X | X | X | X | process name |
+| | ...[0].cpu | X | X | X | X | X | process % CPU usage |
+| | ...[0].cpuu | X | X | | X | | process % CPU usage (user) |
+| | ...[0].cpus | X | X | | X | | process % CPU usage (system) |
+| | ...[0].mem | X | X | X | X | X | process memory % |
+| | ...[0].priority | X | X | X | X | X | process priority |
+| | ...[0].memVsz | X | X | X | X | X | process virtual memory size |
+| | ...[0].memRss | X | X | X | X | X | process mem resident set size |
+| | ...[0].nice | X | X | X | | X | process nice value |
+| | ...[0].started | X | X | X | X | X | process start time |
+| | ...[0].state | X | X | X | X | X | process state (e.g. sleeping) |
+| | ...[0].tty | X | X | X | | X | tty from which process was started |
+| | ...[0].user | X | X | X | | X | user who started process |
+| | ...[0].command | X | X | X | X | X | process starting command |
+| | ...[0].params | X | X | X | | X | process params |
+| | ...[0].path | X | X | X | X | X | process path |
+| | proc | X | X | X | X | | process name |
+| | pid | X | X | X | X | | PID |
+| | pids | X | X | X | X | | additional pids |
+| | cpu | X | X | X | X | | process % CPU |
+| | mem | X | X | X | X | | process % MEM |
+| si.services('mysql, apache2', cb) | [{...}] | X | X | X | X | | pass comma separated string of services<br>pass "*" for ALL services (linux/win only) |
+| | [0].name | X | X | X | X | | name of service |
+| | [0].running | X | X | X | X | | true / false |
+| | [0].startmode | | | | X | | manual, automatic, ... |
+| | [0].pids | X | X | X | X | | pids |
+| | [0].cpu | X | X | X | | | process % CPU |
+| | [0].mem | X | X | X | | | process % MEM |
+| si.processLoad('mysql, apache2', cb) | [{...}] | X | X | X | X | | pass comma separated string of processes<br>pass "*" for ALL processes (linux/win only) |
+| | [0].proc | X | X | X | X | | name of process |
+| | [0].pids | X | X | X | X | | pids |
+| | [0].cpu | X | X | X | | | process % CPU |
+| | [0].mem | X | X | X | | | process % MEM |
+
+#### 9. File System
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| -------------------- | --------------------- | ----- | --- | --- | --- | --- | ------------------------------------------------------------------------ |
+| si.diskLayout(cb) | [{...}] | X | | X | X | | physical disk layout (array) |
+| | [0].device | X | | X | | | e.g. /dev/sda |
+| | [0].type | X | | X | X | | HD, SSD, NVMe |
+| | [0].name | X | | X | X | | disk name |
+| | [0].vendor | X | | | X | | vendor/producer |
+| | [0].size | X | | X | X | | size in bytes |
+| | [0].bytesPerSector | | | | X | | bytes per sector |
+| | [0].totalCylinders | | | | X | | total cylinders |
+| | [0].totalHeads | | | | X | | total heads |
+| | [0].totalSectors | | | | X | | total sectors |
+| | [0].totalTracks | | | | X | | total tracks |
+| | [0].tracksPerCylinder | | | | X | | tracks per cylinder |
+| | [0].sectorsPerTrack | | | | X | | sectors per track |
+| | [0].firmwareRevision | X | | X | X | | firmware revision |
+| | [0].serialNum | X | | X | X | | serial number |
+| | [0].interfaceType | X | | | X | | SATA, PCIe, ... |
+| | [0].smartStatus | X | | X | X | | S.M.A.R.T Status (see Known Issues) |
+| | [0].temperature | X | | | | | S.M.A.R.T temperature |
+| | [0].smartData | X | | | X | | full S.M.A.R.T data from smartctl<br>requires at least smartmontools 7.0 |
+| si.blockDevices(cb) | [{...}] | X | | X | X | | returns array of disks, partitions,<br>raids and roms |
+| | [0].name | X | | X | X | | name |
+| | [0].type | X | | X | X | | type |
+| | [0].fstype | X | | X | X | | file system type (e.g. ext4) |
+| | [0].mount | X | | X | X | | mount point |
+| | [0].size | X | | X | X | | size in bytes |
+| | [0].physical | X | | X | X | | physical type (HDD, SSD, CD/DVD) |
+| | [0].uuid | X | | X | X | | UUID |
+| | [0].label | X | | X | X | | label |
+| | [0].model | X | | X | | | model |
+| | [0].serial | X | | | X | | serial |
+| | [0].removable | X | | X | X | | serial |
+| | [0].protocol | X | | X | | | protocol (SATA, PCI-Express, ...) |
+| | [0].group | X | | | | | Raid group member (e.g. md1) |
+| | [0].device | X | | X | X | | physical device mapped to (e.g. /dev/sda) |
+| si.disksIO(cb) | {...} | X | | X | | | current transfer stats |
+| | rIO | X | | X | | | read IOs on all mounted drives |
+| | wIO | X | | X | | | write IOs on all mounted drives |
+| | tIO | X | | X | | | write IOs on all mounted drives |
+| | rIO_sec | X | | X | | | read IO per sec (* see notes) |
+| | wIO_sec | X | | X | | | write IO per sec (* see notes) |
+| | tIO_sec | X | | X | | | total IO per sec (* see notes) |
+| | rWaitTime | X | | | | | read IO request time (* see notes) |
+| | wWaitTime | X | | | | | write IO request time (* see notes) |
+| | tWaitTime | X | | | | | total IO request time (* see notes) |
+| | rWaitPercent | X | | | | | read IO request time percent (* see notes) |
+| | wWaitPercent | X | | | | | write IO request time percent (* see notes) |
+| | tWaitPercent | X | | | | | total IO request time percent (* see notes) |
+| | ms | X | | X | | | interval length (for per second values) |
+| si.fsSize(drive, cb) | [{...}] | X | X | X | X | | returns array of mounted file systems<br>drive param is optional |
+| | [0].fs | X | X | X | X | | name of file system |
+| | [0].type | X | X | X | X | | type of file system |
+| | [0].size | X | X | X | X | | sizes in bytes |
+| | [0].used | X | X | X | X | | used in bytes |
+| | [0].available | X | X | X | X | | used in bytes |
+| | [0].use | X | X | X | X | | used in % |
+| | [0].mount | X | X | X | X | | mount point |
+| | [0].rw | X | X | X | X | | read and write (false if read only) |
+| si.fsOpenFiles(cb) | {...} | X | X | X | | | count max/allocated file descriptors |
+| | max | X | X | X | | | max file descriptors |
+| | allocated | X | X | X | | | current open files count |
+| | available | X | X | X | | | count available |
+| si.fsStats(cb) | {...} | X | | X | | | current transfer stats |
+| | rx | X | | X | | | bytes read since startup |
+| | wx | X | | X | | | bytes written since startup |
+| | tx | X | | X | | | total bytes read + written since startup |
+| | rx_sec | X | | X | | | bytes read / second (* see notes) |
+| | wx_sec | X | | X | | | bytes written / second (* see notes) |
+| | tx_sec | X | | X | | | total bytes reads + written / second |
+| | ms | X | | X | | | interval length (for per second values) |
+
+#### 10. USB
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ---------- | ---------------- | ----- | --- | --- | --- | --- | ------------------------ |
+| si.usb(cb) | [{...}] | X | X | X | X | | get detected USB devices |
+| | [0].bus | X | | | | | USB bus |
+| | [0].deviceId | X | | | | | bus device id |
+| | [0].id | X | | X | X | | internal id |
+| | [0].name | X | | X | X | | name |
+| | [0].type | X | | X | X | | name |
+| | [0].removable | | | X | | | is removable |
+| | [0].vendor | X | | X | | | vendor |
+| | [0].manufacturer | X | | X | X | | manufacturer |
+| | [0].maxPower | X | | | | | max power |
+| | [0].default | X | | X | X | | is default printer |
+| | [0].serialNumber | | | X | | | serial number |
+
+#### 11. Printer
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| -------------- | ------------- | ----- | --- | --- | --- | --- | -------------------------- |
+| si.printer(cb) | [{...}] | X | X | X | X | | get printer information |
+| | [0].id | X | | X | X | | internal id |
+| | [0].name | X | | X | X | | name |
+| | [0].model | X | | X | X | | model |
+| | [0].uri | X | | X | | | printer URI |
+| | [0].uuid | X | | | | | printer UUID |
+| | [0].status | X | | X | X | | printer status (e.g. idle) |
+| | [0].local | X | | X | X | | is local printer |
+| | [0].default | | | X | X | | is default printer |
+| | [0].shared | X | | X | X | | is shared printer |
+
+#### 12. Audio
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ------------ | ----------------- | ----- | --- | --- | --- | --- | ------------------------------------- |
+| si.audio(cb) | [{...}] | X | X | X | X | | get printer information |
+| | [0].id | X | | X | X | | internal id |
+| | [0].name | X | | X | X | | name |
+| | [0].manufacturer | X | | X | X | | manufacturer |
+| | [0].revision | X | | | | | revision |
+| | [0].driver | X | | | | | driver |
+| | [0].default | | | X | X | | is default |
+| | [0].channel | X | | X | | | channel e.g. USB, HDMI, ... |
+| | [0].type | X | | X | X | | type e.g. Speaker |
+| | [0].in | | | X | X | | is input channel |
+| | [0].out | | | X | X | | is output channel |
+| | [0].interfaceType | X | | X | X | | interface type (PCIe, USB, HDMI, ...) |
+| | [0].status | X | | X | X | | printer status (e.g. idle) |
+
+#### 13. Network related functions
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ------------------------------ | ------------------ | ----- | --- | --- | --- | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| si.networkInterfaces(cb) | [{...}] | X | X | X | X | X | array of network interfaces<br>With the 'default' parameter it returns<br>only the default interface |
+| | [0].iface | X | X | X | X | X | interface |
+| | [0].ifaceName | X | X | X | X | X | interface name (differs on Windows) |
+| | [0].default | X | X | X | X | X | true if this is the default interface |
+| | [0].ip4 | X | X | X | X | X | ip4 address |
+| | [0].ip4subnet | X | X | X | X | X | ip4 subnet mask |
+| | [0].ip6 | X | X | X | X | X | ip6 address |
+| | [0].ip6subnet | X | X | X | X | X | ip6 subnet mask |
+| | [0].mac | X | X | X | X | X | MAC address |
+| | [0].internal | X | X | X | X | X | true if internal interface |
+| | [0].virtual | X | X | X | X | X | true if virtual interface |
+| | [0].operstate | X | | X | X | | up / down |
+| | [0].type | X | | X | X | | wireless / wired |
+| | [0].duplex | X | | X | | | duplex |
+| | [0].mtu | X | | X | | | maximum transmission unit |
+| | [0].speed | X | | X | X | | speed in MBit / s |
+| | [0].dhcp | X | | X | X | | IP address obtained by DHCP |
+| | [0].dnsSuffix | X | | | X | | DNS suffix |
+| | [0].ieee8021xAuth | X | | | X | | IEEE 802.1x auth |
+| | [0].ieee8021xState | X | | | X | | IEEE 802.1x state |
+| | [0].carrierChanges | X | | | | | # changes up/down |
+| si.networkInterfaceDefault(cb) | : string | X | X | X | X | X | get name of default network interface |
+| si.networkGatewayDefault(cb) | : string | X | X | X | X | X | get default network gateway |
+| si.networkStats(ifaces,cb) | [{...}] | X | X | X | X | | current network stats of given interfaces<br>iface list: space or comma separated<br>iface parameter is optional<br>defaults to first external network interface,<br />Pass '*' for all interfaces |
+| | [0].iface | X | X | X | X | | interface |
+| | [0].operstate | X | X | X | X | | up / down |
+| | [0].rx_bytes | X | X | X | X | | received bytes overall |
+| | [0].rx_dropped | X | X | X | X | | received dropped overall |
+| | [0].rx_errors | X | X | X | X | | received errors overall |
+| | [0].tx_bytes | X | X | X | X | | transferred bytes overall |
+| | [0].tx_dropped | X | X | X | X | | transferred dropped overall |
+| | [0].tx_errors | X | X | X | X | | transferred errors overall |
+| | [0].rx_sec | X | X | X | X | | received bytes / second (* see notes) |
+| | [0].tx_sec | X | X | X | X | | transferred bytes per second (* see notes) |
+| | [0].ms | X | X | X | X | | interval length (for per second values) |
+| si.networkConnections(cb) | [{...}] | X | X | X | X | | current network network connections<br>returns an array of all connections |
+| | [0].protocol | X | X | X | X | | tcp or udp |
+| | [0].localAddress | X | X | X | X | | local address |
+| | [0].localPort | X | X | X | X | | local port |
+| | [0].peerAddress | X | X | X | X | | peer address |
+| | [0].peerPort | X | X | X | X | | peer port |
+| | [0].state | X | X | X | X | | like ESTABLISHED, TIME_WAIT, ... |
+| | [0].pid | X | X | X | X | | process ID |
+| | [0].process | X | X | X | | | process name |
+| si.inetChecksite(url, cb) | {...} | X | X | X | X | X | response-time (ms) to fetch given URL |
+| | url | X | X | X | X | X | given url |
+| | ok | X | X | X | X | X | status code OK (2xx, 3xx) |
+| | status | X | X | X | X | X | status code |
+| | ms | X | X | X | X | X | response time in ms |
+| si.inetLatency(host, cb) | : number | X | X | X | X | X | response-time (ms) to external resource<br>host parameter is optional (default 8.8.8.8) |
+
+#### 14. Wifi
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ---------------------- | --------------- | ----- | --- | --- | --- | --- | --------------------------------- |
+| si.wifiNetworks(cb) | [{...}] | X | | X | X | | array of available wifi networks |
+| | [0].ssid | X | | X | X | | Wifi network SSID |
+| | [0].bssid | X | | X | X | | BSSID (mac) |
+| | [0].mode | X | | | | | mode |
+| | [0].channel | X | | X | X | | channel |
+| | [0].frequency | X | | X | X | | frequency in MHz |
+| | [0].signalLevel | X | | X | X | | signal level in dB |
+| | [0].quality | X | | X | X | | quality in % |
+| | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
+| | [0].wpaFlags | X | | X | X | | array of WPA flags |
+| | [0].rsnFlags | X | | | | | array of RDN flags |
+| si.wifiInterfaces(cb) | [{...}] | X | | X | X | | array of detected wifi interfaces |
+| | [0].id | X | | X | X | | ID |
+| | [0].iface | X | | X | X | | interface |
+| | [0].model | X | | X | X | | model |
+| | [0].vendor | X | | X | X | | vendor |
+| | [0].mac | X | | X | X | | MAC address |
+| si.wifiConnections(cb) | [{...}] | X | | X | X | | array of active wifi connections |
+| | [0].id | X | | X | X | | ID |
+| | [0].iface | X | | X | X | | interface |
+| | [0].name | X | | X | X | | name |
+| | [0].mode | X | | X | X | | model |
+| | [0].bssid | X | | X | X | | BSSID (mac) |
+| | [0].mode | X | | | | | mode |
+| | [0].channel | X | | X | X | | channel |
+| | [0].frequency | X | | X | X | | frequency in MHz |
+| | [0].signalLevel | X | | X | X | | signal level in dB |
+| | [0].quality | X | | X | X | | quality in % |
+| | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
+| | [0].txRate | X | | X | X | | transfer rate MBit/s |
+
+#### 15. Bluetooth
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ----------------------- | ------------------ | ----- | --- | --- | --- | --- | ------------------------ |
+| si.bluetoothDevices(cb) | [{...}] | X | | X | X | | ... |
+| | [0].device | | | X | | | device name |
+| | [0].name | X | | X | X | | name |
+| | [0].macDevice | X | | X | | | MAC address device |
+| | [0].macHost | X | | X | | | MAC address host |
+| | [0].batteryPercent | | | X | | | battery level percent |
+| | [0].manufacturer | | | X | X | | manufacturer |
+| | [0].type | X | | X | X | | type of bluetooth device |
+| | [0].connected | X | | X | | | is connected |
+
+#### 16. Docker
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ----------------------------------- | ------------------- | ----------------------------------- | --- | --- | --- | --- | ------------------------------------------------------------------------------------------------------------- |
+| si.dockerInfo(cb) | {...} | X | X | X | X | X | returns general docker info |
+| | id | X | X | X | X | X | Docker ID |
+| | containers | X | X | X | X | X | number of containers |
+| | containersRunning | X | X | X | X | X | number of running containers |
+| | containersPaused | X | X | X | X | X | number of paused containers |
+| | containersStopped | X | X | X | X | X | number of stopped containers |
+| | images | X | X | X | X | X | number of images |
+| | driver | X | X | X | X | X | driver (e.g. 'devicemapper', 'overlay2') |
+| | memoryLimit | X | X | X | X | X | has memory limit |
+| | swapLimit | X | X | X | X | X | has swap limit |
+| | kernelMemory | X | X | X | X | X | has kernel memory |
+| | cpuCfsPeriod | X | X | X | X | X | has CpuCfsPeriod |
+| | cpuCfsQuota | X | X | X | X | X | has CpuCfsQuota |
+| | cpuShares | X | X | X | X | X | has CPUShares |
+| | cpuSet | X | X | X | X | X | has CPUShares |
+| | ipv4Forwarding | X | X | X | X | X | has IPv4Forwarding |
+| | bridgeNfIptables | X | X | X | X | X | has BridgeNfIptables |
+| | bridgeNfIp6tables | X | X | X | X | X | has BridgeNfIp6tables |
+| | debug | X | X | X | X | X | Debug on |
+| | nfd | X | X | X | X | X | named data networking forwarding daemon |
+| | oomKillDisable | X | X | X | X | X | out-of-memory kill disabled |
+| | ngoroutines | X | X | X | X | X | number NGoroutines |
+| | systemTime | X | X | X | X | X | docker SystemTime |
+| | loggingDriver | X | X | X | X | X | logging driver e.g. 'json-file' |
+| | cgroupDriver | X | X | X | X | X | cgroup driver e.g. 'cgroupfs' |
+| | nEventsListener | X | X | X | X | X | number NEventsListeners |
+| | kernelVersion | X | X | X | X | X | docker kernel version |
+| | operatingSystem | X | X | X | X | X | docker OS e.g. 'Docker for Mac' |
+| | osType | X | X | X | X | X | OSType e.g. 'linux' |
+| | architecture | X | X | X | X | X | architecture e.g. x86_64 |
+| | ncpu | X | X | X | X | X | number of CPUs |
+| | memTotal | X | X | X | X | X | memory total |
+| | dockerRootDir | X | X | X | X | X | docker root directory |
+| | httpProxy | X | X | X | X | X | http proxy |
+| | httpsProxy | X | X | X | X | X | https proxy |
+| | noProxy | X | X | X | X | X | NoProxy |
+| | name | X | X | X | X | X | Name |
+| | labels | X | X | X | X | X | array of labels |
+| | experimentalBuild | X | X | X | X | X | is experimental build |
+| | serverVersion | X | X | X | X | X | server version |
+| | clusterStore | X | X | X | X | X | cluster store |
+| | clusterAdvertise | X | X | X | X | X | cluster advertise |
+| | defaultRuntime | X | X | X | X | X | default runtime e.g. 'runc' |
+| | liveRestoreEnabled | X | X | X | X | X | live store enabled |
+| | isolation | X | X | X | X | X | isolation |
+| | initBinary | X | X | X | X | X | init binary |
+| | productLicense | X | X | X | X | X | product license |
+| si.dockerImages(all, cb) | [{...}] | X | X | X | X | X | returns array of top level/all docker images |
+| | [0].id | X | X | X | X | X | image ID |
+| | [0].container | X | X | X | X | X | container ID |
+| | [0].comment | X | X | X | X | X | comment |
+| | [0].os | X | X | X | X | X | OS |
+| | [0].architecture | X | X | X | X | X | architecture |
+| | [0].parent | X | X | X | X | X | parent ID |
+| | [0].dockerVersion | X | X | X | X | X | docker version |
+| | [0].size | X | X | X | X | X | image size |
+| | [0].sharedSize | X | X | X | X | X | shared size |
+| | [0].virtualSize | X | X | X | X | X | virtual size |
+| | [0].author | X | X | X | X | X | author |
+| | [0].created | X | X | X | X | X | created date / time |
+| | [0].containerConfig | X | X | X | X | X | container config object |
+| | [0].graphDriver | X | X | X | X | X | graph driver object |
+| | [0].repoDigests | X | X | X | X | X | repo digests array |
+| | [0].repoTags | X | X | X | X | X | repo tags array |
+| | [0].config | X | X | X | X | X | config object |
+| | [0].rootFS | X | X | X | X | X | root fs object |
+| si.dockerContainers(all, cb) | [{...}] | X | X | X | X | X | returns array of active/all docker containers |
+| | [0].id | X | X | X | X | X | ID of container |
+| | [0].name | X | X | X | X | X | name of container |
+| | [0].image | X | X | X | X | X | name of image |
+| | [0].imageID | X | X | X | X | X | ID of image |
+| | [0].command | X | X | X | X | X | command |
+| | [0].created | X | X | X | X | X | creation time (unix) |
+| | [0].started | X | X | X | X | X | creation time (unix) |
+| | [0].finished | X | X | X | X | X | creation time (unix) |
+| | [0].createdAt | X | X | X | X | X | creation date time string |
+| | [0].startedAt | X | X | X | X | X | creation date time string |
+| | [0].finishedAt | X | X | X | X | X | creation date time string |
+| | [0].state | X | X | X | X | X | created, running, exited |
+| | [0].ports | X | X | X | X | X | array of ports |
+| | [0].mounts | X | X | X | X | X | array of mounts |
+| si.dockerContainerStats(ids, cb) | [{...}] | X | X | X | X | X | statistics for specific containers<br>container IDs: space or comma separated,<br>pass '*' for all containers |
+| | [0].id | X | X | X | X | X | Container ID |
+| | [0].memUsage | X | X | X | X | X | memory usage in bytes |
+| | [0].memLimit | X | X | X | X | X | memory limit (max mem) in bytes |
+| | [0].memPercent | X | X | X | X | X | memory usage in percent |
+| | [0].cpuPercent | X | X | X | X | X | cpu usage in percent |
+| | [0].pids | X | X | X | X | X | number of processes |
+| | [0].netIO.rx | X | X | X | X | X | received bytes via network |
+| | [0].netIO.wx | X | X | X | X | X | sent bytes via network |
+| | [0].blockIO.r | X | X | X | X | X | bytes read from BlockIO |
+| | [0].blockIO.w | X | X | X | X | X | bytes written to BlockIO |
+| | [0].cpuStats | X | X | X | X | X | detailed cpu stats |
+| | [0].percpuStats | X | X | X | X | X | detailed per cpu stats |
+| | [0].memoryStats | X | X | X | X | X | detailed memory stats |
+| | [0].networks | X | X | X | X | X | detailed network stats per interface |
+| si.dockerContainerProcesses(id, cb) | [{...}] | X | X | X | X | X | array of processes inside a container |
+| | [0].pidHost | X | X | X | X | X | process ID (host) |
+| | [0].ppid | X | X | X | X | X | parent process ID |
+| | [0].pgid | X | X | X | X | X | process group ID |
+| | [0].user | X | X | X | X | X | effective user name |
+| | [0].ruser | X | X | X | X | X | real user name |
+| | [0].group | X | X | X | X | X | effective group name |
+| | [0].rgroup | X | X | X | X | X | real group name |
+| | [0].stat | X | X | X | X | X | process state |
+| | [0].time | X | X | X | X | X | accumulated CPU time |
+| | [0].elapsed | X | X | X | X | X | elapsed running time |
+| | [0].nice | X | X | X | X | X | nice value |
+| | [0].rss | X | X | X | X | X | resident set size |
+| | [0].vsz | X | X | X | X | X | virtual size in Kbytes |
+| | [0].command | X | X | X | X | X | command and arguments |
+| si.dockerVolumes(cb) | [{...}] | returns array of all docker volumes |
+| | [0].name | X | X | X | X | X | volume name |
+| | [0].driver | X | X | X | X | X | driver |
+| | [0].labels | X | X | X | X | X | labels object |
+| | [0].mountpoint | X | X | X | X | X | mountpoint |
+| | [0].options | X | X | X | X | X | options |
+| | [0].scope | X | X | X | X | X | scope |
+| | [0].created | X | X | X | X | X | created at |
+| si.dockerAll(cb) | {...} | X | X | X | X | X | list of all containers including their stats<br>and processes in one single array |
+
+#### 17. Virtual Box
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| --------------- | -------------------- | ----- | --- | --- | --- | --- | -------------------------------------- |
+| si.vboxInfo(cb) | [{...}] | X | X | X | X | X | returns array general virtual box info |
+| | [0].id | X | X | X | X | X | virtual box ID |
+| | [0].name | X | X | X | X | X | name |
+| | [0].running | X | X | X | X | X | vbox is running |
+| | [0].started | X | X | X | X | X | started date time |
+| | [0].runningSince | X | X | X | X | X | running since (secs) |
+| | [0].stopped | X | X | X | X | X | stopped date time |
+| | [0].stoppedSince | X | X | X | X | X | stopped since (secs) |
+| | [0].guestOS | X | X | X | X | X | Guest OS |
+| | [0].hardwareUUID | X | X | X | X | X | Hardware UUID |
+| | [0].memory | X | X | X | X | X | Memory in MB |
+| | [0].vram | X | X | X | X | X | VRAM in MB |
+| | [0].cpus | X | X | X | X | X | CPUs |
+| | [0].cpuExepCap | X | X | X | X | X | CPU exec cap |
+| | [0].cpuProfile | X | X | X | X | X | CPU profile |
+| | [0].chipset | X | X | X | X | X | chipset |
+| | [0].firmware | X | X | X | X | X | firmware |
+| | [0].pageFusion | X | X | X | X | X | page fusion |
+| | [0].configFile | X | X | X | X | X | config file |
+| | [0].snapshotFolder | X | X | X | X | X | snapshot folder |
+| | [0].logFolder | X | X | X | X | X | log folder path |
+| | [0].hpet | X | X | X | X | X | HPET |
+| | [0].pae | X | X | X | X | X | PAE |
+| | [0].longMode | X | X | X | X | X | long mode |
+| | [0].tripleFaultReset | X | X | X | X | X | triple fault reset |
+| | [0].apic | X | X | X | X | X | APIC |
+| | [0].x2Apic | X | X | X | X | X | X2APIC |
+| | [0].acpi | X | X | X | X | X | ACPI |
+| | [0].ioApic | X | X | X | X | X | IOAPIC |
+| | [0].biosApicMode | X | X | X | X | X | BIOS APIC mode |
+| | [0].bootMenuMode | X | X | X | X | X | boot menu Mode |
+| | [0].bootDevice1 | X | X | X | X | X | bootDevice1 |
+| | [0].bootDevice2 | X | X | X | X | X | bootDevice2 |
+| | [0].bootDevice3 | X | X | X | X | X | bootDevice3 |
+| | [0].bootDevice4 | X | X | X | X | X | bootDevice4 |
+| | [0].timeOffset | X | X | X | X | X | time Offset |
+| | [0].rtc | X | X | X | X | X | RTC |
+
+#### 16. "Get All / Observe" - functions
+
+| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
+| ----------------------------------- | ------------- | ----- | --- | --- | --- | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| si.getStaticData(cb) | {...} | X | X | X | X | X | all static data at once |
+| si.getDynamicData(srv,iface,cb) | {...} | X | X | X | X | X | all dynamic data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces |
+| si.getAllData(srv,iface,cb) | {...} | X | X | X | X | X | all data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces |
+| si.get(valueObject,cb) | {...} | X | X | X | X | X | get partial system info data at once<br>In valueObject you can define<br>all values, you want to get back <br>(see documentation for details) |
+| si.observe(valueObject,interval,cb) | - | X | X | X | X | X | Observe a defined value object<br>call callback on changes<br>polling interval in milliseconds |
+
+### cb: Asynchronous Function Calls (callback)
+
+Remember: all functions (except `version` and `time`) are implemented as asynchronous functions! There are now three ways to consume them:
+
+**Callback Style**
+
+```js
+const si = require('systeminformation');
+
+si.cpu(function(data) {
+ console.log('CPU Information:');
+ console.log('- manufacturer: ' + data.manufacturer);
+ console.log('- brand: ' + data.brand);
+ console.log('- speed: ' + data.speed);
+ console.log('- cores: ' + data.cores);
+ console.log('- physical cores: ' + data.physicalCores);
+ console.log('...');
+})
+```
+
+### Promises
+
+**Promises Style** is new in version 3.0.
+
+When omitting callback parameter (cb), then you can use all function in a promise oriented way. All functions (except of `version` and `time`) are returning a promise, that you can consume:
+
+```js
+const si = require('systeminformation');
+
+si.cpu()
+ .then(data => {
+ console.log('CPU Information:');
+ console.log('- manufacturer: ' + data.manufacturer);
+ console.log('- brand: ' + data.brand);
+ console.log('- speed: ' + data.speed);
+ console.log('- cores: ' + data.cores);
+ console.log('- physical cores: ' + data.physicalCores);
+ console.log('...');
+ })
+ .catch(error => console.error(error));
+```
+
+### Async / Await
+
+**Using async / await** (available since node v7.6)
+
+Since node v7.6 you can also use the `async` / `await` pattern. The above example would then look like this:
+
+```js
+const si = require('systeminformation');
+
+async function cpuData() {
+ try {
+ const data = await si.cpu();
+ console.log('CPU Information:');
+ console.log('- manufacturer: ' + data.manufacturer);
+ console.log('- brand: ' + data.brand);
+ console.log('- speed: ' + data.speed);
+ console.log('- cores: ' + data.cores);
+ console.log('- physical cores: ' + data.physicalCores);
+ console.log('...');
+ } catch (e) {
+ console.log(e)
+ }
+}
+```
+
+## Known Issues
+
+#### macOS - Temperature Sensor
+
+To be able to measure temperature on macOS I created a little additional package. Due to some difficulties
+in NPM with `optionalDependencies` I unfortunately was getting unexpected warnings on other platforms.
+So I decided to drop this optional dependency for macOS - so by default, you will not get correct values.
+
+This additional package is now also supporting Apple Silicon M1 machines.
+
+But if you need to detect macOS temperature just run the following additional
+installation command:
+
+```bash
+$ npm install osx-temperature-sensor --save
+```
+
+`systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`
+
+#### Windows Temperature, Battery, ...
+
+`get-WmiObject` - which is used to determine temperature and battery sometimes needs to be run with admin
+privileges. So if you do not get any values, try to run it again with according
+privileges. If you still do not get any values, your system might not support this feature.
+In some cases we also discovered that `get-WmiObject` returned incorrect temperature values.
+
+#### Linux Temperature
+
+In some cases you need to install the Linux `sensors` package to be able to measure temperature
+e.g. on DEBIAN based systems by running `sudo apt-get install lm-sensors`
+
+#### Linux S.M.A.R.T. Status
+
+To be able to detect S.M.A.R.T. status on Linux you need to install `smartmontools`. On DEBIAN based Linux distributions you can install it by running `sudo apt-get install smartmontools`
+
+#### Windows Encoding Issues
+I now reimplemented all windows functions to avoid encoding problems (special chacarters). And as Windows 11 now dropped `wmic` support, I had to move completely to `powershell`. Be sure that powershell version 5+ is installed on your machine. On older Windows versions (7, 8) you might still see encoding problems due to the old powershell version.
+## *: Additional Notes
+
+In `fsStats()`, `disksIO()` and `networkStats()` the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
+with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs
+divided by the time between two calls of the function.
+
+The first time you are calling one of these functions, you will get `null` for transfer rates. The second time, you should then get statistics based on the time between the two calls ...
+
+So basically, if you e.g. need a value for network stats every second, your code should look like this:
+
+```js
+const si = require('systeminformation');
+
+setInterval(function() {
+ si.networkStats().then(data => {
+ console.log(data);
+ })
+}, 1000)
+```
+
+Beginning with the second call, you get network transfer values per second.
+
+## Finding new issues
+
+I am happy to discuss any comments and suggestions. Please feel free to contact me if you see any possibility of improvement!
+
+
+## Comments
+
+If you have ideas or comments, please do not hesitate to contact me.
+
+
+Happy monitoring!
+
+Sincerely,
+
+Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com)
+
+## Credits
+
+Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebrandt)
+
+#### Contributors
+
+- Guillaume Legrain [glegrain](https://github.com/glegrain)
+- Riccardo Novaglia [richy24](https://github.com/richy24)
+- Quentin Busuttil [Buzut](https://github.com/Buzut)
+- lapsio [lapsio](https://github.com/lapsio)
+- csy [csy](https://github.com/csy1983)
+- Tiago Roldão [tiagoroldao](https://github.com/tiagoroldao)
+- dragonjet [dragonjet](https://github.com/dragonjet)
+- Adam Reis [adamreisnz](https://github.com/adamreisnz)
+- Jimi M [ItsJimi](https://github.com/ItsJimi)
+- Git² [GitSquared](https://github.com/GitSquared)
+- weiyin [weiyin](https://github.com/weiyin)
+- Jorai Rijsdijk [Erackron](https://github.com/Erackron)
+- Rasmus Porsager [porsager](https://github.com/porsager)
+- Nathan Patten [nrpatten](https://github.com/nrpatten)
+- Juan Campuzano [juancampuzano](https://github.com/juancampuzano)
+- Ricardo Polo [ricardopolo](https://github.com/ricardopolo)
+- Miłosz Dźwigała [mily20001](https://github.com/mily20001)
+- cconley717 [cconley717](https://github.com/cconley717)
+- Maria Camila Cubides [MariaCamilaCubides](https://github.com/MariaCamilaCubides)
+- Aleksander Krasnicki [plakak](https://github.com/plakak)
+- Alexis Tyler [OmgImAlexis](https://github.com/OmgImAlexis)
+- Simon Smith [si458](https://github.com/si458)
+
+OSX Temperature: credits here are going to:
+
+- Frank Stock [pcafstockf](https://github.com/pcafstockf) - for his work on [smc-code][smc-code-url]
+
+## Copyright Information
+
+Linux is a registered trademark of Linus Torvalds. Apple, macOS, OS X are registered trademarks of Apple Inc.,
+Windows is a registered trademark of Microsoft Corporation. Node.js is a trademark of Joyent Inc.,
+Intel is a trademark of Intel Corporation, AMD is a trademark of Advanced Micro Devices Inc.,
+Raspberry Pi is a trademark of the Raspberry Pi Foundation, Debian is a trademark owned by Software in the Public Interest, Inc.,
+Ubuntu is a trademark of Canonical Ltd., FreeBSD is a registered trademark of The FreeBSD Foundation,
+NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark of Docker, Inc., Sun,
+Solaris, OpenSolaris and registered trademarks of Sun Microsystems, VMware is a trademark of VMware Inc,
+Virtual Box is a trademark of Oracle Corporation, Xen is a registered trademark of Xen Project,
+QEMU is a trademark of Fabrice Bellard, bochs is a trademark of The Bochs Project, USB and USB Logo
+are trademarks of USB Implementation Forum, Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG,
+Android is a trademark of Google LLC, Parallels is a trademarks of Parallels International GmbH.
+
+All other trademarks are the property of their respective owners.
+
+## License [![MIT license][license-img]][license-url]
+
+>The [`MIT`][license-url] License (MIT)
+>
+>Copyright &copy; 2014-2023 Sebastian Hildebrandt, [+innovations](http://www.plus-innovations.com).
+>
+>Permission is hereby granted, free of charge, to any person obtaining a copy
+>of this software and associated documentation files (the "Software"), to deal
+>in the Software without restriction, including without limitation the rights
+>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+>copies of the Software, and to permit persons to whom the Software is
+>furnished to do so, subject to the following conditions:
+>
+>The above copyright notice and this permission notice shall be included in
+>all copies or substantial portions of the Software.
+>
+>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+>THE SOFTWARE.
+>
+>Further details see [LICENSE](LICENSE) file.
+
+
+[npm-image]: https://img.shields.io/npm/v/systeminformation.svg?style=flat-square
+[npm-url]: https://npmjs.org/package/systeminformation
+[downloads-image]: https://img.shields.io/npm/dm/systeminformation.svg?style=flat-square
+[downloads-url]: https://npmjs.org/package/systeminformation
+
+[sponsor-badge]: https://img.shields.io/badge/Support-Buy%20me%20a%20coffee-brightgreen?style=flat-square
+[sponsor-url]: https://www.buymeacoffee.com/systeminfo
+
+[license-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/LICENSE
+[license-img]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
+[npmjs-license]: https://img.shields.io/npm/l/systeminformation.svg?style=flat-square
+[changelog-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/CHANGELOG.md
+[changes5-url]: https://systeminformation.io/changes.html
+[caretaker-url]: https://github.com/sebhildebrandt
+[caretaker-image]: https://img.shields.io/badge/caretaker-sebhildebrandt-blue.svg?style=flat-square
+
+[nodejs-url]: https://nodejs.org/en/
+[docker-url]: https://www.docker.com/
+[systeminformation-url]: https://systeminformation.io
+
+[daviddm-img]: https://img.shields.io/david/sebhildebrandt/systeminformation.svg?style=flat-square
+[daviddm-url]: https://david-dm.org/sebhildebrandt/systeminformation
+
+[issues-img]: https://img.shields.io/github/issues/sebhildebrandt/systeminformation.svg?style=flat-square
+[issues-url]: https://github.com/sebhildebrandt/systeminformation/issues
+[closed-issues-img]: https://img.shields.io/github/issues-closed-raw/sebhildebrandt/systeminformation.svg?style=flat-square&color=brightgreen
+[closed-issues-url]: https://github.com/sebhildebrandt/systeminformation/issues?q=is%3Aissue+is%3Aclosed
+
+[new-issue]: https://github.com/sebhildebrandt/systeminformation/issues/new/choose
+
+[mmon-npm-url]: https://npmjs.org/package/mmon
+[mmon-github-url]: https://github.com/sebhildebrandt/mmon
+
+[smc-code-url]: https://github.com/pcafstockf/smc-reader
diff --git a/node_modules/systeminformation/lib/audio.js b/node_modules/systeminformation/lib/audio.js
new file mode 100644
index 0000000..dc1f9b0
--- /dev/null
+++ b/node_modules/systeminformation/lib/audio.js
@@ -0,0 +1,222 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// audio.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 16. audio
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function parseAudioType(str, input, output) {
+ str = str.toLowerCase();
+ let result = '';
+
+ if (str.indexOf('input') >= 0) { result = 'Microphone'; }
+ if (str.indexOf('display audio') >= 0) { result = 'Speaker'; }
+ if (str.indexOf('speak') >= 0) { result = 'Speaker'; }
+ if (str.indexOf('laut') >= 0) { result = 'Speaker'; }
+ if (str.indexOf('loud') >= 0) { result = 'Speaker'; }
+ if (str.indexOf('head') >= 0) { result = 'Headset'; }
+ if (str.indexOf('mic') >= 0) { result = 'Microphone'; }
+ if (str.indexOf('mikr') >= 0) { result = 'Microphone'; }
+ if (str.indexOf('phone') >= 0) { result = 'Phone'; }
+ if (str.indexOf('controll') >= 0) { result = 'Controller'; }
+ if (str.indexOf('line o') >= 0) { result = 'Line Out'; }
+ if (str.indexOf('digital o') >= 0) { result = 'Digital Out'; }
+ if (str.indexOf('smart sound technology') >= 0) { result = 'Digital Signal Processor'; }
+ if (str.indexOf('high definition audio') >= 0) { result = 'Sound Driver'; }
+
+ if (!result && output) {
+ result = 'Speaker';
+ } else if (!result && input) {
+ result = 'Microphone';
+ }
+ return result;
+}
+
+
+function getLinuxAudioPci() {
+ let cmd = 'lspci -v 2>/dev/null';
+ let result = [];
+ try {
+ const parts = execSync(cmd).toString().split('\n\n');
+ parts.forEach(element => {
+ const lines = element.split('\n');
+ if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
+ const audio = {};
+ audio.slotId = lines[0].split(' ')[0];
+ audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true);
+ result.push(audio);
+ }
+ });
+ return result;
+ } catch (e) {
+ return result;
+ }
+}
+
+function parseLinuxAudioPciMM(lines, audioPCI) {
+ const result = {};
+ const slotId = util.getValue(lines, 'Slot');
+
+ const pciMatch = audioPCI.filter(function (item) { return item.slotId === slotId; });
+
+ result.id = slotId;
+ result.name = util.getValue(lines, 'SDevice');
+ result.manufacturer = util.getValue(lines, 'SVendor');
+ result.revision = util.getValue(lines, 'Rev');
+ result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
+ result.default = null;
+ result.channel = 'PCIe';
+ result.type = parseAudioType(result.name, null, null);
+ result.in = null;
+ result.out = null;
+ result.status = 'online';
+
+ return result;
+}
+
+function parseDarwinChannel(str) {
+ let result = '';
+
+ if (str.indexOf('builtin') >= 0) { result = 'Built-In'; }
+ if (str.indexOf('extern') >= 0) { result = 'Audio-Jack'; }
+ if (str.indexOf('hdmi') >= 0) { result = 'HDMI'; }
+ if (str.indexOf('displayport') >= 0) { result = 'Display-Port'; }
+ if (str.indexOf('usb') >= 0) { result = 'USB'; }
+ if (str.indexOf('pci') >= 0) { result = 'PCIe'; }
+
+ return result;
+}
+
+function parseDarwinAudio(audioObject, id) {
+ const result = {};
+ const channelStr = ((audioObject.coreaudio_device_transport || '') + ' ' + (audioObject._name || '')).toLowerCase();
+
+ result.id = id;
+ result.name = audioObject._name;
+ result.manufacturer = audioObject.coreaudio_device_manufacturer;
+ result.revision = null;
+ result.driver = null;
+ result.default = !!(audioObject.coreaudio_default_audio_input_device || '') || !!(audioObject.coreaudio_default_audio_output_device || '');
+ result.channel = parseDarwinChannel(channelStr);
+ result.type = parseAudioType(result.name, !!(audioObject.coreaudio_device_input || ''), !!(audioObject.coreaudio_device_output || ''));
+ result.in = !!(audioObject.coreaudio_device_input || '');
+ result.out = !!(audioObject.coreaudio_device_output || '');
+ result.status = 'online';
+
+ return result;
+}
+
+function parseWindowsAudio(lines) {
+ const result = {};
+ const status = util.getValue(lines, 'StatusInfo', ':');
+
+ result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
+ result.name = util.getValue(lines, 'name', ':');
+ result.manufacturer = util.getValue(lines, 'manufacturer', ':');
+ result.revision = null;
+ result.driver = null;
+ result.default = null;
+ result.channel = null;
+ result.type = parseAudioType(result.name, null, null);
+ result.in = null;
+ result.out = null;
+ result.status = status;
+
+ return result;
+}
+
+function audio(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ let cmd = 'lspci -vmm 2>/dev/null';
+ exec(cmd, function (error, stdout) {
+ // PCI
+ if (!error) {
+ const audioPCI = getLinuxAudioPci();
+ const parts = stdout.toString().split('\n\n');
+ parts.forEach(element => {
+ const lines = element.split('\n');
+ if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
+ const audio = parseLinuxAudioPciMM(lines, audioPCI);
+ result.push(audio);
+ }
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ let cmd = 'system_profiler SPAudioDataType -json';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ try {
+ const outObj = JSON.parse(stdout.toString());
+ if (outObj.SPAudioDataType && outObj.SPAudioDataType.length && outObj.SPAudioDataType[0] && outObj.SPAudioDataType[0]['_items'] && outObj.SPAudioDataType[0]['_items'].length) {
+ for (let i = 0; i < outObj.SPAudioDataType[0]['_items'].length; i++) {
+ const audio = parseDarwinAudio(outObj.SPAudioDataType[0]['_items'][i], i);
+ result.push(audio);
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
+ if (!error) {
+ const parts = stdout.toString().split(/\n\s*\n/);
+ parts.forEach(element => {
+ const lines = element.split('\n');
+ if (util.getValue(lines, 'name', ':')) {
+ result.push(parseWindowsAudio(lines));
+ }
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ resolve(null);
+ }
+ });
+ });
+}
+
+exports.audio = audio;
diff --git a/node_modules/systeminformation/lib/battery.js b/node_modules/systeminformation/lib/battery.js
new file mode 100644
index 0000000..70a3a67
--- /dev/null
+++ b/node_modules/systeminformation/lib/battery.js
@@ -0,0 +1,308 @@
+'use strict';
+// @ts-check;
+// ==================================================================================
+// battery.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 6. Battery
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const fs = require('fs');
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
+ const result = {};
+ let status = util.getValue(lines, 'BatteryStatus', ':').trim();
+ // 1 = "Discharging"
+ // 2 = "On A/C"
+ // 3 = "Fully Charged"
+ // 4 = "Low"
+ // 5 = "Critical"
+ // 6 = "Charging"
+ // 7 = "Charging High"
+ // 8 = "Charging Low"
+ // 9 = "Charging Critical"
+ // 10 = "Undefined"
+ // 11 = "Partially Charged"
+ if (status >= 0) {
+ const statusValue = status ? parseInt(status) : 0;
+ result.status = statusValue;
+ result.hasBattery = true;
+ result.maxCapacity = fullChargeCapacity || parseInt(util.getValue(lines, 'DesignCapacity', ':') || 0);
+ result.designedCapacity = parseInt(util.getValue(lines, 'DesignCapacity', ':') || designedCapacity);
+ result.voltage = parseInt(util.getValue(lines, 'DesignVoltage', ':') || 0) / 1000.0;
+ result.capacityUnit = 'mWh';
+ result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0);
+ result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100);
+ result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100);
+ result.acConnected = result.isCharging || statusValue === 2;
+ result.model = util.getValue(lines, 'DeviceID', ':');
+ } else {
+ result.status = -1;
+ }
+
+ return result;
+}
+
+module.exports = function (callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+ hasBattery: false,
+ cycleCount: 0,
+ isCharging: false,
+ designedCapacity: 0,
+ maxCapacity: 0,
+ currentCapacity: 0,
+ voltage: 0,
+ capacityUnit: '',
+ percent: 0,
+ timeRemaining: null,
+ acConnected: true,
+ type: '',
+ model: '',
+ manufacturer: '',
+ serial: ''
+ };
+
+ if (_linux) {
+ let battery_path = '';
+ if (fs.existsSync('/sys/class/power_supply/BAT1/uevent')) {
+ battery_path = '/sys/class/power_supply/BAT1/';
+ } else if (fs.existsSync('/sys/class/power_supply/BAT0/uevent')) {
+ battery_path = '/sys/class/power_supply/BAT0/';
+ }
+
+ let acConnected = false;
+ let acPath = '';
+ if (fs.existsSync('/sys/class/power_supply/AC/online')) {
+ acPath = '/sys/class/power_supply/AC/online';
+ } else if (fs.existsSync('/sys/class/power_supply/AC0/online')) {
+ acPath = '/sys/class/power_supply/AC0/online';
+ }
+
+ if (acPath) {
+ const file = fs.readFileSync(acPath);
+ acConnected = file.toString().trim() === '1';
+ }
+
+ if (battery_path) {
+ fs.readFile(battery_path + 'uevent', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+
+ result.isCharging = (util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging');
+ result.acConnected = acConnected || result.isCharging;
+ result.voltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_NOW', '='), 10) / 1000000.0;
+ result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
+ result.cycleCount = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CYCLE_COUNT', '='), 10);
+ result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL', '=', true, true), 10) / 1000.0 * (result.voltage || 1));
+ const desingedMinVoltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_MIN_DESIGN', '='), 10) / 1000000.0;
+ result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL_DESIGN', '=', true, true), 10) / 1000.0 * (desingedMinVoltage || result.voltage || 1));
+ result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 * (result.voltage || 1));
+ if (!result.maxCapacity) {
+ result.maxCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '=', true, true), 10) / 1000.0;
+ result.designedCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '=', true, true), 10) / 1000.0 | result.maxCapacity;
+ result.currentCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0;
+ }
+ const percent = util.getValue(lines, 'POWER_SUPPLY_CAPACITY', '=');
+ const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10);
+ const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10);
+ const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10);
+
+ result.percent = parseInt('0' + percent, 10);
+ if (result.maxCapacity && result.currentCapacity) {
+ result.hasBattery = true;
+ if (!percent) {
+ result.percent = 100.0 * result.currentCapacity / result.maxCapacity;
+ }
+ }
+ if (result.isCharging) {
+ result.hasBattery = true;
+ }
+ if (energy && power) {
+ result.timeRemaining = Math.floor(energy / power * 60);
+ } else if (current && result.currentCapacity) {
+ result.timeRemaining = Math.floor(result.currentCapacity / current * 60);
+ }
+ result.type = util.getValue(lines, 'POWER_SUPPLY_TECHNOLOGY', '=');
+ result.model = util.getValue(lines, 'POWER_SUPPLY_MODEL_NAME', '=');
+ result.manufacturer = util.getValue(lines, 'POWER_SUPPLY_MANUFACTURER', '=');
+ result.serial = util.getValue(lines, 'POWER_SUPPLY_SERIAL_NUMBER', '=');
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('sysctl -i hw.acpi.battery hw.acpi.acline', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10);
+ const percent = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.life'), 10);
+ result.hasBattery = (batteries > 0);
+ result.cycleCount = null;
+ result.isCharging = util.getValue(lines, 'hw.acpi.acline') !== '1';
+ result.acConnected = result.isCharging;
+ result.maxCapacity = null;
+ result.currentCapacity = null;
+ result.capacityUnit = 'unknown';
+ result.percent = batteries ? percent : null;
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+
+ if (_darwin) {
+ exec('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %', function (error, stdout) {
+ if (stdout) {
+ let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
+ result.cycleCount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10);
+ result.voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0;
+ result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
+ result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawmaxcapacity', '='), 10) * (result.voltage || 1));
+ result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawcurrentcapacity', '='), 10) * (result.voltage || 1));
+ result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1));
+ result.manufacturer = 'Apple';
+ result.serial = util.getValue(lines, 'BatterySerialNumber', '=');
+ let percent = null;
+ const line = util.getValue(lines, 'internal', 'Battery');
+ let parts = line.split(';');
+ if (parts && parts[0]) {
+ let parts2 = parts[0].split('\t');
+ if (parts2 && parts2[1]) {
+ percent = parseFloat(parts2[1].trim().replace(/%/g, ''));
+ }
+ }
+ if (parts && parts[1]) {
+ result.isCharging = (parts[1].trim() === 'charging');
+ result.acConnected = (parts[1].trim() !== 'discharging');
+ } else {
+ result.isCharging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes';
+ result.acConnected = result.isCharging;
+ }
+ if (result.maxCapacity && result.currentCapacity) {
+ result.hasBattery = true;
+ result.type = 'Li-ion';
+ result.percent = percent !== null ? percent : Math.round(100.0 * result.currentCapacity / result.maxCapacity);
+ if (!result.isCharging) {
+ result.timeRemaining = parseInt('0' + util.getValue(lines, 'TimeRemaining', '='), 10);
+ }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl'));
+ workload.push(util.powerShell('(Get-CimInstance -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity'));
+ workload.push(util.powerShell('(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity'));
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ if (data) {
+ let parts = data.results[0].split(/\n\s*\n/);
+ let batteries = [];
+ const hasValue = value => /\S/.test(value);
+ for (let i = 0; i < parts.length; i++) {
+ if (hasValue(parts[i]) && (!batteries.length || !hasValue(parts[i - 1]))) {
+ batteries.push([]);
+ }
+ if (hasValue(parts[i])) {
+ batteries[batteries.length - 1].push(parts[i]);
+ }
+ }
+ let designCapacities = data.results[1].split('\r\n').filter(e => e);
+ let fullChargeCapacities = data.results[2].split('\r\n').filter(e => e);
+ if (batteries.length) {
+ let first = false;
+ let additionalBatteries = [];
+ for (let i = 0; i < batteries.length; i++) {
+ let lines = batteries[i][0].split('\r\n');
+ const designedCapacity = designCapacities && designCapacities.length >= (i + 1) && designCapacities[i] ? util.toInt(designCapacities[i]) : 0;
+ const fullChargeCapacity = fullChargeCapacities && fullChargeCapacities.length >= (i + 1) && fullChargeCapacities[i] ? util.toInt(fullChargeCapacities[i]) : 0;
+ const parsed = parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity);
+ if (!first && parsed.status > 0 && parsed.status !== 10) {
+ result.hasBattery = parsed.hasBattery;
+ result.maxCapacity = parsed.maxCapacity;
+ result.designedCapacity = parsed.designedCapacity;
+ result.voltage = parsed.voltage;
+ result.capacityUnit = parsed.capacityUnit;
+ result.percent = parsed.percent;
+ result.currentCapacity = parsed.currentCapacity;
+ result.isCharging = parsed.isCharging;
+ result.acConnected = parsed.acConnected;
+ result.model = parsed.model;
+ first = true;
+ } else if (parsed.status !== -1) {
+ additionalBatteries.push(
+ {
+ hasBattery: parsed.hasBattery,
+ maxCapacity: parsed.maxCapacity,
+ designedCapacity: parsed.designedCapacity,
+ voltage: parsed.voltage,
+ capacityUnit: parsed.capacityUnit,
+ percent: parsed.percent,
+ currentCapacity: parsed.currentCapacity,
+ isCharging: parsed.isCharging,
+ timeRemaining: null,
+ acConnected: parsed.acConnected,
+ model: parsed.model,
+ type: '',
+ manufacturer: '',
+ serial: ''
+ }
+ );
+ }
+ }
+ if (!first && additionalBatteries.length) {
+ result = additionalBatteries[0];
+ additionalBatteries.shift();
+ }
+ if (additionalBatteries.length) {
+ result.additionalBatteries = additionalBatteries;
+ }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+};
diff --git a/node_modules/systeminformation/lib/bluetooth.js b/node_modules/systeminformation/lib/bluetooth.js
new file mode 100644
index 0000000..1c1326f
--- /dev/null
+++ b/node_modules/systeminformation/lib/bluetooth.js
@@ -0,0 +1,229 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// audio.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 17. bluetooth
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const path = require('path');
+const util = require('./util');
+const fs = require('fs');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function parseBluetoothType(str) {
+ let result = '';
+
+ if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
+ if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
+ if (str.indexOf('speaker') >= 0) { result = 'Speaker'; }
+ if (str.indexOf('headset') >= 0) { result = 'Headset'; }
+ if (str.indexOf('phone') >= 0) { result = 'Phone'; }
+ if (str.indexOf('macbook') >= 0) { result = 'Computer'; }
+ if (str.indexOf('imac') >= 0) { result = 'Computer'; }
+ if (str.indexOf('ipad') >= 0) { result = 'Tablet'; }
+ if (str.indexOf('watch') >= 0) { result = 'Watch'; }
+ if (str.indexOf('headphone') >= 0) { result = 'Headset'; }
+ // to be continued ...
+
+ return result;
+}
+
+function parseBluetoothManufacturer(str) {
+ let result = str.split(' ')[0];
+ str = str.toLowerCase();
+ if (str.indexOf('apple') >= 0) { result = 'Apple'; }
+ if (str.indexOf('ipad') >= 0) { result = 'Apple'; }
+ if (str.indexOf('imac') >= 0) { result = 'Apple'; }
+ if (str.indexOf('iphone') >= 0) { result = 'Apple'; }
+ if (str.indexOf('magic mouse') >= 0) { result = 'Apple'; }
+ if (str.indexOf('macbook') >= 0) { result = 'Apple'; }
+ // to be continued ...
+
+ return result;
+}
+
+function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) {
+ const result = {};
+
+ result.device = null;
+ result.name = util.getValue(lines, 'name', '=');
+ result.manufacturer = null;
+ result.macDevice = macAddr1;
+ result.macHost = macAddr2;
+ result.batteryPercent = null;
+ result.type = parseBluetoothType(result.name.toLowerCase());
+ result.connected = false;
+
+ return result;
+}
+
+function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) {
+ const result = {};
+ const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || bluetoothObject.device_minorType || '') + (bluetoothObject.device_name || '')).toLowerCase();
+
+ result.device = bluetoothObject.device_services || '';
+ result.name = bluetoothObject.device_name || '';
+ result.manufacturer = bluetoothObject.device_manufacturer || parseBluetoothManufacturer(bluetoothObject.device_name || '') || '';
+ result.macDevice = (bluetoothObject.device_addr || bluetoothObject.device_address || '').toLowerCase().replace(/-/g, ':');
+ result.macHost = macAddr2;
+ result.batteryPercent = bluetoothObject.device_batteryPercent || null;
+ result.type = parseBluetoothType(typeStr);
+ result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false;
+
+ return result;
+}
+
+function parseWindowsBluetooth(lines) {
+ const result = {};
+
+ result.device = null;
+ result.name = util.getValue(lines, 'name', ':');
+ result.manufacturer = util.getValue(lines, 'manufacturer', ':');
+ result.macDevice = null;
+ result.macHost = null;
+ result.batteryPercent = null;
+ result.type = parseBluetoothType(result.name.toLowerCase());
+ result.connected = null;
+
+ return result;
+}
+
+function bluetoothDevices(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux) {
+ // get files in /var/lib/bluetooth/ recursive
+ const btFiles = util.getFilesInPath('/var/lib/bluetooth/');
+ btFiles.forEach((element) => {
+ const filename = path.basename(element);
+ const pathParts = element.split('/');
+ const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null;
+ const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null;
+ if (filename === 'info') {
+ const infoFile = fs.readFileSync(element, { encoding: 'utf8' }).split('\n');
+ result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2));
+ }
+ });
+ // determine "connected" with hcitool con
+ try {
+ const hdicon = execSync('hcitool con').toString().toLowerCase();
+ for (let i = 0; i < result.length; i++) {
+ if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
+ result[i].connected = true;
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ if (_darwin) {
+ let cmd = 'system_profiler SPBluetoothDataType -json';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ try {
+ const outObj = JSON.parse(stdout.toString());
+ if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) {
+ // missing: host BT Adapter macAddr ()
+ let macAddr2 = null;
+ if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) {
+ macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':');
+ }
+ outObj.SPBluetoothDataType[0]['device_title'].forEach((element) => {
+ const obj = element;
+ const objKey = Object.keys(obj);
+ if (objKey && objKey.length === 1) {
+ const innerObject = obj[objKey[0]];
+ innerObject.device_name = objKey[0];
+ const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
+ result.push(bluetoothDevice);
+ }
+ });
+ }
+ if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_connected'] && outObj.SPBluetoothDataType[0]['device_connected'].length) {
+ const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null;
+ outObj.SPBluetoothDataType[0]['device_connected'].forEach((element) => {
+ const obj = element;
+ const objKey = Object.keys(obj);
+ if (objKey && objKey.length === 1) {
+ const innerObject = obj[objKey[0]];
+ innerObject.device_name = objKey[0];
+ innerObject.device_isconnected = 'attrib_Yes';
+ const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
+ result.push(bluetoothDevice);
+ }
+ });
+ }
+ if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_not_connected'] && outObj.SPBluetoothDataType[0]['device_not_connected'].length) {
+ const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null;
+ outObj.SPBluetoothDataType[0]['device_not_connected'].forEach((element) => {
+ const obj = element;
+ const objKey = Object.keys(obj);
+ if (objKey && objKey.length === 1) {
+ const innerObject = obj[objKey[0]];
+ innerObject.device_name = objKey[0];
+ innerObject.device_isconnected = 'attrib_No';
+ const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2);
+ result.push(bluetoothDevice);
+ }
+ });
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => {
+ if (!error) {
+ const parts = stdout.toString().split(/\n\s*\n/);
+ parts.forEach((part) => {
+ if (util.getValue(part.split('\n'), 'PNPClass', ':') === 'Bluetooth') {
+ result.push(parseWindowsBluetooth(part.split('\n')));
+ }
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_freebsd || _netbsd || _openbsd || _sunos) {
+ resolve(null);
+ }
+ });
+ });
+}
+
+exports.bluetoothDevices = bluetoothDevices;
diff --git a/node_modules/systeminformation/lib/cli.js b/node_modules/systeminformation/lib/cli.js
new file mode 100755
index 0000000..2ee3346
--- /dev/null
+++ b/node_modules/systeminformation/lib/cli.js
@@ -0,0 +1,31 @@
+#!/usr/bin/env node
+
+'use strict';
+// @ts-check
+// ==================================================================================
+// cli.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+
+// ----------------------------------------------------------------------------------
+// Dependencies
+// ----------------------------------------------------------------------------------
+const si = require('./index');
+
+// ----------------------------------------------------------------------------------
+// Main
+// ----------------------------------------------------------------------------------
+(function () {
+ si.getStaticData().then(
+ ((data) => {
+ data.time = si.time();
+ console.log(JSON.stringify(data, null, 2));
+ }
+ ));
+})();
diff --git a/node_modules/systeminformation/lib/cpu.js b/node_modules/systeminformation/lib/cpu.js
new file mode 100644
index 0000000..dcd89c6
--- /dev/null
+++ b/node_modules/systeminformation/lib/cpu.js
@@ -0,0 +1,1704 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// cpu.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 4. CPU
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const fs = require('fs');
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+let _cpu_speed = 0;
+let _current_cpu = {
+ user: 0,
+ nice: 0,
+ system: 0,
+ idle: 0,
+ irq: 0,
+ load: 0,
+ tick: 0,
+ ms: 0,
+ currentLoad: 0,
+ currentLoadUser: 0,
+ currentLoadSystem: 0,
+ currentLoadNice: 0,
+ currentLoadIdle: 0,
+ currentLoadIrq: 0,
+ rawCurrentLoad: 0,
+ rawCurrentLoadUser: 0,
+ rawCurrentLoadSystem: 0,
+ rawCurrentLoadNice: 0,
+ rawCurrentLoadIdle: 0,
+ rawCurrentLoadIrq: 0
+};
+let _cpus = [];
+let _corecount = 0;
+
+const AMDBaseFrequencies = {
+ '8346': '1.8',
+ '8347': '1.9',
+ '8350': '2.0',
+ '8354': '2.2',
+ '8356|SE': '2.4',
+ '8356': '2.3',
+ '8360': '2.5',
+ '2372': '2.1',
+ '2373': '2.1',
+ '2374': '2.2',
+ '2376': '2.3',
+ '2377': '2.3',
+ '2378': '2.4',
+ '2379': '2.4',
+ '2380': '2.5',
+ '2381': '2.5',
+ '2382': '2.6',
+ '2384': '2.7',
+ '2386': '2.8',
+ '2387': '2.8',
+ '2389': '2.9',
+ '2393': '3.1',
+ '8374': '2.2',
+ '8376': '2.3',
+ '8378': '2.4',
+ '8379': '2.4',
+ '8380': '2.5',
+ '8381': '2.5',
+ '8382': '2.6',
+ '8384': '2.7',
+ '8386': '2.8',
+ '8387': '2.8',
+ '8389': '2.9',
+ '8393': '3.1',
+ '2419EE': '1.8',
+ '2423HE': '2.0',
+ '2425HE': '2.1',
+ '2427': '2.2',
+ '2431': '2.4',
+ '2435': '2.6',
+ '2439SE': '2.8',
+ '8425HE': '2.1',
+ '8431': '2.4',
+ '8435': '2.6',
+ '8439SE': '2.8',
+ '4122': '2.2',
+ '4130': '2.6',
+ '4162EE': '1.7',
+ '4164EE': '1.8',
+ '4170HE': '2.1',
+ '4174HE': '2.3',
+ '4176HE': '2.4',
+ '4180': '2.6',
+ '4184': '2.8',
+ '6124HE': '1.8',
+ '6128HE': '2.0',
+ '6132HE': '2.2',
+ '6128': '2.0',
+ '6134': '2.3',
+ '6136': '2.4',
+ '6140': '2.6',
+ '6164HE': '1.7',
+ '6166HE': '1.8',
+ '6168': '1.9',
+ '6172': '2.1',
+ '6174': '2.2',
+ '6176': '2.3',
+ '6176SE': '2.3',
+ '6180SE': '2.5',
+ '3250': '2.5',
+ '3260': '2.7',
+ '3280': '2.4',
+ '4226': '2.7',
+ '4228': '2.8',
+ '4230': '2.9',
+ '4234': '3.1',
+ '4238': '3.3',
+ '4240': '3.4',
+ '4256': '1.6',
+ '4274': '2.5',
+ '4276': '2.6',
+ '4280': '2.8',
+ '4284': '3.0',
+ '6204': '3.3',
+ '6212': '2.6',
+ '6220': '3.0',
+ '6234': '2.4',
+ '6238': '2.6',
+ '6262HE': '1.6',
+ '6272': '2.1',
+ '6274': '2.2',
+ '6276': '2.3',
+ '6278': '2.4',
+ '6282SE': '2.6',
+ '6284SE': '2.7',
+ '6308': '3.5',
+ '6320': '2.8',
+ '6328': '3.2',
+ '6338P': '2.3',
+ '6344': '2.6',
+ '6348': '2.8',
+ '6366': '1.8',
+ '6370P': '2.0',
+ '6376': '2.3',
+ '6378': '2.4',
+ '6380': '2.5',
+ '6386': '2.8',
+ 'FX|4100': '3.6',
+ 'FX|4120': '3.9',
+ 'FX|4130': '3.8',
+ 'FX|4150': '3.8',
+ 'FX|4170': '4.2',
+ 'FX|6100': '3.3',
+ 'FX|6120': '3.6',
+ 'FX|6130': '3.6',
+ 'FX|6200': '3.8',
+ 'FX|8100': '2.8',
+ 'FX|8120': '3.1',
+ 'FX|8140': '3.2',
+ 'FX|8150': '3.6',
+ 'FX|8170': '3.9',
+ 'FX|4300': '3.8',
+ 'FX|4320': '4.0',
+ 'FX|4350': '4.2',
+ 'FX|6300': '3.5',
+ 'FX|6350': '3.9',
+ 'FX|8300': '3.3',
+ 'FX|8310': '3.4',
+ 'FX|8320': '3.5',
+ 'FX|8350': '4.0',
+ 'FX|8370': '4.0',
+ 'FX|9370': '4.4',
+ 'FX|9590': '4.7',
+ 'FX|8320E': '3.2',
+ 'FX|8370E': '3.3',
+
+ // ZEN Desktop CPUs
+ '1200': '3.1',
+ 'Pro 1200': '3.1',
+ '1300X': '3.5',
+ 'Pro 1300': '3.5',
+ '1400': '3.2',
+ '1500X': '3.5',
+ 'Pro 1500': '3.5',
+ '1600': '3.2',
+ '1600X': '3.6',
+ 'Pro 1600': '3.2',
+ '1700': '3.0',
+ 'Pro 1700': '3.0',
+ '1700X': '3.4',
+ 'Pro 1700X': '3.4',
+ '1800X': '3.6',
+ '1900X': '3.8',
+ '1920': '3.2',
+ '1920X': '3.5',
+ '1950X': '3.4',
+
+ // ZEN Desktop APUs
+ '200GE': '3.2',
+ 'Pro 200GE': '3.2',
+ '220GE': '3.4',
+ '240GE': '3.5',
+ '3000G': '3.5',
+ '300GE': '3.4',
+ '3050GE': '3.4',
+ '2200G': '3.5',
+ 'Pro 2200G': '3.5',
+ '2200GE': '3.2',
+ 'Pro 2200GE': '3.2',
+ '2400G': '3.6',
+ 'Pro 2400G': '3.6',
+ '2400GE': '3.2',
+ 'Pro 2400GE': '3.2',
+
+ // ZEN Mobile APUs
+ 'Pro 200U': '2.3',
+ '300U': '2.4',
+ '2200U': '2.5',
+ '3200U': '2.6',
+ '2300U': '2.0',
+ 'Pro 2300U': '2.0',
+ '2500U': '2.0',
+ 'Pro 2500U': '2.2',
+ '2600H': '3.2',
+ '2700U': '2.0',
+ 'Pro 2700U': '2.2',
+ '2800H': '3.3',
+
+ // ZEN Server Processors
+ '7351': '2.4',
+ '7351P': '2.4',
+ '7401': '2.0',
+ '7401P': '2.0',
+ '7551P': '2.0',
+ '7551': '2.0',
+ '7251': '2.1',
+ '7261': '2.5',
+ '7281': '2.1',
+ '7301': '2.2',
+ '7371': '3.1',
+ '7451': '2.3',
+ '7501': '2.0',
+ '7571': '2.2',
+ '7601': '2.2',
+
+ // ZEN Embedded Processors
+ 'V1500B': '2.2',
+ 'V1780B': '3.35',
+ 'V1202B': '2.3',
+ 'V1404I': '2.0',
+ 'V1605B': '2.0',
+ 'V1756B': '3.25',
+ 'V1807B': '3.35',
+
+ '3101': '2.1',
+ '3151': '2.7',
+ '3201': '1.5',
+ '3251': '2.5',
+ '3255': '2.5',
+ '3301': '2.0',
+ '3351': '1.9',
+ '3401': '1.85',
+ '3451': '2.15',
+
+ // ZEN+ Desktop
+ '1200|AF': '3.1',
+ '2300X': '3.5',
+ '2500X': '3.6',
+ '2600': '3.4',
+ '2600E': '3.1',
+ '1600|AF': '3.2',
+ '2600X': '3.6',
+ '2700': '3.2',
+ '2700E': '2.8',
+ 'Pro 2700': '3.2',
+ '2700X': '3.7',
+ 'Pro 2700X': '3.6',
+ '2920X': '3.5',
+ '2950X': '3.5',
+ '2970WX': '3.0',
+ '2990WX': '3.0',
+
+ // ZEN+ Desktop APU
+ 'Pro 300GE': '3.4',
+ 'Pro 3125GE': '3.4',
+ '3150G': '3.5',
+ 'Pro 3150G': '3.5',
+ '3150GE': '3.3',
+ 'Pro 3150GE': '3.3',
+ '3200G': '3.6',
+ 'Pro 3200G': '3.6',
+ '3200GE': '3.3',
+ 'Pro 3200GE': '3.3',
+ '3350G': '3.6',
+ 'Pro 3350G': '3.6',
+ '3350GE': '3.3',
+ 'Pro 3350GE': '3.3',
+ '3400G': '3.7',
+ 'Pro 3400G': '3.7',
+ '3400GE': '3.3',
+ 'Pro 3400GE': '3.3',
+
+ // ZEN+ Mobile
+ '3300U': '2.1',
+ 'PRO 3300U': '2.1',
+ '3450U': '2.1',
+ '3500U': '2.1',
+ 'PRO 3500U': '2.1',
+ '3500C': '2.1',
+ '3550H': '2.1',
+ '3580U': '2.1',
+ '3700U': '2.3',
+ 'PRO 3700U': '2.3',
+ '3700C': '2.3',
+ '3750H': '2.3',
+ '3780U': '2.3',
+
+ // ZEN2 Desktop CPUS
+ '3100': '3.6',
+ '3300X': '3.8',
+ '3500': '3.6',
+ '3500X': '3.6',
+ '3600': '3.6',
+ 'Pro 3600': '3.6',
+ '3600X': '3.8',
+ '3600XT': '3.8',
+ 'Pro 3700': '3.6',
+ '3700X': '3.6',
+ '3800X': '3.9',
+ '3800XT': '3.9',
+ '3900': '3.1',
+ 'Pro 3900': '3.1',
+ '3900X': '3.8',
+ '3900XT': '3.8',
+ '3950X': '3.5',
+ '3960X': '3.8',
+ '3970X': '3.7',
+ '3990X': '2.9',
+ '3945WX': '4.0',
+ '3955WX': '3.9',
+ '3975WX': '3.5',
+ '3995WX': '2.7',
+
+ // ZEN2 Desktop APUs
+ '4300GE': '3.5',
+ 'Pro 4300GE': '3.5',
+ '4300G': '3.8',
+ 'Pro 4300G': '3.8',
+ '4600GE': '3.3',
+ 'Pro 4650GE': '3.3',
+ '4600G': '3.7',
+ 'Pro 4650G': '3.7',
+ '4700GE': '3.1',
+ 'Pro 4750GE': '3.1',
+ '4700G': '3.6',
+ 'Pro 4750G': '3.6',
+ '4300U': '2.7',
+ '4450U': '2.5',
+ 'Pro 4450U': '2.5',
+ '4500U': '2.3',
+ '4600U': '2.1',
+ 'PRO 4650U': '2.1',
+ '4680U': '2.1',
+ '4600HS': '3.0',
+ '4600H': '3.0',
+ '4700U': '2.0',
+ 'PRO 4750U': '1.7',
+ '4800U': '1.8',
+ '4800HS': '2.9',
+ '4800H': '2.9',
+ '4900HS': '3.0',
+ '4900H': '3.3',
+ '5300U': '2.6',
+ '5500U': '2.1',
+ '5700U': '1.8',
+
+ // ZEN2 - EPYC
+ '7232P': '3.1',
+ '7302P': '3.0',
+ '7402P': '2.8',
+ '7502P': '2.5',
+ '7702P': '2.0',
+ '7252': '3.1',
+ '7262': '3.2',
+ '7272': '2.9',
+ '7282': '2.8',
+ '7302': '3.0',
+ '7352': '2.3',
+ '7402': '2.8',
+ '7452': '2.35',
+ '7502': '2.5',
+ '7532': '2.4',
+ '7542': '2.9',
+ '7552': '2.2',
+ '7642': '2.3',
+ '7662': '2.0',
+ '7702': '2.0',
+ '7742': '2.25',
+ '7H12': '2.6',
+ '7F32': '3.7',
+ '7F52': '3.5',
+ '7F72': '3.2',
+
+ // Epyc (Milan)
+
+ '7763': '2.45',
+ '7713': '2.0',
+ '7713P': '2.0',
+ '7663': '2.0',
+ '7643': '2.3',
+ '75F3': '2.95',
+ '7543': '2.8',
+ '7543P': '2.8',
+ '7513': '2.6',
+ '7453': '2.75',
+ '74F3': '3.2',
+ '7443': '2.85',
+ '7443P': '2.85',
+ '7413': '2.65',
+ '73F3': '3.5',
+ '7343': '3.2',
+ '7313': '3.0',
+ '7313P': '3.0',
+ '72F3': '3.7',
+
+ // ZEN3
+ '5600X': '3.7',
+ '5800X': '3.8',
+ '5900X': '3.7',
+ '5950X': '3.4'
+};
+
+
+const socketTypes = {
+ 1: 'Other',
+ 2: 'Unknown',
+ 3: 'Daughter Board',
+ 4: 'ZIF Socket',
+ 5: 'Replacement/Piggy Back',
+ 6: 'None',
+ 7: 'LIF Socket',
+ 8: 'Slot 1',
+ 9: 'Slot 2',
+ 10: '370 Pin Socket',
+ 11: 'Slot A',
+ 12: 'Slot M',
+ 13: '423',
+ 14: 'A (Socket 462)',
+ 15: '478',
+ 16: '754',
+ 17: '940',
+ 18: '939',
+ 19: 'mPGA604',
+ 20: 'LGA771',
+ 21: 'LGA775',
+ 22: 'S1',
+ 23: 'AM2',
+ 24: 'F (1207)',
+ 25: 'LGA1366',
+ 26: 'G34',
+ 27: 'AM3',
+ 28: 'C32',
+ 29: 'LGA1156',
+ 30: 'LGA1567',
+ 31: 'PGA988A',
+ 32: 'BGA1288',
+ 33: 'rPGA988B',
+ 34: 'BGA1023',
+ 35: 'BGA1224',
+ 36: 'LGA1155',
+ 37: 'LGA1356',
+ 38: 'LGA2011',
+ 39: 'FS1',
+ 40: 'FS2',
+ 41: 'FM1',
+ 42: 'FM2',
+ 43: 'LGA2011-3',
+ 44: 'LGA1356-3',
+ 45: 'LGA1150',
+ 46: 'BGA1168',
+ 47: 'BGA1234',
+ 48: 'BGA1364',
+ 49: 'AM4',
+ 50: 'LGA1151',
+ 51: 'BGA1356',
+ 52: 'BGA1440',
+ 53: 'BGA1515',
+ 54: 'LGA3647-1',
+ 55: 'SP3',
+ 56: 'SP3r2',
+ 57: 'LGA2066',
+ 58: 'BGA1392',
+ 59: 'BGA1510',
+ 60: 'BGA1528',
+ 61: 'LGA4189',
+ 62: 'LGA1200',
+ 63: 'LGA4677',
+};
+
+const socketTypesByName = {
+ 'LGA1150': 'i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430',
+ 'LGA1151': 'i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400',
+ '1155': 'G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290'
+};
+
+function getSocketTypesByName(str) {
+ let result = '';
+ for (const key in socketTypesByName) {
+ const names = socketTypesByName[key].split(' ');
+ names.forEach(element => {
+ if (str.indexOf(element) >= 0) {
+ result = key;
+ }
+ });
+ }
+ return result;
+}
+
+function cpuManufacturer(str) {
+ let result = str;
+ str = str.toLowerCase();
+
+ if (str.indexOf('intel') >= 0) { result = 'Intel'; }
+ if (str.indexOf('amd') >= 0) { result = 'AMD'; }
+ if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
+ if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
+ if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
+ if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
+ if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
+ if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
+ if (str.indexOf('apple') >= 0) { result = 'Apple'; }
+
+ return result;
+}
+
+function cpuBrandManufacturer(res) {
+ res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
+ res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim();
+ res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
+ res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
+ res.manufacturer = cpuManufacturer(res.brand);
+
+ let parts = res.brand.split(' ');
+ parts.shift();
+ res.brand = parts.join(' ');
+ return res;
+}
+
+function getAMDSpeed(brand) {
+ let result = '0';
+ for (let key in AMDBaseFrequencies) {
+ if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) {
+ let parts = key.split('|');
+ let found = 0;
+ parts.forEach(item => {
+ if (brand.indexOf(item) > -1) {
+ found++;
+ }
+ });
+ if (found === parts.length) {
+ result = AMDBaseFrequencies[key];
+ }
+ }
+ }
+ return parseFloat(result);
+}
+
+// --------------------------
+// CPU - brand, speed
+
+function getCpu() {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ const UNKNOWN = 'unknown';
+ let result = {
+ manufacturer: UNKNOWN,
+ brand: UNKNOWN,
+ vendor: '',
+ family: '',
+ model: '',
+ stepping: '',
+ revision: '',
+ voltage: '',
+ speed: 0,
+ speedMin: 0,
+ speedMax: 0,
+ governor: '',
+ cores: util.cores(),
+ physicalCores: util.cores(),
+ performanceCores: util.cores(),
+ efficiencyCores: 0,
+ processors: 1,
+ socket: '',
+ flags: '',
+ virtualization: false,
+ cache: {}
+ };
+ cpuFlags().then(flags => {
+ result.flags = flags;
+ result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
+ if (_darwin) {
+ exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ const modelline = util.getValue(lines, 'machdep.cpu.brand_string');
+ const modellineParts = modelline.split('@');
+ result.brand = modellineParts[0].trim();
+ const speed = modellineParts[1] ? modellineParts[1].trim() : '0';
+ result.speed = parseFloat(speed.replace(/GHz+/g, ''));
+ let tbFrequency = util.getValue(lines, 'hw.tbfrequency') / 1000000000.0;
+ tbFrequency = tbFrequency < 0.1 ? tbFrequency * 100 : tbFrequency;
+ result.speed = result.speed === 0 ? tbFrequency : result.speed;
+
+ _cpu_speed = result.speed;
+ result = cpuBrandManufacturer(result);
+ result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0) : result.speed;
+ result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0) : result.speed;
+ result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple';
+ result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily');
+ result.model = util.getValue(lines, 'machdep.cpu.model');
+ result.stepping = util.getValue(lines, 'machdep.cpu.stepping') || util.getValue(lines, 'hw.cpusubfamily');
+ result.virtualization = true;
+ const countProcessors = util.getValue(lines, 'hw.packages');
+ const countCores = util.getValue(lines, 'hw.physicalcpu_max');
+ const countThreads = util.getValue(lines, 'hw.ncpu');
+ if (os.arch() === 'arm64') {
+ const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n');
+ const efficiencyCores = clusters.filter(line => line.indexOf('"E"') >= 0).length;
+ const performanceCores = clusters.filter(line => line.indexOf('"P"') >= 0).length;
+ result.socket = 'SOC';
+ result.efficiencyCores = efficiencyCores;
+ result.performanceCores = performanceCores;
+ }
+ if (countProcessors) {
+ result.processors = parseInt(countProcessors) || 1;
+ }
+ if (countCores && countThreads) {
+ result.cores = parseInt(countThreads) || util.cores();
+ result.physicalCores = parseInt(countCores) || util.cores();
+ }
+ cpuCache().then((res) => {
+ result.cache = res;
+ resolve(result);
+ });
+ });
+ }
+ if (_linux) {
+ let modelline = '';
+ let lines = [];
+ if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; }
+ exec('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL', function (error, stdout) {
+ if (!error) {
+ lines = stdout.toString().split('\n');
+ }
+ modelline = util.getValue(lines, 'model name') || modelline;
+ const modellineParts = modelline.split('@');
+ result.brand = modellineParts[0].trim();
+ result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0;
+ if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
+ result.speed = getAMDSpeed(result.brand);
+ }
+ if (result.speed === 0) {
+ const current = getCpuCurrentSpeedSync();
+ if (current.avg !== 0) { result.speed = current.avg; }
+ }
+ _cpu_speed = result.speed;
+ result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100;
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
+
+ result = cpuBrandManufacturer(result);
+ result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
+
+ result.family = util.getValue(lines, 'cpu family');
+ result.model = util.getValue(lines, 'model:');
+ result.stepping = util.getValue(lines, 'stepping');
+ result.revision = util.getValue(lines, 'cpu revision');
+ result.cache.l1d = util.getValue(lines, 'l1d cache');
+ if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1)); }
+ result.cache.l1i = util.getValue(lines, 'l1i cache');
+ if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1)); }
+ result.cache.l2 = util.getValue(lines, 'l2 cache');
+ if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1)); }
+ result.cache.l3 = util.getValue(lines, 'l3 cache');
+ if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); }
+
+ const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
+ const processors = util.getValue(lines, 'socket(s)') || '1';
+ let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
+ let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
+ const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
+ result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
+ result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
+ result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - (threadsPerCoreInt * result.performanceCores) : 0;
+ result.processors = processorsInt;
+ result.governor = util.getValue(lines, 'governor') || '';
+
+ // Test Raspberry
+ if (result.vendor === 'ARM') {
+ const linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
+ const rPIRevision = util.decodePiCpuinfo(linesRpi);
+ if (rPIRevision.model.toLowerCase().indexOf('raspberry') >= 0) {
+ result.family = result.manufacturer;
+ result.manufacturer = rPIRevision.manufacturer;
+ result.brand = rPIRevision.processor;
+ result.revision = rPIRevision.revisionCode;
+ result.socket = 'SOC';
+ }
+ }
+
+ // socket type
+ let lines2 = [];
+ exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', function (error2, stdout2) {
+ lines2 = stdout2.toString().split('\n');
+ if (lines2 && lines2.length) {
+ result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket;
+ }
+ resolve(result);
+ });
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ let modelline = '';
+ let lines = [];
+ if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; }
+ exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', function (error, stdout) {
+ let cache = [];
+ if (!error) {
+ const data = stdout.toString().split('# dmidecode');
+ const processor = data.length > 1 ? data[1] : '';
+ cache = data.length > 2 ? data[2].split('Cache Information') : [];
+
+ lines = processor.split('\n');
+ }
+ result.brand = modelline.split('@')[0].trim();
+ result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()) : 0;
+ if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
+ result.speed = getAMDSpeed(result.brand);
+ }
+ if (result.speed === 0) {
+ const current = getCpuCurrentSpeedSync();
+ if (current.avg !== 0) { result.speed = current.avg; }
+ }
+ _cpu_speed = result.speed;
+ result.speedMin = result.speed;
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
+
+ result = cpuBrandManufacturer(result);
+ result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
+ let sig = util.getValue(lines, 'signature');
+ sig = sig.split(',');
+ for (let i = 0; i < sig.length; i++) {
+ sig[i] = sig[i].trim();
+ }
+ result.family = util.getValue(sig, 'Family', ' ', true);
+ result.model = util.getValue(sig, 'Model', ' ', true);
+ result.stepping = util.getValue(sig, 'Stepping', ' ', true);
+ result.revision = '';
+ const voltage = parseFloat(util.getValue(lines, 'voltage'));
+ result.voltage = isNaN(voltage) ? '' : voltage.toFixed(2);
+ for (let i = 0; i < cache.length; i++) {
+ lines = cache[i].split('\n');
+ let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-');
+ cacheType = cacheType.length ? cacheType[0] : '';
+ const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
+ let size = parseInt(sizeParts[0], 10);
+ const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
+ size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1)));
+ if (cacheType) {
+ if (cacheType === 'l1') {
+ result.cache[cacheType + 'd'] = size / 2;
+ result.cache[cacheType + 'i'] = size / 2;
+ } else {
+ result.cache[cacheType] = size;
+ }
+ }
+ }
+ // socket type
+ result.socket = util.getValue(lines, 'Upgrade').replace('Socket', '').trim();
+ // # threads / # cores
+ const threadCount = util.getValue(lines, 'thread count').trim();
+ const coreCount = util.getValue(lines, 'core count').trim();
+ if (coreCount && threadCount) {
+ result.cores = parseInt(threadCount, 10);
+ result.physicalCores = parseInt(coreCount, 10);
+ }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
+ workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
+ workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
+
+ Promise.all(
+ workload
+ ).then((data) => {
+ let lines = data[0].split('\r\n');
+ let name = util.getValue(lines, 'name', ':') || '';
+ if (name.indexOf('@') >= 0) {
+ result.brand = name.split('@')[0].trim();
+ result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()) : 0;
+ _cpu_speed = result.speed;
+ } else {
+ result.brand = name.trim();
+ result.speed = 0;
+ }
+ result = cpuBrandManufacturer(result);
+ result.revision = util.getValue(lines, 'revision', ':');
+ result.cache.l1d = 0;
+ result.cache.l1i = 0;
+ result.cache.l2 = util.getValue(lines, 'l2cachesize', ':');
+ result.cache.l3 = util.getValue(lines, 'l3cachesize', ':');
+ if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2, 10) * 1024; }
+ if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3, 10) * 1024; }
+ result.vendor = util.getValue(lines, 'manufacturer', ':');
+ result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100;
+ if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) {
+ result.speed = getAMDSpeed(result.brand);
+ }
+ if (result.speed === 0) {
+ result.speed = result.speedMax;
+ }
+ result.speedMin = result.speed;
+
+ let description = util.getValue(lines, 'description', ':').split(' ');
+ for (let i = 0; i < description.length; i++) {
+ if (description[i].toLowerCase().startsWith('family') && (i + 1) < description.length && description[i + 1]) {
+ result.family = description[i + 1];
+ }
+ if (description[i].toLowerCase().startsWith('model') && (i + 1) < description.length && description[i + 1]) {
+ result.model = description[i + 1];
+ }
+ if (description[i].toLowerCase().startsWith('stepping') && (i + 1) < description.length && description[i + 1]) {
+ result.stepping = description[i + 1];
+ }
+ }
+ // socket type
+ const socketId = util.getValue(lines, 'UpgradeMethod', ':');
+ if (socketTypes[socketId]) {
+ result.socket = socketTypes[socketId];
+ }
+ const socketByName = getSocketTypesByName(name);
+ if (socketByName) {
+ result.socket = socketByName;
+ }
+ // # threads / # cores
+ const countProcessors = util.countLines(lines, 'Caption');
+ const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', ':');
+ const countCores = util.getValue(lines, 'NumberOfCores', ':');
+ if (countProcessors) {
+ result.processors = parseInt(countProcessors) || 1;
+ }
+ if (countCores && countThreads) {
+ result.cores = parseInt(countThreads) || util.cores();
+ result.physicalCores = parseInt(countCores) || util.cores();
+ }
+ if (countProcessors > 1) {
+ result.cores = result.cores * countProcessors;
+ result.physicalCores = result.physicalCores * countProcessors;
+ }
+ const parts = data[1].split(/\n\s*\n/);
+ parts.forEach(function (part) {
+ lines = part.split('\r\n');
+ const cacheType = util.getValue(lines, 'CacheType');
+ const level = util.getValue(lines, 'Level');
+ const installedSize = util.getValue(lines, 'InstalledSize');
+ // L1 Instructions
+ if (level === '3' && cacheType === '3') {
+ result.cache.l1i = parseInt(installedSize, 10);
+ }
+ // L1 Data
+ if (level === '3' && cacheType === '4') {
+ result.cache.l1d = parseInt(installedSize, 10);
+ }
+ // L1 all
+ if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
+ result.cache.l1i = parseInt(installedSize, 10) / 2;
+ result.cache.l1d = parseInt(installedSize, 10) / 2;
+ }
+ });
+ const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
+ result.virtualization = hyperv.indexOf('true') !== -1;
+
+ resolve(result);
+ });
+ } catch (e) {
+ resolve(result);
+ }
+ }
+ });
+ });
+ });
+}
+
+// --------------------------
+// CPU - Processor Data
+
+function cpu(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ getCpu().then(result => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ });
+}
+
+exports.cpu = cpu;
+
+// --------------------------
+// CPU - current speed - in GHz
+
+function getCpuCurrentSpeedSync() {
+
+ let cpus = os.cpus();
+ let minFreq = 999999999;
+ let maxFreq = 0;
+ let avgFreq = 0;
+ let cores = [];
+
+ if (cpus && cpus.length) {
+ for (let i in cpus) {
+ if ({}.hasOwnProperty.call(cpus, i)) {
+ let freq = cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10;
+ avgFreq = avgFreq + freq;
+ if (freq > maxFreq) { maxFreq = freq; }
+ if (freq < minFreq) { minFreq = freq; }
+ cores.push(parseFloat(freq.toFixed(2)));
+ }
+ }
+ avgFreq = avgFreq / cpus.length;
+ return {
+ min: parseFloat(minFreq.toFixed(2)),
+ max: parseFloat(maxFreq.toFixed(2)),
+ avg: parseFloat((avgFreq).toFixed(2)),
+ cores: cores
+ };
+ } else {
+ return {
+ min: 0,
+ max: 0,
+ avg: 0,
+ cores: cores
+ };
+ }
+}
+
+function cpuCurrentSpeed(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = getCpuCurrentSpeedSync();
+ if (result.avg === 0 && _cpu_speed !== 0) {
+ const currCpuSpeed = parseFloat(_cpu_speed);
+ result = {
+ min: currCpuSpeed,
+ max: currCpuSpeed,
+ avg: currCpuSpeed,
+ cores: []
+ };
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+}
+
+exports.cpuCurrentSpeed = cpuCurrentSpeed;
+
+// --------------------------
+// CPU - temperature
+// if sensors are installed
+
+function cpuTemperature(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+ main: null,
+ cores: [],
+ max: null,
+ socket: [],
+ chipset: null
+ };
+ if (_linux) {
+ // CPU Chipset, Socket
+ try {
+ const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;';
+ const parts = execSync(cmd).toString().split('-----\n');
+ if (parts.length === 2) {
+ const lines = parts[0].split('\n');
+ const lines2 = parts[1].split('\n');
+ for (let i = 0; i < lines.length; i++) {
+ const line = lines[i].trim();
+ if (line.startsWith('acpi') && lines2[i]) {
+ result.socket.push(Math.round(parseInt(lines2[i], 10) / 100) / 10);
+ }
+ if (line.startsWith('pch') && lines2[i]) {
+ result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10;
+ }
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+
+ const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
+ try {
+ exec(cmd, function (error, stdout) {
+ stdout = stdout.toString();
+ const tdiePos = stdout.toLowerCase().indexOf('tdie');
+ if (tdiePos !== -1) {
+ stdout = stdout.substring(tdiePos);
+ }
+ let lines = stdout.split('\n');
+ lines.forEach(line => {
+ const parts = line.split('___');
+ const label = parts[0];
+ const value = parts.length > 1 && parts[1] ? parts[1] : '0';
+ if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) {
+ result.cores.push(Math.round(parseInt(value, 10) / 100) / 10);
+ } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0)) {
+ result.main = Math.round(parseInt(value, 10) / 100) / 10;
+ }
+ });
+
+ if (result.cores.length > 0) {
+ if (result.main === null) {
+ result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
+ }
+ let maxtmp = Math.max.apply(Math, result.cores);
+ result.max = (maxtmp > result.main) ? maxtmp : result.main;
+ }
+ if (result.main !== null) {
+ if (result.max === null) {
+ result.max = result.main;
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ return;
+ }
+ exec('sensors', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ let tdieTemp = null;
+ let newSectionStarts = true;
+ let section = '';
+ lines.forEach(function (line) {
+ // determine section
+ if (line.trim() === '') {
+ newSectionStarts = true;
+ } else if (newSectionStarts) {
+ if (line.trim().toLowerCase().startsWith('acpi')) { section = 'acpi'; }
+ if (line.trim().toLowerCase().startsWith('pch')) { section = 'pch'; }
+ if (line.trim().toLowerCase().startsWith('core')) { section = 'core'; }
+ newSectionStarts = false;
+ }
+ let regex = /[+-]([^°]*)/g;
+ let temps = line.match(regex);
+ let firstPart = line.split(':')[0].toUpperCase();
+ if (section === 'acpi') {
+ // socket temp
+ if (firstPart.indexOf('TEMP') !== -1) {
+ result.socket.push(parseFloat(temps));
+ }
+ } else if (section === 'pch') {
+ // chipset temp
+ if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) {
+ result.chipset = parseFloat(temps);
+ }
+ }
+ // cpu temp
+ if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1) {
+ result.main = parseFloat(temps);
+ }
+ if (firstPart.indexOf('CORE ') !== -1) {
+ result.cores.push(parseFloat(temps));
+ }
+ if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null) {
+ tdieTemp = parseFloat(temps);
+ }
+ });
+ if (result.cores.length > 0) {
+ result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
+ let maxtmp = Math.max.apply(Math, result.cores);
+ result.max = (maxtmp > result.main) ? maxtmp : result.main;
+ } else {
+ if (result.main === null && tdieTemp !== null) {
+ result.main = tdieTemp;
+ result.max = tdieTemp;
+ }
+ }
+ if (result.main !== null || result.max !== null) {
+ if (callback) { callback(result); }
+ resolve(result);
+ return;
+ }
+ }
+ fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) {
+ if (err === null) {
+ fs.readFile('/sys/class/thermal/thermal_zone0/temp', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0) {
+ result.main = parseFloat(lines[0]) / 1000.0;
+ result.max = result.main;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ exec('/opt/vc/bin/vcgencmd measure_temp', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0 && lines[0].indexOf('=')) {
+ result.main = parseFloat(lines[0].split('=')[1]);
+ result.max = result.main;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ });
+ });
+ });
+ } catch (er) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('sysctl dev.cpu | grep temp', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ let sum = 0;
+ lines.forEach(function (line) {
+ const parts = line.split(':');
+ if (parts.length > 1) {
+ const temp = parseFloat(parts[1].replace(',', '.'));
+ if (temp > result.max) { result.max = temp; }
+ sum = sum + temp;
+ result.cores.push(temp);
+ }
+ });
+ if (result.cores.length) {
+ result.main = Math.round(sum / result.cores.length * 100) / 100;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ let osxTemp = null;
+ try {
+ osxTemp = require('osx-temperature-sensor');
+ } catch (er) {
+ osxTemp = null;
+ }
+ if (osxTemp) {
+ result = osxTemp.cpuTemperature();
+ // round to 2 digits
+ if (result.main) {
+ result.main = Math.round(result.main * 100) / 100;
+ }
+ if (result.max) {
+ result.max = Math.round(result.max * 100) / 100;
+ }
+ if (result.cores && result.cores.length) {
+ for (let i = 0; i < result.cores.length; i++) {
+ result.cores[i] = Math.round(result.cores[i] * 100) / 100;
+ }
+ }
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => {
+ if (!error) {
+ let sum = 0;
+ let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
+ lines.forEach(function (line) {
+ let value = (parseInt(line, 10) - 2732) / 10;
+ if (!isNaN(value)) {
+ sum = sum + value;
+ if (value > result.max) { result.max = value; }
+ result.cores.push(value);
+ }
+ });
+ if (result.cores.length) {
+ result.main = sum / result.cores.length;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.cpuTemperature = cpuTemperature;
+
+// --------------------------
+// CPU Flags
+
+function cpuFlags(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = '';
+ if (_windows) {
+ try {
+ exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin, function (error, stdout) {
+ if (!error) {
+ let flag_hex = stdout.split('0x').pop().trim();
+ let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2);
+ let flag_bin = '0'.repeat(32 - flag_bin_unpadded.length) + flag_bin_unpadded;
+ // empty flags are the reserved fields in the CPUID feature bit list
+ // as found on wikipedia:
+ // https://en.wikipedia.org/wiki/CPUID
+ let all_flags = [
+ 'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic',
+ '', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse-36', 'psn', 'clfsh',
+ '', 'ds', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'htt', 'tm', 'ia64', 'pbe'
+ ];
+ for (let f = 0; f < all_flags.length; f++) {
+ if (flag_bin[f] === '1' && all_flags[f] !== '') {
+ result += ' ' + all_flags[f];
+ }
+ }
+ result = result.trim().toLowerCase();
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_linux) {
+ try {
+
+ exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) {
+ result = line.split(':')[1].trim().toLowerCase();
+ }
+ });
+ }
+ if (!result) {
+ fs.readFile('/proc/cpuinfo', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result = util.getValue(lines, 'features', ':', true).toLowerCase();
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) {
+ let flags = [];
+ if (!error) {
+ let parts = stdout.toString().split('\tFlags:');
+ const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : [];
+ lines.forEach(function (line) {
+ let flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, '');
+ if (flag) {
+ flags.push(flag);
+ }
+ });
+ }
+ result = flags.join(' ').trim().toLowerCase();
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ exec('sysctl machdep.cpu.features', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) {
+ result = lines[0].split(':')[1].trim().toLowerCase();
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.cpuFlags = cpuFlags;
+
+// --------------------------
+// CPU Cache
+
+function cpuCache(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ l1d: null,
+ l1i: null,
+ l2: null,
+ l3: null,
+ };
+ if (_linux) {
+ try {
+ exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ let parts = line.split(':');
+ if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) {
+ result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
+ }
+ if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) {
+ result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
+ }
+ if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) {
+ result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
+ }
+ if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) {
+ result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1));
+ }
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
+ let cache = [];
+ if (!error) {
+ const data = stdout.toString();
+ cache = data.split('Cache Information');
+ cache.shift();
+ }
+ for (let i = 0; i < cache.length; i++) {
+ const lines = cache[i].split('\n');
+ let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-');
+ cacheType = cacheType.length ? cacheType[0] : '';
+ const sizeParts = util.getValue(lines, 'Installed Size').split(' ');
+ let size = parseInt(sizeParts[0], 10);
+ const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb';
+ size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1)));
+ if (cacheType) {
+ if (cacheType === 'l1') {
+ result.cache[cacheType + 'd'] = size / 2;
+ result.cache[cacheType + 'i'] = size / 2;
+ } else {
+ result.cache[cacheType] = size;
+ }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ let parts = line.split(':');
+ if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) {
+ result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
+ }
+ if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) {
+ result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
+ }
+ if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) {
+ result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
+ }
+ if (parts[0].toLowerCase().indexOf('hw.l3cachesize') !== -1) {
+ result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1);
+ }
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.split('\r\n');
+ result.l1d = 0;
+ result.l1i = 0;
+ result.l2 = util.getValue(lines, 'l2cachesize', ':');
+ result.l3 = util.getValue(lines, 'l3cachesize', ':');
+ if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
+ if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
+ }
+ util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl').then((stdout, error) => {
+ if (!error) {
+ const parts = stdout.split(/\n\s*\n/);
+ parts.forEach(function (part) {
+ const lines = part.split('\r\n');
+ const cacheType = util.getValue(lines, 'CacheType');
+ const level = util.getValue(lines, 'Level');
+ const installedSize = util.getValue(lines, 'InstalledSize');
+ // L1 Instructions
+ if (level === '3' && cacheType === '3') {
+ result.l1i = parseInt(installedSize, 10);
+ }
+ // L1 Data
+ if (level === '3' && cacheType === '4') {
+ result.l1d = parseInt(installedSize, 10);
+ }
+ // L1 all
+ if (level === '3' && cacheType === '5' && !result.l1i && !result.l1d) {
+ result.l1i = parseInt(installedSize, 10) / 2;
+ result.l1d = parseInt(installedSize, 10) / 2;
+ }
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.cpuCache = cpuCache;
+
+// --------------------------
+// CPU - current load - in %
+
+function getLoad() {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let loads = os.loadavg().map(function (x) { return x / util.cores(); });
+ let avgLoad = parseFloat((Math.max.apply(Math, loads)).toFixed(2));
+ let result = {};
+
+ let now = Date.now() - _current_cpu.ms;
+ if (now >= 200) {
+ _current_cpu.ms = Date.now();
+ const cpus = os.cpus();
+ let totalUser = 0;
+ let totalSystem = 0;
+ let totalNice = 0;
+ let totalIrq = 0;
+ let totalIdle = 0;
+ let cores = [];
+ _corecount = (cpus && cpus.length) ? cpus.length : 0;
+
+ for (let i = 0; i < _corecount; i++) {
+ const cpu = cpus[i].times;
+ totalUser += cpu.user;
+ totalSystem += cpu.sys;
+ totalNice += cpu.nice;
+ totalIdle += cpu.idle;
+ totalIrq += cpu.irq;
+ let tmpTick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0);
+ let tmpLoad = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0);
+ let tmpUser = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0);
+ let tmpSystem = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0);
+ let tmpNice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0);
+ let tmpIdle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0);
+ let tmpIrq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0);
+ _cpus[i] = cpu;
+ _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].idle;
+ _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq;
+ _cpus[i].currentTick = _cpus[i].totalTick - tmpTick;
+ _cpus[i].load = (_cpus[i].totalLoad - tmpLoad);
+ _cpus[i].loadUser = (_cpus[i].user - tmpUser);
+ _cpus[i].loadSystem = (_cpus[i].sys - tmpSystem);
+ _cpus[i].loadNice = (_cpus[i].nice - tmpNice);
+ _cpus[i].loadIdle = (_cpus[i].idle - tmpIdle);
+ _cpus[i].loadIrq = (_cpus[i].irq - tmpIrq);
+ cores[i] = {};
+ cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
+ cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100;
+ cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100;
+ cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100;
+ cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100;
+ cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100;
+ cores[i].rawLoad = _cpus[i].load;
+ cores[i].rawLoadUser = _cpus[i].loadUser;
+ cores[i].rawLoadSystem = _cpus[i].loadSystem;
+ cores[i].rawLoadNice = _cpus[i].loadNice;
+ cores[i].rawLoadIdle = _cpus[i].loadIdle;
+ cores[i].rawLoadIrq = _cpus[i].loadIrq;
+ }
+ let totalTick = totalUser + totalSystem + totalNice + totalIrq + totalIdle;
+ let totalLoad = totalUser + totalSystem + totalNice + totalIrq;
+ let currentTick = totalTick - _current_cpu.tick;
+ result = {
+ avgLoad: avgLoad,
+ currentLoad: (totalLoad - _current_cpu.load) / currentTick * 100,
+ currentLoadUser: (totalUser - _current_cpu.user) / currentTick * 100,
+ currentLoadSystem: (totalSystem - _current_cpu.system) / currentTick * 100,
+ currentLoadNice: (totalNice - _current_cpu.nice) / currentTick * 100,
+ currentLoadIdle: (totalIdle - _current_cpu.idle) / currentTick * 100,
+ currentLoadIrq: (totalIrq - _current_cpu.irq) / currentTick * 100,
+ rawCurrentLoad: (totalLoad - _current_cpu.load),
+ rawCurrentLoadUser: (totalUser - _current_cpu.user),
+ rawCurrentLoadSystem: (totalSystem - _current_cpu.system),
+ rawCurrentLoadNice: (totalNice - _current_cpu.nice),
+ rawCurrentLoadIdle: (totalIdle - _current_cpu.idle),
+ rawCurrentLoadIrq: (totalIrq - _current_cpu.irq),
+ cpus: cores
+ };
+ _current_cpu = {
+ user: totalUser,
+ nice: totalNice,
+ system: totalSystem,
+ idle: totalIdle,
+ irq: totalIrq,
+ tick: totalTick,
+ load: totalLoad,
+ ms: _current_cpu.ms,
+ currentLoad: result.currentLoad,
+ currentLoadUser: result.currentLoadUser,
+ currentLoadSystem: result.currentLoadSystem,
+ currentLoadNice: result.currentLoadNice,
+ currentLoadIdle: result.currentLoadIdle,
+ currentLoadIrq: result.currentLoadIrq,
+ rawCurrentLoad: result.rawCurrentLoad,
+ rawCurrentLoadUser: result.rawCurrentLoadUser,
+ rawCurrentLoadSystem: result.rawCurrentLoadSystem,
+ rawCurrentLoadNice: result.rawCurrentLoadNice,
+ rawCurrentLoadIdle: result.rawCurrentLoadIdle,
+ rawCurrentLoadIrq: result.rawCurrentLoadIrq,
+ };
+ } else {
+ let cores = [];
+ for (let i = 0; i < _corecount; i++) {
+ cores[i] = {};
+ cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
+ cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100;
+ cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100;
+ cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100;
+ cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100;
+ cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100;
+ cores[i].rawLoad = _cpus[i].load;
+ cores[i].rawLoadUser = _cpus[i].loadUser;
+ cores[i].rawLoadSystem = _cpus[i].loadSystem;
+ cores[i].rawLoadNice = _cpus[i].loadNice;
+ cores[i].rawLoadIdle = _cpus[i].loadIdle;
+ cores[i].rawLoadIrq = _cpus[i].loadIrq;
+ }
+ result = {
+ avgLoad: avgLoad,
+ currentLoad: _current_cpu.currentLoad,
+ currentLoadUser: _current_cpu.currentLoadUser,
+ currentLoadSystem: _current_cpu.currentLoadSystem,
+ currentLoadNice: _current_cpu.currentLoadNice,
+ currentLoadIdle: _current_cpu.currentLoadIdle,
+ currentLoadIrq: _current_cpu.currentLoadIrq,
+ rawCurrentLoad: _current_cpu.rawCurrentLoad,
+ rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser,
+ rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem,
+ rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice,
+ rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle,
+ rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq,
+ cpus: cores
+ };
+ }
+ resolve(result);
+ });
+ });
+}
+
+function currentLoad(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ getLoad().then(result => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ });
+}
+
+exports.currentLoad = currentLoad;
+
+// --------------------------
+// PS - full load
+// since bootup
+
+function getFullLoad() {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ const cpus = os.cpus();
+ let totalUser = 0;
+ let totalSystem = 0;
+ let totalNice = 0;
+ let totalIrq = 0;
+ let totalIdle = 0;
+
+ let result = 0;
+
+ if (cpus && cpus.length) {
+ for (let i = 0, len = cpus.length; i < len; i++) {
+ const cpu = cpus[i].times;
+ totalUser += cpu.user;
+ totalSystem += cpu.sys;
+ totalNice += cpu.nice;
+ totalIrq += cpu.irq;
+ totalIdle += cpu.idle;
+ }
+ let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
+ result = (totalTicks - totalIdle) / totalTicks * 100.0;
+
+ }
+ resolve(result);
+ });
+ });
+}
+
+function fullLoad(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ getFullLoad().then(result => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ });
+}
+
+exports.fullLoad = fullLoad;
diff --git a/node_modules/systeminformation/lib/docker.js b/node_modules/systeminformation/lib/docker.js
new file mode 100644
index 0000000..805ee9f
--- /dev/null
+++ b/node_modules/systeminformation/lib/docker.js
@@ -0,0 +1,757 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// docker.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 13. Docker
+// ----------------------------------------------------------------------------------
+
+const util = require('./util');
+const DockerSocket = require('./dockerSocket');
+
+let _platform = process.platform;
+const _windows = (_platform === 'win32');
+
+let _docker_container_stats = {};
+let _docker_socket;
+let _docker_last_read = 0;
+
+
+// --------------------------
+// get containers (parameter all: get also inactive/exited containers)
+
+function dockerInfo(callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+ const result = {};
+
+ _docker_socket.getInfo((data) => {
+ result.id = data.ID;
+ result.containers = data.Containers;
+ result.containersRunning = data.ContainersRunning;
+ result.containersPaused = data.ContainersPaused;
+ result.containersStopped = data.ContainersStopped;
+ result.images = data.Images;
+ result.driver = data.Driver;
+ result.memoryLimit = data.MemoryLimit;
+ result.swapLimit = data.SwapLimit;
+ result.kernelMemory = data.KernelMemory;
+ result.cpuCfsPeriod = data.CpuCfsPeriod;
+ result.cpuCfsQuota = data.CpuCfsQuota;
+ result.cpuShares = data.CPUShares;
+ result.cpuSet = data.CPUSet;
+ result.ipv4Forwarding = data.IPv4Forwarding;
+ result.bridgeNfIptables = data.BridgeNfIptables;
+ result.bridgeNfIp6tables = data.BridgeNfIp6tables;
+ result.debug = data.Debug;
+ result.nfd = data.NFd;
+ result.oomKillDisable = data.OomKillDisable;
+ result.ngoroutines = data.NGoroutines;
+ result.systemTime = data.SystemTime;
+ result.loggingDriver = data.LoggingDriver;
+ result.cgroupDriver = data.CgroupDriver;
+ result.nEventsListener = data.NEventsListener;
+ result.kernelVersion = data.KernelVersion;
+ result.operatingSystem = data.OperatingSystem;
+ result.osType = data.OSType;
+ result.architecture = data.Architecture;
+ result.ncpu = data.NCPU;
+ result.memTotal = data.MemTotal;
+ result.dockerRootDir = data.DockerRootDir;
+ result.httpProxy = data.HttpProxy;
+ result.httpsProxy = data.HttpsProxy;
+ result.noProxy = data.NoProxy;
+ result.name = data.Name;
+ result.labels = data.Labels;
+ result.experimentalBuild = data.ExperimentalBuild;
+ result.serverVersion = data.ServerVersion;
+ result.clusterStore = data.ClusterStore;
+ result.clusterAdvertise = data.ClusterAdvertise;
+ result.defaultRuntime = data.DefaultRuntime;
+ result.liveRestoreEnabled = data.LiveRestoreEnabled;
+ result.isolation = data.Isolation;
+ result.initBinary = data.InitBinary;
+ result.productLicense = data.ProductLicense;
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ });
+}
+
+exports.dockerInfo = dockerInfo;
+
+function dockerImages(all, callback) {
+
+ // fallback - if only callback is given
+ if (util.isFunction(all) && !callback) {
+ callback = all;
+ all = false;
+ }
+ if (typeof all === 'string' && all === 'true') {
+ all = true;
+ }
+ if (typeof all !== 'boolean' && all !== undefined) {
+ all = false;
+ }
+
+ all = all || false;
+ let result = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+ const workload = [];
+
+ _docker_socket.listImages(all, data => {
+ let dockerImages = {};
+ try {
+ dockerImages = data;
+ if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) {
+
+ dockerImages.forEach(function (element) {
+
+ if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
+ element.Name = element.Names[0].replace(/^\/|\/$/g, '');
+ }
+ workload.push(dockerImagesInspect(element.Id.trim(), element));
+ });
+ if (workload.length) {
+ Promise.all(
+ workload
+ ).then((data) => {
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } catch (err) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+ });
+}
+
+// --------------------------
+// container inspect (for one container)
+
+function dockerImagesInspect(imageID, payload) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ imageID = imageID || '';
+ if (typeof imageID !== 'string') {
+ return resolve();
+ }
+ const imageIDSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(imageID, true)).trim();
+ if (imageIDSanitized) {
+
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+
+ _docker_socket.inspectImage(imageIDSanitized.trim(), data => {
+ try {
+ resolve({
+ id: payload.Id,
+ container: data.Container,
+ comment: data.Comment,
+ os: data.Os,
+ architecture: data.Architecture,
+ parent: data.Parent,
+ dockerVersion: data.DockerVersion,
+ size: data.Size,
+ sharedSize: payload.SharedSize,
+ virtualSize: data.VirtualSize,
+ author: data.Author,
+ created: data.Created ? Math.round(new Date(data.Created).getTime() / 1000) : 0,
+ containerConfig: data.ContainerConfig ? data.ContainerConfig : {},
+ graphDriver: data.GraphDriver ? data.GraphDriver : {},
+ repoDigests: data.RepoDigests ? data.RepoDigests : {},
+ repoTags: data.RepoTags ? data.RepoTags : {},
+ config: data.Config ? data.Config : {},
+ rootFS: data.RootFS ? data.RootFS : {},
+ });
+ } catch (err) {
+ resolve();
+ }
+ });
+ } else {
+ resolve();
+ }
+ });
+ });
+}
+
+exports.dockerImages = dockerImages;
+
+function dockerContainers(all, callback) {
+
+ function inContainers(containers, id) {
+ let filtered = containers.filter(obj => {
+ /**
+ * @namespace
+ * @property {string} Id
+ */
+ return (obj.Id && (obj.Id === id));
+ });
+ return (filtered.length > 0);
+ }
+
+ // fallback - if only callback is given
+ if (util.isFunction(all) && !callback) {
+ callback = all;
+ all = false;
+ }
+ if (typeof all === 'string' && all === 'true') {
+ all = true;
+ }
+ if (typeof all !== 'boolean' && all !== undefined) {
+ all = false;
+ }
+
+ all = all || false;
+ let result = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+ const workload = [];
+
+ _docker_socket.listContainers(all, data => {
+ let docker_containers = {};
+ try {
+ docker_containers = data;
+ if (docker_containers && Object.prototype.toString.call(docker_containers) === '[object Array]' && docker_containers.length > 0) {
+ // GC in _docker_container_stats
+ for (let key in _docker_container_stats) {
+ if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
+ if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; }
+ }
+ }
+
+ docker_containers.forEach(function (element) {
+
+ if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
+ element.Name = element.Names[0].replace(/^\/|\/$/g, '');
+ }
+ workload.push(dockerContainerInspect(element.Id.trim(), element));
+ });
+ if (workload.length) {
+ Promise.all(
+ workload
+ ).then((data) => {
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } catch (err) {
+ // GC in _docker_container_stats
+ for (let key in _docker_container_stats) {
+ if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
+ if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+ });
+}
+
+// --------------------------
+// container inspect (for one container)
+
+function dockerContainerInspect(containerID, payload) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ containerID = containerID || '';
+ if (typeof containerID !== 'string') {
+ return resolve();
+ }
+ const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim();
+ if (containerIdSanitized) {
+
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+
+ _docker_socket.getInspect(containerIdSanitized.trim(), data => {
+ try {
+ resolve({
+ id: payload.Id,
+ name: payload.Name,
+ image: payload.Image,
+ imageID: payload.ImageID,
+ command: payload.Command,
+ created: payload.Created,
+ started: data.State && data.State.StartedAt ? Math.round(new Date(data.State.StartedAt).getTime() / 1000) : 0,
+ finished: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? Math.round(new Date(data.State.FinishedAt).getTime() / 1000) : 0,
+ createdAt: data.Created ? data.Created : '',
+ startedAt: data.State && data.State.StartedAt ? data.State.StartedAt : '',
+ finishedAt: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? data.State.FinishedAt : '',
+ state: payload.State,
+ restartCount: data.RestartCount || 0,
+ platform: data.Platform || '',
+ driver: data.Driver || '',
+ ports: payload.Ports,
+ mounts: payload.Mounts,
+ // hostconfig: payload.HostConfig,
+ // network: payload.NetworkSettings
+ });
+ } catch (err) {
+ resolve();
+ }
+ });
+ } else {
+ resolve();
+ }
+ });
+ });
+}
+
+exports.dockerContainers = dockerContainers;
+
+// --------------------------
+// helper functions for calculation of docker stats
+
+function docker_calcCPUPercent(cpu_stats, precpu_stats) {
+ /**
+ * @namespace
+ * @property {object} cpu_usage
+ * @property {number} cpu_usage.total_usage
+ * @property {number} system_cpu_usage
+ * @property {object} cpu_usage
+ * @property {Array} cpu_usage.percpu_usage
+ */
+
+ if (!_windows) {
+ let cpuPercent = 0.0;
+ // calculate the change for the cpu usage of the container in between readings
+ let cpuDelta = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage;
+ // calculate the change for the entire system between readings
+ let systemDelta = cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage;
+
+ if (systemDelta > 0.0 && cpuDelta > 0.0) {
+ // calculate the change for the cpu usage of the container in between readings
+ if (precpu_stats.online_cpus) {
+ cpuPercent = (cpuDelta / systemDelta) * precpu_stats.online_cpus * 100.0;
+ }
+ else {
+ cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0;
+ }
+ }
+
+ return cpuPercent;
+ } else {
+ let nanoSecNow = util.nanoSeconds();
+ let cpuPercent = 0.0;
+ if (_docker_last_read > 0) {
+ let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length;
+ let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage;
+ if (possIntervals > 0) {
+ cpuPercent = 100.0 * intervalsUsed / possIntervals;
+ }
+ }
+ _docker_last_read = nanoSecNow;
+ return cpuPercent;
+ }
+}
+
+function docker_calcNetworkIO(networks) {
+ let rx;
+ let wx;
+ for (let key in networks) {
+ // skip loop if the property is from prototype
+ if (!{}.hasOwnProperty.call(networks, key)) { continue; }
+
+ /**
+ * @namespace
+ * @property {number} rx_bytes
+ * @property {number} tx_bytes
+ */
+ let obj = networks[key];
+ rx = +obj.rx_bytes;
+ wx = +obj.tx_bytes;
+ }
+ return {
+ rx,
+ wx
+ };
+}
+
+function docker_calcBlockIO(blkio_stats) {
+ let result = {
+ r: 0,
+ w: 0
+ };
+
+ /**
+ * @namespace
+ * @property {Array} io_service_bytes_recursive
+ */
+ if (blkio_stats && blkio_stats.io_service_bytes_recursive && Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' && blkio_stats.io_service_bytes_recursive.length > 0) {
+ blkio_stats.io_service_bytes_recursive.forEach(function (element) {
+ /**
+ * @namespace
+ * @property {string} op
+ * @property {number} value
+ */
+
+ if (element.op && element.op.toLowerCase() === 'read' && element.value) {
+ result.r += element.value;
+ }
+ if (element.op && element.op.toLowerCase() === 'write' && element.value) {
+ result.w += element.value;
+ }
+ });
+ }
+ return result;
+}
+
+function dockerContainerStats(containerIDs, callback) {
+
+ let containerArray = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ // fallback - if only callback is given
+ if (util.isFunction(containerIDs) && !callback) {
+ callback = containerIDs;
+ containerArray = ['*'];
+ } else {
+ containerIDs = containerIDs || '*';
+ if (typeof containerIDs !== 'string') {
+ if (callback) { callback([]); }
+ return resolve([]);
+ }
+ let containerIDsSanitized = '';
+ containerIDsSanitized.__proto__.toLowerCase = util.stringToLower;
+ containerIDsSanitized.__proto__.replace = util.stringReplace;
+ containerIDsSanitized.__proto__.trim = util.stringTrim;
+
+ containerIDsSanitized = containerIDs;
+ containerIDsSanitized = containerIDsSanitized.trim();
+ if (containerIDsSanitized !== '*') {
+ containerIDsSanitized = '';
+ const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ s[i].__proto__.toLowerCase = util.stringToLower;
+ const sl = s[i].toLowerCase();
+ if (sl && sl[0] && !sl[1]) {
+ containerIDsSanitized = containerIDsSanitized + sl[0];
+ }
+ }
+ }
+ }
+
+ containerIDsSanitized = containerIDsSanitized.trim().toLowerCase().replace(/,+/g, '|');
+ containerArray = containerIDsSanitized.split('|');
+ }
+
+ const result = [];
+
+ const workload = [];
+ if (containerArray.length && containerArray[0].trim() === '*') {
+ containerArray = [];
+ dockerContainers().then(allContainers => {
+ for (let container of allContainers) {
+ containerArray.push(container.id);
+ }
+ if (containerArray.length) {
+ dockerContainerStats(containerArray.join(',')).then(result => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } else {
+ for (let containerID of containerArray) {
+ workload.push(dockerContainerStatsSingle(containerID.trim()));
+ }
+ if (workload.length) {
+ Promise.all(
+ workload
+ ).then((data) => {
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+// --------------------------
+// container stats (for one container)
+
+function dockerContainerStatsSingle(containerID) {
+ containerID = containerID || '';
+ let result = {
+ id: containerID,
+ memUsage: 0,
+ memLimit: 0,
+ memPercent: 0,
+ cpuPercent: 0,
+ pids: 0,
+ netIO: {
+ rx: 0,
+ wx: 0
+ },
+ blockIO: {
+ r: 0,
+ w: 0
+ },
+ restartCount: 0,
+ cpuStats: {},
+ precpuStats: {},
+ memoryStats: {},
+ networks: {},
+ };
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (containerID) {
+
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+
+ _docker_socket.getInspect(containerID, dataInspect => {
+ try {
+ _docker_socket.getStats(containerID, data => {
+ try {
+ let stats = data;
+
+ if (!stats.message) {
+ result.memUsage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0);
+ result.memLimit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0);
+ result.memPercent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0);
+ result.cpuPercent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0);
+ result.pids = (stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0);
+ result.restartCount = (dataInspect.RestartCount ? dataInspect.RestartCount : 0);
+ if (stats.networks) { result.netIO = docker_calcNetworkIO(stats.networks); }
+ if (stats.blkio_stats) { result.blockIO = docker_calcBlockIO(stats.blkio_stats); }
+ result.cpuStats = (stats.cpu_stats ? stats.cpu_stats : {});
+ result.precpuStats = (stats.precpu_stats ? stats.precpu_stats : {});
+ result.memoryStats = (stats.memory_stats ? stats.memory_stats : {});
+ result.networks = (stats.networks ? stats.networks : {});
+ }
+ } catch (err) {
+ util.noop();
+ }
+ // }
+ resolve(result);
+ });
+ } catch (err) {
+ util.noop();
+ }
+ });
+ } else {
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.dockerContainerStats = dockerContainerStats;
+
+// --------------------------
+// container processes (for one container)
+
+function dockerContainerProcesses(containerID, callback) {
+ let result = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ containerID = containerID || '';
+ if (typeof containerID !== 'string') {
+ return resolve(result);
+ }
+ const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim();
+
+ if (containerIdSanitized) {
+
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+
+ _docker_socket.getProcesses(containerIdSanitized, data => {
+ /**
+ * @namespace
+ * @property {Array} Titles
+ * @property {Array} Processes
+ **/
+ try {
+ if (data && data.Titles && data.Processes) {
+ let titles = data.Titles.map(function (value) {
+ return value.toUpperCase();
+ });
+ let pos_pid = titles.indexOf('PID');
+ let pos_ppid = titles.indexOf('PPID');
+ let pos_pgid = titles.indexOf('PGID');
+ let pos_vsz = titles.indexOf('VSZ');
+ let pos_time = titles.indexOf('TIME');
+ let pos_elapsed = titles.indexOf('ELAPSED');
+ let pos_ni = titles.indexOf('NI');
+ let pos_ruser = titles.indexOf('RUSER');
+ let pos_user = titles.indexOf('USER');
+ let pos_rgroup = titles.indexOf('RGROUP');
+ let pos_group = titles.indexOf('GROUP');
+ let pos_stat = titles.indexOf('STAT');
+ let pos_rss = titles.indexOf('RSS');
+ let pos_command = titles.indexOf('COMMAND');
+
+ data.Processes.forEach(process => {
+ result.push({
+ pidHost: (pos_pid >= 0 ? process[pos_pid] : ''),
+ ppid: (pos_ppid >= 0 ? process[pos_ppid] : ''),
+ pgid: (pos_pgid >= 0 ? process[pos_pgid] : ''),
+ user: (pos_user >= 0 ? process[pos_user] : ''),
+ ruser: (pos_ruser >= 0 ? process[pos_ruser] : ''),
+ group: (pos_group >= 0 ? process[pos_group] : ''),
+ rgroup: (pos_rgroup >= 0 ? process[pos_rgroup] : ''),
+ stat: (pos_stat >= 0 ? process[pos_stat] : ''),
+ time: (pos_time >= 0 ? process[pos_time] : ''),
+ elapsed: (pos_elapsed >= 0 ? process[pos_elapsed] : ''),
+ nice: (pos_ni >= 0 ? process[pos_ni] : ''),
+ rss: (pos_rss >= 0 ? process[pos_rss] : ''),
+ vsz: (pos_vsz >= 0 ? process[pos_vsz] : ''),
+ command: (pos_command >= 0 ? process[pos_command] : '')
+ });
+ });
+ }
+ } catch (err) {
+ util.noop();
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.dockerContainerProcesses = dockerContainerProcesses;
+
+function dockerVolumes(callback) {
+
+ let result = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (!_docker_socket) {
+ _docker_socket = new DockerSocket();
+ }
+ _docker_socket.listVolumes((data) => {
+ let dockerVolumes = {};
+ try {
+ dockerVolumes = data;
+ if (dockerVolumes && dockerVolumes.Volumes && Object.prototype.toString.call(dockerVolumes.Volumes) === '[object Array]' && dockerVolumes.Volumes.length > 0) {
+
+ dockerVolumes.Volumes.forEach(function (element) {
+
+ result.push({
+ name: element.Name,
+ driver: element.Driver,
+ labels: element.Labels,
+ mountpoint: element.Mountpoint,
+ options: element.Options,
+ scope: element.Scope,
+ created: element.CreatedAt ? Math.round(new Date(element.CreatedAt).getTime() / 1000) : 0,
+ });
+ });
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } catch (err) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+ });
+}
+
+exports.dockerVolumes = dockerVolumes;
+
+function dockerAll(callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ dockerContainers(true).then(result => {
+ if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {
+ let l = result.length;
+ result.forEach(function (element) {
+ dockerContainerStats(element.id).then((res) => {
+ // include stats in array
+ element.memUsage = res[0].memUsage;
+ element.memLimit = res[0].memLimit;
+ element.memPercent = res[0].memPercent;
+ element.cpuPercent = res[0].cpuPercent;
+ element.pids = res[0].pids;
+ element.netIO = res[0].netIO;
+ element.blockIO = res[0].blockIO;
+ element.cpuStats = res[0].cpuStats;
+ element.precpuStats = res[0].precpuStats;
+ element.memoryStats = res[0].memoryStats;
+ element.networks = res[0].networks;
+
+ dockerContainerProcesses(element.id).then(processes => {
+ element.processes = processes;
+
+ l -= 1;
+ if (l === 0) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ // all done??
+ });
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+ });
+}
+
+exports.dockerAll = dockerAll;
diff --git a/node_modules/systeminformation/lib/dockerSocket.js b/node_modules/systeminformation/lib/dockerSocket.js
new file mode 100644
index 0000000..af1bfec
--- /dev/null
+++ b/node_modules/systeminformation/lib/dockerSocket.js
@@ -0,0 +1,327 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// dockerSockets.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 13. DockerSockets
+// ----------------------------------------------------------------------------------
+
+const net = require('net');
+const isWin = require('os').type() === 'Windows_NT';
+const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';
+
+class DockerSocket {
+
+ getInfo(callback) {
+ try {
+
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/info HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ }
+
+ listImages(all, callback) {
+ try {
+
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ }
+
+ inspectImage(id, callback) {
+ id = id || '';
+ if (id) {
+ try {
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ } else {
+ callback({});
+ }
+ }
+
+ listContainers(all, callback) {
+ try {
+
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/containers/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ }
+
+ getStats(id, callback) {
+ id = id || '';
+ if (id) {
+ try {
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/containers/' + id + '/stats?stream=0 HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ } else {
+ callback({});
+ }
+ }
+
+ getInspect(id, callback) {
+ id = id || '';
+ if (id) {
+ try {
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/containers/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ } else {
+ callback({});
+ }
+ }
+
+ getProcesses(id, callback) {
+ id = id || '';
+ if (id) {
+ try {
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/containers/' + id + '/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ } else {
+ callback({});
+ }
+ }
+
+ listVolumes(callback) {
+ try {
+
+ let socket = net.createConnection({ path: socketPath });
+ let alldata = '';
+ let data;
+
+ socket.on('connect', () => {
+ socket.write('GET http:/volumes HTTP/1.0\r\n\r\n');
+ });
+
+ socket.on('data', data => {
+ alldata = alldata + data.toString();
+ });
+
+ socket.on('error', () => {
+ socket = false;
+ callback({});
+ });
+
+ socket.on('end', () => {
+ let startbody = alldata.indexOf('\r\n\r\n');
+ alldata = alldata.substring(startbody + 4);
+ socket = false;
+ try {
+ data = JSON.parse(alldata);
+ callback(data);
+ } catch (err) {
+ callback({});
+ }
+ });
+ } catch (err) {
+ callback({});
+ }
+ }
+}
+
+module.exports = DockerSocket;
diff --git a/node_modules/systeminformation/lib/filesystem.js b/node_modules/systeminformation/lib/filesystem.js
new file mode 100644
index 0000000..7aaaf1d
--- /dev/null
+++ b/node_modules/systeminformation/lib/filesystem.js
@@ -0,0 +1,1495 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// filesystem.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 8. File System
+// ----------------------------------------------------------------------------------
+
+const util = require('./util');
+const fs = require('fs');
+
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const execPromiseSave = util.promisifySave(require('child_process').exec);
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+let _fs_speed = {};
+let _disk_io = {};
+
+// --------------------------
+// FS - mounted file systems
+
+function fsSize(drive, callback) {
+
+ if (util.isFunction(drive)) {
+ callback = drive;
+ drive = '';
+ }
+
+ let macOsDisks = [];
+ let osMounts = [];
+
+ 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 isLinuxTmpFs(fs) {
+ const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged'];
+ let result = false;
+ linuxTmpFileSystems.forEach(linuxFs => {
+ if (fs.toLowerCase().indexOf(linuxFs) >= 0) { result = true; }
+ });
+ return result;
+ }
+
+ function filterLines(stdout) {
+ let lines = stdout.toString().split('\n');
+ lines.shift();
+ if (stdout.toString().toLowerCase().indexOf('filesystem')) {
+ let removeLines = 0;
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) {
+ removeLines = i;
+ }
+ }
+ for (let i = 0; i < removeLines; i++) {
+ lines.shift();
+ }
+ }
+ return lines;
+ }
+
+ function parseDf(lines) {
+ let data = [];
+ lines.forEach(function (line) {
+ if (line !== '') {
+ line = line.replace(/ +/g, ' ').split(' ');
+ if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) {
+ const fs = line[0];
+ const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
+ 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 available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024;
+ const use = parseFloat((100.0 * (used / (used + available))).toFixed(2));
+ let rw = osMounts && Object.keys(osMounts).length > 0 ? osMounts[fs] || false : null;
+ line.splice(0, (_linux || _freebsd || _openbsd || _netbsd) ? 6 : 5);
+ const mount = line.join(' ');
+ if (!data.find(el => (el.fs === fs && el.type === fsType))) {
+ data.push({
+ fs,
+ type: fsType,
+ size,
+ used,
+ available,
+ use,
+ mount,
+ rw
+ });
+ }
+ }
+ }
+ });
+ return data;
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let data = [];
+ if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
+ let cmd = '';
+ macOsDisks = [];
+ osMounts = {};
+ if (_darwin) {
+ cmd = 'df -kP';
+ try {
+ macOsDisks = execSync('diskutil list').toString().split('\n').filter(line => {
+ return !line.startsWith('/') && line.indexOf(':') > 0;
+ });
+ execSync('mount').toString().split('\n').filter(line => {
+ return line.startsWith('/');
+ }).forEach((line) => {
+ osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
+ });
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (_linux) {
+ cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
+ execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
+ return line.startsWith('/');
+ }).forEach((line) => {
+ osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('rw') >= 0;
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ cmd = 'df -lkPT';
+ execSync('mount').toString().split('\n').forEach((line) => {
+ osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1;
+ });
+ }
+ exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ let lines = filterLines(stdout);
+ data = parseDf(lines);
+ if (drive) {
+ data = data.filter(item => {
+ return item.fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || item.mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0;
+ });
+ }
+ if ((!error || data.length) && stdout.toString().trim() !== '') {
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ } else {
+ exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = filterLines(stdout);
+ data = parseDf(lines);
+ }
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ });
+ }
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(data); }
+ resolve(data);
+ }
+ if (_windows) {
+ try {
+ const cmd = `Get-WmiObject Win32_logicaldisk | select Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`;
+ util.powerShell(cmd).then((stdout, error) => {
+ if (!error) {
+ let devices = stdout.toString().split(/\n\s*\n/);
+ devices.forEach(function (device) {
+ let lines = device.split('\r\n');
+ const size = util.toInt(util.getValue(lines, 'size', ':'));
+ const free = util.toInt(util.getValue(lines, 'freespace', ':'));
+ const caption = util.getValue(lines, 'caption', ':');
+ const rwValue = util.getValue(lines, 'access', ':');
+ const rw = rwValue ? (util.toInt(rwValue) !== 1) : null;
+ if (size) {
+ data.push({
+ fs: caption,
+ type: util.getValue(lines, 'filesystem', ':'),
+ size,
+ used: size - free,
+ available: free,
+ use: parseFloat(((100.0 * (size - free)) / size).toFixed(2)),
+ mount: caption,
+ rw
+ });
+ }
+ });
+ }
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ });
+ } catch (e) {
+ if (callback) { callback(data); }
+ resolve(data);
+ }
+ }
+ });
+ });
+}
+
+exports.fsSize = fsSize;
+
+// --------------------------
+// FS - open files count
+
+function fsOpenFiles(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ const result = {
+ max: null,
+ allocated: null,
+ available: null
+ };
+ if (_freebsd || _openbsd || _netbsd || _darwin) {
+ let cmd = 'sysctl -i kern.maxfiles kern.num_files kern.open_files';
+ exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result.max = parseInt(util.getValue(lines, 'kern.maxfiles', ':'), 10);
+ result.allocated = parseInt(util.getValue(lines, 'kern.num_files', ':'), 10) || parseInt(util.getValue(lines, 'kern.open_files', ':'), 10);
+ result.available = result.max - result.allocated;
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_linux) {
+ fs.readFile('/proc/sys/fs/file-nr', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines[0]) {
+ const parts = lines[0].replace(/\s+/g, ' ').split(' ');
+ if (parts.length === 3) {
+ result.allocated = parseInt(parts[0], 10);
+ result.available = parseInt(parts[1], 10);
+ result.max = parseInt(parts[2], 10);
+ if (!result.available) { result.available = result.max - result.allocated; }
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else {
+ fs.readFile('/proc/sys/fs/file-max', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines[0]) {
+ result.max = parseInt(lines[0], 10);
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(null); }
+ resolve(null);
+ }
+ if (_windows) {
+ if (callback) { callback(null); }
+ resolve(null);
+ }
+ });
+ });
+}
+
+exports.fsOpenFiles = fsOpenFiles;
+
+// --------------------------
+// disks
+
+function parseBytes(s) {
+ return parseInt(s.substr(s.indexOf(' (') + 2, s.indexOf(' Bytes)') - 10));
+}
+
+function parseDevices(lines) {
+ let devices = [];
+ let i = 0;
+ lines.forEach(line => {
+ if (line.length > 0) {
+ if (line[0] === '*') {
+ i++;
+ } else {
+ let parts = line.split(':');
+ if (parts.length > 1) {
+ if (!devices[i]) {
+ devices[i] = {
+ name: '',
+ identifier: '',
+ type: 'disk',
+ fsType: '',
+ mount: '',
+ size: 0,
+ physical: 'HDD',
+ uuid: '',
+ label: '',
+ model: '',
+ serial: '',
+ removable: false,
+ protocol: '',
+ group: '',
+ device: ''
+ };
+ }
+ parts[0] = parts[0].trim().toUpperCase().replace(/ +/g, '');
+ parts[1] = parts[1].trim();
+ if ('DEVICEIDENTIFIER' === parts[0]) { devices[i].identifier = parts[1]; }
+ if ('DEVICENODE' === parts[0]) { devices[i].name = parts[1]; }
+ if ('VOLUMENAME' === parts[0]) {
+ if (parts[1].indexOf('Not applicable') === -1) { devices[i].label = parts[1]; }
+ }
+ if ('PROTOCOL' === parts[0]) { devices[i].protocol = parts[1]; }
+ if ('DISKSIZE' === parts[0]) { devices[i].size = parseBytes(parts[1]); }
+ if ('FILESYSTEMPERSONALITY' === parts[0]) { devices[i].fsType = parts[1]; }
+ if ('MOUNTPOINT' === parts[0]) { devices[i].mount = parts[1]; }
+ if ('VOLUMEUUID' === parts[0]) { devices[i].uuid = parts[1]; }
+ if ('READ-ONLYMEDIA' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'CD/DVD'; }
+ if ('SOLIDSTATE' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'SSD'; }
+ if ('VIRTUAL' === parts[0]) { devices[i].type = 'virtual'; }
+ if ('REMOVABLEMEDIA' === parts[0]) { devices[i].removable = (parts[1] === 'Removable'); }
+ if ('PARTITIONTYPE' === parts[0]) { devices[i].type = 'part'; }
+ if ('DEVICE/MEDIANAME' === parts[0]) { devices[i].model = parts[1]; }
+ }
+ }
+ }
+ });
+ return devices;
+}
+
+function parseBlk(lines) {
+ let data = [];
+
+ lines.filter(line => line !== '').forEach((line) => {
+ try {
+ line = decodeURIComponent(line.replace(/\\x/g, '%'));
+ line = line.replace(/\\/g, '\\\\');
+ let disk = JSON.parse(line);
+ data.push({
+ 'name': disk.name,
+ 'type': disk.type,
+ 'fsType': disk.fsType,
+ 'mount': disk.mountpoint,
+ 'size': parseInt(disk.size),
+ 'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
+ 'uuid': disk.uuid,
+ 'label': disk.label,
+ 'model': (disk.model || '').trim(),
+ 'serial': disk.serial,
+ 'removable': disk.rm === '1',
+ 'protocol': disk.tran,
+ 'group': disk.group || '',
+ });
+ } catch (e) {
+ util.noop();
+ }
+ });
+ data = util.unique(data);
+ data = util.sortByKey(data, ['type', 'name']);
+ return data;
+}
+
+function decodeMdabmData(lines) {
+ const raid = util.getValue(lines, 'md_level', '=');
+ const label = util.getValue(lines, 'md_name', '='); // <- get label info
+ const uuid = util.getValue(lines, 'md_uuid', '='); // <- get uuid info
+ const members = [];
+ lines.forEach(line => {
+ if (line.toLowerCase().startsWith('md_device_dev') && line.toLowerCase().indexOf('/dev/') > 0) {
+ members.push(line.split('/dev/')[1]);
+ }
+ });
+ return {
+ raid,
+ label,
+ uuid,
+ members
+ };
+}
+
+function raidMatchLinux(data) {
+ // for all block devices of type "raid%"
+ let result = data;
+ try {
+ data.forEach(element => {
+ if (element.type.startsWith('raid')) {
+ const lines = execSync(`mdadm --export --detail /dev/${element.name}`).toString().split('\n');
+ const mdData = decodeMdabmData(lines);
+
+ element.label = mdData.label; // <- assign label info
+ element.uuid = mdData.uuid; // <- assign uuid info
+
+ if (mdData.members && mdData.members.length && mdData.raid === element.type) {
+ result = result.map(blockdevice => {
+ if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) {
+ blockdevice.group = element.name;
+ }
+ return blockdevice;
+ });
+ }
+ }
+ });
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function getDevicesLinux(data) {
+ const result = [];
+ data.forEach(element => {
+ if (element.type.startsWith('disk')) {
+ result.push(element.name);
+ }
+ });
+ return result;
+}
+
+function matchDevicesLinux(data) {
+ let result = data;
+ try {
+ const devices = getDevicesLinux(data);
+ result = result.map(blockdevice => {
+ if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk')) {
+ devices.forEach(element => {
+ if (blockdevice.name.startsWith(element)) {
+ blockdevice.device = '/dev/' + element;
+ }
+ });
+ }
+ return blockdevice;
+ });
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function getDevicesMac(data) {
+ const result = [];
+ data.forEach(element => {
+ if (element.type.startsWith('disk')) {
+ result.push({ name: element.name, model: element.model, device: element.name });
+ }
+ if (element.type.startsWith('virtual')) {
+ let device = '';
+ result.forEach(e => {
+ if (e.model === element.model) {
+ device = e.device;
+ }
+ });
+ if (device) {
+ result.push({ name: element.name, model: element.model, device });
+ }
+ }
+ });
+ return result;
+}
+
+function matchDevicesMac(data) {
+ let result = data;
+ try {
+ const devices = getDevicesMac(data);
+ result = result.map(blockdevice => {
+ if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk') || blockdevice.type.startsWith('virtual')) {
+ devices.forEach(element => {
+ if (blockdevice.name.startsWith(element.name)) {
+ blockdevice.device = element.device;
+ }
+ });
+ }
+ return blockdevice;
+ });
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function getDevicesWin(diskDrives) {
+ const result = [];
+ diskDrives.forEach(element => {
+ const lines = element.split('\r\n');
+ const device = util.getValue(lines, 'DeviceID', ':');
+ let partitions = element.split('@{DeviceID=');
+ if (partitions.length > 1) {
+ partitions = partitions.slice(1);
+ partitions.forEach(partition => {
+ result.push({ name: partition.split(';')[0].toUpperCase(), device });
+ });
+ }
+ });
+ return result;
+}
+
+function matchDevicesWin(data, diskDrives) {
+ const devices = getDevicesWin(diskDrives);
+ data.map(element => {
+ const filteresDevices = devices.filter((e) => { return e.name === element.name.toUpperCase(); });
+ if (filteresDevices.length > 0) {
+ element.device = filteresDevices[0].device;
+ }
+ return element;
+ });
+ return data;
+}
+
+function blkStdoutToObject(stdout) {
+ return stdout.toString()
+ .replace(/NAME=/g, '{"name":')
+ .replace(/FSTYPE=/g, ',"fsType":')
+ .replace(/TYPE=/g, ',"type":')
+ .replace(/SIZE=/g, ',"size":')
+ .replace(/MOUNTPOINT=/g, ',"mountpoint":')
+ .replace(/UUID=/g, ',"uuid":')
+ .replace(/ROTA=/g, ',"rota":')
+ .replace(/RO=/g, ',"ro":')
+ .replace(/RM=/g, ',"rm":')
+ .replace(/TRAN=/g, ',"tran":')
+ .replace(/SERIAL=/g, ',"serial":')
+ .replace(/LABEL=/g, ',"label":')
+ .replace(/MODEL=/g, ',"model":')
+ .replace(/OWNER=/g, ',"owner":')
+ .replace(/GROUP=/g, ',"group":')
+ .replace(/\n/g, '}\n');
+}
+
+function blockDevices(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let data = [];
+ if (_linux) {
+ // see https://wiki.ubuntuusers.de/lsblk/
+ // exec("lsblk -bo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,TRAN,SERIAL,LABEL,MODEL,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,SCHED,RQ-SIZE,RA,WSAME", function (error, stdout) {
+ exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = blkStdoutToObject(stdout).split('\n');
+ data = parseBlk(lines);
+ data = raidMatchLinux(data);
+ data = matchDevicesLinux(data);
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ } else {
+ exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = blkStdoutToObject(stdout).split('\n');
+ data = parseBlk(lines);
+ data = raidMatchLinux(data);
+ }
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ });
+ }
+ });
+ }
+ if (_darwin) {
+ exec('diskutil info -all', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ // parse lines into temp array of devices
+ data = parseDevices(lines);
+ data = matchDevicesMac(data);
+ }
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(data); }
+ resolve(data);
+ }
+ if (_windows) {
+ let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM'];
+ try {
+ // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => {
+ // util.powerShell('Get-CimInstance Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl'));
+ workload.push(util.powerShell('Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L=\'Partitions\'; E={$_.GetRelated(\'Win32_DiskPartition\').GetRelated(\'Win32_LogicalDisk\') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl'));
+ util.promiseAll(
+ workload
+ ).then((res) => {
+ let logicalDisks = res.results[0].toString().split(/\n\s*\n/);
+ let diskDrives = res.results[1].toString().split(/\n\s*\n/);
+ logicalDisks.forEach(function (device) {
+ let lines = device.split('\r\n');
+ let drivetype = util.getValue(lines, 'drivetype', ':');
+ if (drivetype) {
+ data.push({
+ name: util.getValue(lines, 'name', ':'),
+ identifier: util.getValue(lines, 'caption', ':'),
+ type: 'disk',
+ fsType: util.getValue(lines, 'filesystem', ':').toLowerCase(),
+ mount: util.getValue(lines, 'caption', ':'),
+ size: util.getValue(lines, 'size', ':'),
+ physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0],
+ uuid: util.getValue(lines, 'volumeserialnumber', ':'),
+ label: util.getValue(lines, 'volumename', ':'),
+ model: '',
+ serial: util.getValue(lines, 'volumeserialnumber', ':'),
+ removable: drivetype === '2',
+ protocol: '',
+ group: '',
+ device: ''
+ });
+ }
+ });
+ // match devices
+ data = matchDevicesWin(data, diskDrives);
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ });
+ } catch (e) {
+ if (callback) { callback(data); }
+ resolve(data);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ // will follow
+ if (callback) { callback(null); }
+ resolve(null);
+ }
+
+ });
+ });
+}
+
+exports.blockDevices = blockDevices;
+
+// --------------------------
+// FS - speed
+
+function calcFsSpeed(rx, wx) {
+ let result = {
+ rx: 0,
+ wx: 0,
+ tx: 0,
+ rx_sec: null,
+ wx_sec: null,
+ tx_sec: null,
+ ms: 0
+ };
+
+ if (_fs_speed && _fs_speed.ms) {
+ result.rx = rx;
+ result.wx = wx;
+ result.tx = result.rx + result.wx;
+ result.ms = Date.now() - _fs_speed.ms;
+ result.rx_sec = (result.rx - _fs_speed.bytes_read) / (result.ms / 1000);
+ result.wx_sec = (result.wx - _fs_speed.bytes_write) / (result.ms / 1000);
+ result.tx_sec = result.rx_sec + result.wx_sec;
+ _fs_speed.rx_sec = result.rx_sec;
+ _fs_speed.wx_sec = result.wx_sec;
+ _fs_speed.tx_sec = result.tx_sec;
+ _fs_speed.bytes_read = result.rx;
+ _fs_speed.bytes_write = result.wx;
+ _fs_speed.bytes_overall = result.rx + result.wx;
+ _fs_speed.ms = Date.now();
+ _fs_speed.last_ms = result.ms;
+ } else {
+ result.rx = rx;
+ result.wx = wx;
+ result.tx = result.rx + result.wx;
+ _fs_speed.rx_sec = null;
+ _fs_speed.wx_sec = null;
+ _fs_speed.tx_sec = null;
+ _fs_speed.bytes_read = result.rx;
+ _fs_speed.bytes_write = result.wx;
+ _fs_speed.bytes_overall = result.rx + result.wx;
+ _fs_speed.ms = Date.now();
+ _fs_speed.last_ms = 0;
+ }
+ return result;
+}
+
+function fsStats(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (_windows || _freebsd || _openbsd || _netbsd || _sunos) {
+ return resolve(null);
+ }
+
+ let result = {
+ rx: 0,
+ wx: 0,
+ tx: 0,
+ rx_sec: null,
+ wx_sec: null,
+ tx_sec: null,
+ ms: 0
+ };
+
+ let rx = 0;
+ let wx = 0;
+ if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
+ if (_linux) {
+ // exec("df -k | grep /dev/", function(error, stdout) {
+ exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ let fs_filter = [];
+ lines.forEach(function (line) {
+ if (line !== '') {
+ line = line.trim().split(' ');
+ if (fs_filter.indexOf(line[0]) === -1) { fs_filter.push(line[0]); }
+ }
+ });
+
+ let output = fs_filter.join('|');
+ exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ line = line.trim();
+ if (line !== '') {
+ line = line.replace(/ +/g, ' ').split(' ');
+
+ rx += parseInt(line[5]) * 512;
+ wx += parseInt(line[9]) * 512;
+ }
+ });
+ result = calcFsSpeed(rx, wx);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ }
+ if (_darwin) {
+ exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ line = line.trim();
+ if (line !== '') {
+ line = line.split(',');
+
+ rx += parseInt(line[2]);
+ wx += parseInt(line[9]);
+ }
+ });
+ result = calcFsSpeed(rx, wx);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ } else {
+ result.ms = _fs_speed.last_ms;
+ result.rx = _fs_speed.bytes_read;
+ result.wx = _fs_speed.bytes_write;
+ result.tx = _fs_speed.bytes_read + _fs_speed.bytes_write;
+ result.rx_sec = _fs_speed.rx_sec;
+ result.wx_sec = _fs_speed.wx_sec;
+ result.tx_sec = _fs_speed.tx_sec;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.fsStats = fsStats;
+
+function calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime) {
+ let result = {
+ rIO: 0,
+ wIO: 0,
+ tIO: 0,
+ rIO_sec: null,
+ wIO_sec: null,
+ tIO_sec: null,
+ rWaitTime: 0,
+ wWaitTime: 0,
+ tWaitTime: 0,
+ rWaitPercent: null,
+ wWaitPercent: null,
+ tWaitPercent: null,
+ ms: 0
+ };
+ if (_disk_io && _disk_io.ms) {
+ result.rIO = rIO;
+ result.wIO = wIO;
+ result.tIO = rIO + wIO;
+ result.ms = Date.now() - _disk_io.ms;
+ result.rIO_sec = (result.rIO - _disk_io.rIO) / (result.ms / 1000);
+ result.wIO_sec = (result.wIO - _disk_io.wIO) / (result.ms / 1000);
+ result.tIO_sec = result.rIO_sec + result.wIO_sec;
+ result.rWaitTime = rWaitTime;
+ result.wWaitTime = wWaitTime;
+ result.tWaitTime = tWaitTime;
+ result.rWaitPercent = (result.rWaitTime - _disk_io.rWaitTime) * 100 / (result.ms);
+ result.wWaitPercent = (result.wWaitTime - _disk_io.wWaitTime) * 100 / (result.ms);
+ result.tWaitPercent = (result.tWaitTime - _disk_io.tWaitTime) * 100 / (result.ms);
+ _disk_io.rIO = rIO;
+ _disk_io.wIO = wIO;
+ _disk_io.rIO_sec = result.rIO_sec;
+ _disk_io.wIO_sec = result.wIO_sec;
+ _disk_io.tIO_sec = result.tIO_sec;
+ _disk_io.rWaitTime = rWaitTime;
+ _disk_io.wWaitTime = wWaitTime;
+ _disk_io.tWaitTime = tWaitTime;
+ _disk_io.rWaitPercent = result.rWaitPercent;
+ _disk_io.wWaitPercent = result.wWaitPercent;
+ _disk_io.tWaitPercent = result.tWaitPercent;
+ _disk_io.last_ms = result.ms;
+ _disk_io.ms = Date.now();
+ } else {
+ result.rIO = rIO;
+ result.wIO = wIO;
+ result.tIO = rIO + wIO;
+ result.rWaitTime = rWaitTime;
+ result.wWaitTime = wWaitTime;
+ result.tWaitTime = tWaitTime;
+ _disk_io.rIO = rIO;
+ _disk_io.wIO = wIO;
+ _disk_io.rIO_sec = null;
+ _disk_io.wIO_sec = null;
+ _disk_io.tIO_sec = null;
+ _disk_io.rWaitTime = rWaitTime;
+ _disk_io.wWaitTime = wWaitTime;
+ _disk_io.tWaitTime = tWaitTime;
+ _disk_io.rWaitPercent = null;
+ _disk_io.wWaitPercent = null;
+ _disk_io.tWaitPercent = null;
+ _disk_io.last_ms = 0;
+ _disk_io.ms = Date.now();
+ }
+ return result;
+}
+
+function disksIO(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (_windows) {
+ return resolve(null);
+ }
+ if (_sunos) {
+ return resolve(null);
+ }
+
+ let result = {
+ rIO: 0,
+ wIO: 0,
+ tIO: 0,
+ rIO_sec: null,
+ wIO_sec: null,
+ tIO_sec: null,
+ rWaitTime: 0,
+ wWaitTime: 0,
+ tWaitTime: 0,
+ rWaitPercent: null,
+ wWaitPercent: null,
+ tWaitPercent: null,
+ ms: 0
+ };
+ let rIO = 0;
+ let wIO = 0;
+ let rWaitTime = 0;
+ let wWaitTime = 0;
+ let tWaitTime = 0;
+
+ if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) {
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ // prints Block layer statistics for all mounted volumes
+ // var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
+ // var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
+ let cmd = 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
+
+ exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.split('\n');
+ lines.forEach(function (line) {
+ // ignore empty lines
+ if (!line) { return; }
+
+ // sum r/wIO of all disks to compute all disks IO
+ let stats = line.split(';');
+ rIO += parseInt(stats[0]);
+ wIO += parseInt(stats[4]);
+ rWaitTime += parseInt(stats[3]);
+ wWaitTime += parseInt(stats[7]);
+ tWaitTime += parseInt(stats[10]);
+ });
+ result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime);
+
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ }
+ if (_darwin) {
+ exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ line = line.trim();
+ if (line !== '') {
+ line = line.split(',');
+
+ rIO += parseInt(line[10]);
+ wIO += parseInt(line[0]);
+ }
+ });
+ result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ } else {
+ result.rIO = _disk_io.rIO;
+ result.wIO = _disk_io.wIO;
+ result.tIO = _disk_io.rIO + _disk_io.wIO;
+ result.ms = _disk_io.last_ms;
+ result.rIO_sec = _disk_io.rIO_sec;
+ result.wIO_sec = _disk_io.wIO_sec;
+ result.tIO_sec = _disk_io.tIO_sec;
+ result.rWaitTime = _disk_io.rWaitTime;
+ result.wWaitTime = _disk_io.wWaitTime;
+ result.tWaitTime = _disk_io.tWaitTime;
+ result.rWaitPercent = _disk_io.rWaitPercent;
+ result.wWaitPercent = _disk_io.wWaitPercent;
+ result.tWaitPercent = _disk_io.tWaitPercent;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.disksIO = disksIO;
+
+function diskLayout(callback) {
+
+ function getVendorFromModel(model) {
+ const diskManufacturers = [
+ { pattern: 'WESTERN.*', manufacturer: 'Western Digital' },
+ { pattern: '^WDC.*', manufacturer: 'Western Digital' },
+ { pattern: 'WD.*', manufacturer: 'Western Digital' },
+ { pattern: 'TOSHIBA.*', manufacturer: 'Toshiba' },
+ { pattern: 'HITACHI.*', manufacturer: 'Hitachi' },
+ { pattern: '^IC.*', manufacturer: 'Hitachi' },
+ { pattern: '^HTS.*', manufacturer: 'Hitachi' },
+ { pattern: 'SANDISK.*', manufacturer: 'SanDisk' },
+ { pattern: 'KINGSTON.*', manufacturer: 'Kingston Technology' },
+ { pattern: '^SONY.*', manufacturer: 'Sony' },
+ { pattern: 'TRANSCEND.*', manufacturer: 'Transcend' },
+ { pattern: 'SAMSUNG.*', manufacturer: 'Samsung' },
+ { pattern: '^ST(?!I\\ ).*', manufacturer: 'Seagate' },
+ { pattern: '^STI\\ .*', manufacturer: 'SimpleTech' },
+ { pattern: '^D...-.*', manufacturer: 'IBM' },
+ { pattern: '^IBM.*', manufacturer: 'IBM' },
+ { pattern: '^FUJITSU.*', manufacturer: 'Fujitsu' },
+ { pattern: '^MP.*', manufacturer: 'Fujitsu' },
+ { pattern: '^MK.*', manufacturer: 'Toshiba' },
+ { pattern: 'MAXTO.*', manufacturer: 'Maxtor' },
+ { pattern: 'PIONEER.*', manufacturer: 'Pioneer' },
+ { pattern: 'PHILIPS.*', manufacturer: 'Philips' },
+ { pattern: 'QUANTUM.*', manufacturer: 'Quantum Technology' },
+ { pattern: 'FIREBALL.*', manufacturer: 'Quantum Technology' },
+ { pattern: '^VBOX.*', manufacturer: 'VirtualBox' },
+ { pattern: 'CORSAIR.*', manufacturer: 'Corsair Components' },
+ { pattern: 'CRUCIAL.*', manufacturer: 'Crucial' },
+ { pattern: 'ECM.*', manufacturer: 'ECM' },
+ { pattern: 'INTEL.*', manufacturer: 'INTEL' },
+ { pattern: 'EVO.*', manufacturer: 'Samsung' },
+ { pattern: 'APPLE.*', manufacturer: 'Apple' },
+ ];
+
+ let result = '';
+ if (model) {
+ model = model.toUpperCase();
+ diskManufacturers.forEach((manufacturer) => {
+ const re = RegExp(manufacturer.pattern);
+ if (re.test(model)) { result = manufacturer.manufacturer; }
+ });
+ }
+ return result;
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ const commitResult = res => {
+ for (let i = 0; i < res.length; i++) {
+ delete res[i].BSDName;
+ }
+ if (callback) {
+ callback(res);
+ }
+ resolve(res);
+ };
+
+ let result = [];
+ let cmd = '';
+
+ if (_linux) {
+ let cmdFullSmart = '';
+
+ exec('export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ try {
+ const out = stdout.toString().trim();
+ let devices = [];
+ 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.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
+ const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString();
+ let lines = blkStdoutToObject(out2).split('\n');
+ const data = parseBlk(lines);
+ devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
+ }
+ devices.forEach((device) => {
+ let mediumType = '';
+ const BSDName = '/dev/' + device.name;
+ const logical = device.name;
+ try {
+ mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null').toString().split('\n')[0];
+ } catch (e) {
+ util.noop();
+ }
+ let interfaceType = device.tran ? device.tran.toUpperCase().trim() : '';
+ if (interfaceType === 'NVME') {
+ mediumType = '2';
+ interfaceType = 'PCIe';
+ }
+ result.push({
+ device: BSDName,
+ type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (mediumType === '2' ? 'NVMe' : (device.model && device.model.indexOf('SSD') > -1 ? 'SSD' : (device.model && device.model.indexOf('NVM') > -1 ? 'NVMe' : 'HD'))))),
+ name: device.model || '',
+ vendor: getVendorFromModel(device.model) || (device.vendor ? device.vendor.trim() : ''),
+ size: device.size || 0,
+ bytesPerSector: null,
+ totalCylinders: null,
+ totalHeads: null,
+ totalSectors: null,
+ totalTracks: null,
+ tracksPerCylinder: null,
+ sectorsPerTrack: null,
+ firmwareRevision: device.rev ? device.rev.trim() : '',
+ serialNum: device.serial ? device.serial.trim() : '',
+ interfaceType: interfaceType,
+ smartStatus: 'unknown',
+ temperature: null,
+ BSDName: BSDName
+ });
+ cmd += `printf "\n${BSDName}|"; smartctl -H ${BSDName} | grep overall;`;
+ cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
+ });
+ } catch (e) {
+ util.noop();
+ }
+ }
+ // check S.M.A.R.T. status
+ if (cmdFullSmart) {
+ exec(cmdFullSmart, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ try {
+ const data = JSON.parse(`[${stdout}]`);
+ data.forEach(disk => {
+ const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1];
+
+ for (let i = 0; i < result.length; i++) {
+ if (result[i].BSDName === diskBSDName) {
+ result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown'));
+ if (disk.temperature && disk.temperature.current) {
+ result[i].temperature = disk.temperature.current;
+ }
+ result[i].smartData = disk;
+ }
+ }
+ });
+ commitResult(result);
+ } catch (e) {
+ if (cmd) {
+ cmd = cmd + 'printf "\n"';
+ exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(line => {
+ if (line) {
+ let parts = line.split('|');
+ if (parts.length === 2) {
+ let BSDName = parts[0];
+ parts[1] = parts[1].trim();
+ let parts2 = parts[1].split(':');
+ if (parts2.length === 2) {
+ parts2[1] = parts2[1].trim();
+ let status = parts2[1].toLowerCase();
+ for (let i = 0; i < result.length; i++) {
+ if (result[i].BSDName === BSDName) {
+ result[i].smartStatus = (status === 'passed' ? 'Ok' : (status === 'failed!' ? 'Predicted Failure' : 'unknown'));
+ }
+ }
+ }
+ }
+ }
+ });
+ commitResult(result);
+ });
+ } else {
+ commitResult(result);
+ }
+ }
+ });
+ } else {
+ commitResult(result);
+ }
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_darwin) {
+ exec('system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ if (!error) {
+ // split by type:
+ let lines = stdout.toString().split('\n');
+ let linesSATA = [];
+ let linesNVMe = [];
+ let linesUSB = [];
+ let dataType = 'SATA';
+ lines.forEach(line => {
+ if (line === 'NVMExpress:') { dataType = 'NVMe'; }
+ else if (line === 'USB:') { dataType = 'USB'; }
+ else if (line === 'SATA/SATA Express:') { dataType = 'SATA'; }
+ else if (dataType === 'SATA') { linesSATA.push(line); }
+ else if (dataType === 'NVMe') { linesNVMe.push(line); }
+ else if (dataType === 'USB') { linesUSB.push(line); }
+ });
+ try {
+ // Serial ATA Drives
+ let devices = linesSATA.join('\n').split(' Physical Interconnect: ');
+ devices.shift();
+ devices.forEach(function (device) {
+ device = 'InterfaceType: ' + device;
+ let lines = device.split('\n');
+ const mediumType = util.getValue(lines, 'Medium Type', ':', true).trim();
+ const sizeStr = util.getValue(lines, 'capacity', ':', true).trim();
+ const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim();
+ if (sizeStr) {
+ let sizeValue = 0;
+ if (sizeStr.indexOf('(') >= 0) {
+ sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, ''));
+ }
+ if (!sizeValue) {
+ sizeValue = parseInt(sizeStr);
+ }
+ if (sizeValue) {
+ const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase();
+ result.push({
+ device: BSDName,
+ type: mediumType.startsWith('Solid') ? 'SSD' : 'HD',
+ name: util.getValue(lines, 'Model', ':', true).trim(),
+ vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()) || util.getValue(lines, 'Manufacturer', ':', true),
+ size: sizeValue,
+ bytesPerSector: null,
+ totalCylinders: null,
+ totalHeads: null,
+ totalSectors: null,
+ totalTracks: null,
+ tracksPerCylinder: null,
+ sectorsPerTrack: null,
+ firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(),
+ serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(),
+ interfaceType: util.getValue(lines, 'InterfaceType', ':', true).trim(),
+ smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown',
+ temperature: null,
+ BSDName: BSDName
+ });
+ cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
+ }
+ }
+ });
+ } catch (e) {
+ util.noop();
+ }
+
+ // NVME Drives
+ try {
+ let devices = linesNVMe.join('\n').split('\n\n Capacity:');
+ devices.shift();
+ devices.forEach(function (device) {
+ device = '!Capacity: ' + device;
+ let lines = device.split('\n');
+ const linkWidth = util.getValue(lines, 'link width', ':', true).trim();
+ const sizeStr = util.getValue(lines, '!capacity', ':', true).trim();
+ const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim();
+ if (sizeStr) {
+ let sizeValue = 0;
+ if (sizeStr.indexOf('(') >= 0) {
+ sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, ''));
+ }
+ if (!sizeValue) {
+ sizeValue = parseInt(sizeStr);
+ }
+ if (sizeValue) {
+ const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase();
+ result.push({
+ device: BSDName,
+ type: 'NVMe',
+ name: util.getValue(lines, 'Model', ':', true).trim(),
+ vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()),
+ size: sizeValue,
+ bytesPerSector: null,
+ totalCylinders: null,
+ totalHeads: null,
+ totalSectors: null,
+ totalTracks: null,
+ tracksPerCylinder: null,
+ sectorsPerTrack: null,
+ firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(),
+ serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(),
+ interfaceType: ('PCIe ' + linkWidth).trim(),
+ smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown',
+ temperature: null,
+ BSDName: BSDName
+ });
+ cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
+ }
+ }
+ });
+ } catch (e) {
+ util.noop();
+ }
+ // USB Drives
+ try {
+ let devices = linesUSB.join('\n').replaceAll('Media:\n ', 'Model:').split('\n\n Product ID:');
+ devices.shift();
+ devices.forEach(function (device) {
+ let lines = device.split('\n');
+ const sizeStr = util.getValue(lines, 'Capacity', ':', true).trim();
+ const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim();
+ if (sizeStr) {
+ let sizeValue = 0;
+ if (sizeStr.indexOf('(') >= 0) {
+ sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, ''));
+ }
+ if (!sizeValue) {
+ sizeValue = parseInt(sizeStr);
+ }
+ if (sizeValue) {
+ const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase();
+ result.push({
+ device: BSDName,
+ type: 'USB',
+ name: util.getValue(lines, 'Model', ':', true).trim().replaceAll(':', ''),
+ vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()),
+ size: sizeValue,
+ bytesPerSector: null,
+ totalCylinders: null,
+ totalHeads: null,
+ totalSectors: null,
+ totalTracks: null,
+ tracksPerCylinder: null,
+ sectorsPerTrack: null,
+ firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(),
+ serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(),
+ interfaceType: 'USB',
+ smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown',
+ temperature: null,
+ BSDName: BSDName
+ });
+ cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
+ }
+ }
+ });
+ } catch (e) {
+ util.noop();
+ }
+ if (cmd) {
+ cmd = cmd + 'printf "\n"';
+ exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(line => {
+ if (line) {
+ let parts = line.split('|');
+ if (parts.length === 2) {
+ let BSDName = parts[0];
+ parts[1] = parts[1].trim();
+ let parts2 = parts[1].split(':');
+ if (parts2.length === 2) {
+ parts2[1] = parts2[1].trim();
+ let status = parts2[1].toLowerCase();
+ for (let i = 0; i < result.length; i++) {
+ if (result[i].BSDName === BSDName) {
+ result[i].smartStatus = (status === 'not supported' ? 'not supported' : (status === 'verified' ? 'Ok' : (status === 'failing' ? 'Predicted Failure' : 'unknown')));
+ }
+ }
+ }
+ }
+ }
+ });
+ for (let i = 0; i < result.length; i++) {
+ delete result[i].BSDName;
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ for (let i = 0; i < result.length; i++) {
+ delete result[i].BSDName;
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ }
+ });
+ }
+ if (_windows) {
+ try {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,DeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl'));
+ workload.push(util.powerShell('Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl'));
+ if (util.smartMonToolsInstalled()) {
+ try {
+ const smartDev = JSON.parse(execSync('smartctl --scan -j'));
+ if (smartDev && smartDev.devices && smartDev.devices.length > 0) {
+ smartDev.devices.forEach((dev) => {
+ workload.push(execPromiseSave(`smartctl -j -a ${dev.name}`, util.execOptsWin));
+ });
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ let devices = data.results[0].toString().split(/\n\s*\n/);
+ devices.forEach(function (device) {
+ let lines = device.split('\r\n');
+ const size = util.getValue(lines, 'Size', ':').trim();
+ const status = util.getValue(lines, 'Status', ':').trim().toLowerCase();
+ if (size) {
+ result.push({
+ device: util.getValue(lines, 'DeviceId', ':'), // changed from PNPDeviceId to DeviceID (be be able to match devices)
+ type: device.indexOf('SSD') > -1 ? 'SSD' : 'HD', // just a starting point ... better: MSFT_PhysicalDisk - Media Type ... see below
+ name: util.getValue(lines, 'Caption', ':'),
+ vendor: getVendorFromModel(util.getValue(lines, 'Caption', ':', true).trim()),
+ size: parseInt(size),
+ bytesPerSector: parseInt(util.getValue(lines, 'BytesPerSector', ':')),
+ totalCylinders: parseInt(util.getValue(lines, 'TotalCylinders', ':')),
+ totalHeads: parseInt(util.getValue(lines, 'TotalHeads', ':')),
+ totalSectors: parseInt(util.getValue(lines, 'TotalSectors', ':')),
+ totalTracks: parseInt(util.getValue(lines, 'TotalTracks', ':')),
+ tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', ':')),
+ sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', ':')),
+ firmwareRevision: util.getValue(lines, 'FirmwareRevision', ':').trim(),
+ serialNum: util.getValue(lines, 'SerialNumber', ':').trim(),
+ interfaceType: util.getValue(lines, 'InterfaceType', ':').trim(),
+ smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))),
+ temperature: null,
+ });
+ }
+ });
+ devices = data.results[1].split(/\n\s*\n/);
+ devices.forEach(function (device) {
+ let lines = device.split('\r\n');
+ const serialNum = util.getValue(lines, 'SerialNumber', ':').trim();
+ const name = util.getValue(lines, 'FriendlyName', ':').trim().replace('Msft ', 'Microsoft');
+ const size = util.getValue(lines, 'Size', ':').trim();
+ const model = util.getValue(lines, 'Model', ':').trim();
+ const interfaceType = util.getValue(lines, 'BusType', ':').trim();
+ let mediaType = util.getValue(lines, 'MediaType', ':').trim();
+ if (mediaType === '3' || mediaType === 'HDD') { mediaType = 'HD'; }
+ if (mediaType === '4') { mediaType = 'SSD'; }
+ if (mediaType === '5') { mediaType = 'SCM'; }
+ if (mediaType === 'Unspecified' && (model.toLowerCase().indexOf('virtual') > -1 || model.toLowerCase().indexOf('vbox') > -1)) { mediaType = 'Virtual'; }
+ if (size) {
+ let i = util.findObjectByKey(result, 'serialNum', serialNum);
+ if (i === -1 || serialNum === '') {
+ i = util.findObjectByKey(result, 'name', name);
+ }
+ if (i != -1) {
+ result[i].type = mediaType;
+ result[i].interfaceType = interfaceType;
+ }
+ }
+ });
+ // S.M.A.R.T
+ data.results.shift();
+ data.results.shift();
+ if (data.results.length) {
+ data.results.forEach((smartStr) => {
+ try {
+ const smartData = JSON.parse(smartStr);
+ if (smartData.serial_number) {
+ const serialNum = smartData.serial_number;
+ let i = util.findObjectByKey(result, 'serialNum', serialNum);
+ if (i != -1) {
+ result[i].smartStatus = (smartData.smart_status && smartData.smart_status.passed ? 'Ok' : (smartData.smart_status && smartData.smart_status.passed === false ? 'Predicted Failure' : 'unknown'));
+ if (smartData.temperature && smartData.temperature.current) {
+ result[i].temperature = smartData.temperature.current;
+ }
+ result[i].smartData = smartData;
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.diskLayout = diskLayout;
diff --git a/node_modules/systeminformation/lib/graphics.js b/node_modules/systeminformation/lib/graphics.js
new file mode 100644
index 0000000..963f0d7
--- /dev/null
+++ b/node_modules/systeminformation/lib/graphics.js
@@ -0,0 +1,1103 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// graphics.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 7. Graphics (controller, display)
+// ----------------------------------------------------------------------------------
+
+const fs = require('fs');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const util = require('./util');
+
+let _platform = process.platform;
+let _nvidiaSmiPath = '';
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+let _resolutionX = 0;
+let _resolutionY = 0;
+let _pixelDepth = 0;
+let _refreshRate = 0;
+
+const videoTypes = {
+ '-2': 'UNINITIALIZED',
+ '-1': 'OTHER',
+ '0': 'HD15',
+ '1': 'SVIDEO',
+ '2': 'Composite video',
+ '3': 'Component video',
+ '4': 'DVI',
+ '5': 'HDMI',
+ '6': 'LVDS',
+ '8': 'D_JPN',
+ '9': 'SDI',
+ '10': 'DP',
+ '11': 'DP embedded',
+ '12': 'UDI',
+ '13': 'UDI embedded',
+ '14': 'SDTVDONGLE',
+ '15': 'MIRACAST',
+ '2147483648': 'INTERNAL'
+};
+
+function getVendorFromModel(model) {
+ const manufacturers = [
+ { pattern: '^LG.+', manufacturer: 'LG' },
+ { pattern: '^BENQ.+', manufacturer: 'BenQ' },
+ { pattern: '^ASUS.+', manufacturer: 'Asus' },
+ { pattern: '^DELL.+', manufacturer: 'Dell' },
+ { pattern: '^SAMSUNG.+', manufacturer: 'Samsung' },
+ { pattern: '^VIEWSON.+', manufacturer: 'ViewSonic' },
+ { pattern: '^SONY.+', manufacturer: 'Sony' },
+ { pattern: '^ACER.+', manufacturer: 'Acer' },
+ { pattern: '^AOC.+', manufacturer: 'AOC Monitors' },
+ { pattern: '^HP.+', manufacturer: 'HP' },
+ { pattern: '^EIZO.?', manufacturer: 'Eizo' },
+ { pattern: '^PHILIPS.?', manufacturer: 'Philips' },
+ { pattern: '^IIYAMA.?', manufacturer: 'Iiyama' },
+ { pattern: '^SHARP.?', manufacturer: 'Sharp' },
+ { pattern: '^NEC.?', manufacturer: 'NEC' },
+ { pattern: '^LENOVO.?', manufacturer: 'Lenovo' },
+ { pattern: 'COMPAQ.?', manufacturer: 'Compaq' },
+ { pattern: 'APPLE.?', manufacturer: 'Apple' },
+ { pattern: 'INTEL.?', manufacturer: 'Intel' },
+ { pattern: 'AMD.?', manufacturer: 'AMD' },
+ { pattern: 'NVIDIA.?', manufacturer: 'NVDIA' },
+ ];
+
+ let result = '';
+ if (model) {
+ model = model.toUpperCase();
+ manufacturers.forEach((manufacturer) => {
+ const re = RegExp(manufacturer.pattern);
+ if (re.test(model)) { result = manufacturer.manufacturer; }
+ });
+ }
+ return result;
+}
+
+function getVendorFromId(id) {
+ const vendors = {
+ '610': 'Apple',
+ '1e6d': 'LG',
+ '10ac': 'DELL',
+ '4dd9': 'Sony',
+ '38a3': 'NEC',
+ };
+ return vendors[id] || '';
+}
+
+function vendorToId(str) {
+ let result = '';
+ str = (str || '').toLowerCase();
+ if (str.indexOf('apple') >= 0) { result = '0x05ac'; }
+ else if (str.indexOf('nvidia') >= 0) { result = '0x10de'; }
+ else if (str.indexOf('intel') >= 0) { result = '0x8086'; }
+ else if (str.indexOf('ati') >= 0 || str.indexOf('amd') >= 0) { result = '0x1002'; }
+
+ return result;
+}
+
+function getMetalVersion(id) {
+ const families = {
+ 'spdisplays_mtlgpufamilymac1': 'mac1',
+ 'spdisplays_mtlgpufamilymac2': 'mac2',
+ 'spdisplays_mtlgpufamilyapple1': 'apple1',
+ 'spdisplays_mtlgpufamilyapple2': 'apple2',
+ 'spdisplays_mtlgpufamilyapple3': 'apple3',
+ 'spdisplays_mtlgpufamilyapple4': 'apple4',
+ 'spdisplays_mtlgpufamilyapple5': 'apple5',
+ 'spdisplays_mtlgpufamilyapple6': 'apple6',
+ 'spdisplays_mtlgpufamilyapple7': 'apple7',
+ 'spdisplays_metalfeaturesetfamily11': 'family1_v1',
+ 'spdisplays_metalfeaturesetfamily12': 'family1_v2',
+ 'spdisplays_metalfeaturesetfamily13': 'family1_v3',
+ 'spdisplays_metalfeaturesetfamily14': 'family1_v4',
+ 'spdisplays_metalfeaturesetfamily21': 'family2_v1'
+ };
+ return families[id] || '';
+}
+
+function graphics(callback) {
+
+ function parseLinesDarwin(graphicsArr) {
+ const res = {
+ controllers: [],
+ displays: []
+ };
+ try {
+ graphicsArr.forEach(function (item) {
+ // controllers
+ const bus = ((item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : ''));
+ const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1);
+ const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1);
+ let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || '');
+ res.controllers.push({
+ vendor: getVendorFromModel(item.spdisplays_vendor || '') || item.spdisplays_vendor || '',
+ model: item.sppci_model || '',
+ bus,
+ vramDynamic: bus === 'Built-In',
+ vram: vram || vramDyn || null,
+ deviceId: item['spdisplays_device-id'] || '',
+ vendorId: item['spdisplays_vendor-id'] || vendorToId((item['spdisplays_vendor'] || '') + (item.sppci_model || '')),
+ external: (item.sppci_device_type === 'spdisplays_egpu'),
+ cores: item['sppci_cores'] || null,
+ metalVersion
+ });
+
+ // displays
+ if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) {
+ item.spdisplays_ndrvs.forEach(function (displayItem) {
+ const connectionType = displayItem['spdisplays_connection_type'] || '';
+ const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@');
+ const currentResolution = currentResolutionParts[0].split('x');
+ const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x');
+ const pixelDepthString = displayItem['spdisplays_depth'] || '';
+ const serial = displayItem['_spdisplays_display-serial-number'] || displayItem['_spdisplays_display-serial-number2'] || null;
+ res.displays.push({
+ vendor: getVendorFromId(displayItem['_spdisplays_display-vendor-id'] || '') || getVendorFromModel(displayItem['_name'] || ''),
+ vendorId: displayItem['_spdisplays_display-vendor-id'] || '',
+ model: displayItem['_name'] || '',
+ productionYear: displayItem['_spdisplays_display-year'] || null,
+ serial: serial !== '0' ? serial : null,
+ displayId: displayItem['_spdisplays_displayID'] || null,
+ main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false,
+ builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1,
+ connection: ((connectionType.indexOf('_internal') > -1) ? 'Internal' : ((connectionType.indexOf('_displayport') > -1) ? 'Display Port' : ((connectionType.indexOf('_hdmi') > -1) ? 'HDMI' : null))),
+ sizeX: null,
+ sizeY: null,
+ pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : null))),
+ resolutionX: pixelParts.length > 1 ? parseInt(pixelParts[0], 10) : null,
+ resolutionY: pixelParts.length > 1 ? parseInt(pixelParts[1], 10) : null,
+ currentResX: currentResolution.length > 1 ? parseInt(currentResolution[0], 10) : null,
+ currentResY: currentResolution.length > 1 ? parseInt(currentResolution[1], 10) : null,
+ positionX: 0,
+ positionY: 0,
+ currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null,
+
+ });
+ });
+ }
+ });
+ return res;
+ } catch (e) {
+ return res;
+ }
+ }
+
+ function parseLinesLinuxControllers(lines) {
+ let controllers = [];
+ let currentController = {
+ vendor: '',
+ model: '',
+ bus: '',
+ busAddress: '',
+ vram: null,
+ vramDynamic: false,
+ pciID: ''
+ };
+ let isGraphicsController = false;
+ // PCI bus IDs
+ let pciIDs = [];
+ try {
+ pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "').toString().split('\n');
+ for (let i = 0; i < pciIDs.length; i++) {
+ pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim();
+ }
+ pciIDs = pciIDs.filter(function (el) {
+ return el != null && el;
+ });
+ } catch (e) {
+ util.noop();
+ }
+ lines.forEach((line) => {
+ if ('' !== line.trim()) {
+ if (' ' !== line[0] && '\t' !== line[0]) { // first line of new entry
+ let isExternal = (pciIDs.indexOf(line.split(' ')[0]) >= 0);
+ let vgapos = line.toLowerCase().indexOf(' vga ');
+ let _3dcontrollerpos = line.toLowerCase().indexOf('3d controller');
+ if (vgapos !== -1 || _3dcontrollerpos !== -1) { // VGA
+ if (_3dcontrollerpos !== -1 && vgapos === -1) {
+ vgapos = _3dcontrollerpos;
+ }
+ if (currentController.vendor || currentController.model || currentController.bus || currentController.vram !== null || currentController.vramDynamic) { // already a controller found
+ controllers.push(currentController);
+ currentController = {
+ vendor: '',
+ model: '',
+ bus: '',
+ busAddress: '',
+ vram: null,
+ vramDynamic: false,
+ };
+ }
+
+ const pciIDCandidate = line.split(' ')[0];
+ if (/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(pciIDCandidate)) {
+ currentController.busAddress = pciIDCandidate;
+ }
+ isGraphicsController = true;
+ let endpos = line.search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/);
+ let parts = line.substr(vgapos, endpos - vgapos).split(':');
+ currentController.busAddress = line.substr(0, vgapos).trim();
+ if (parts.length > 1) {
+ parts[1] = parts[1].trim();
+ if (parts[1].toLowerCase().indexOf('corporation') >= 0) {
+ currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf('corporation') + 11).trim();
+ currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf('corporation') + 11, 200).trim().split('(')[0];
+ currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard';
+ currentController.vram = null;
+ currentController.vramDynamic = false;
+ } else if (parts[1].toLowerCase().indexOf(' inc.') >= 0) {
+ if ((parts[1].match(/]/g) || []).length > 1) {
+ currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim();
+ currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim();
+ } else {
+ currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' inc.') + 5).trim();
+ currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' inc.') + 5, 200).trim().split('(')[0].trim();
+ }
+ currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard';
+ currentController.vram = null;
+ currentController.vramDynamic = false;
+ } else if (parts[1].toLowerCase().indexOf(' ltd.') >= 0) {
+ if ((parts[1].match(/]/g) || []).length > 1) {
+ currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim();
+ currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim();
+ } else {
+ currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' ltd.') + 5).trim();
+ currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' ltd.') + 5, 200).trim().split('(')[0].trim();
+ }
+ }
+ }
+
+ } else {
+ isGraphicsController = false;
+ }
+ }
+ if (isGraphicsController) { // within VGA details
+ let parts = line.split(':');
+ if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('devicename') !== -1 && parts[1].toLowerCase().indexOf('onboard') !== -1) { currentController.bus = 'Onboard'; }
+ if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) {
+ let memparts = parts[1].split('=');
+ if (memparts.length > 1) {
+ currentController.vram = parseInt(memparts[1]);
+ }
+ }
+ }
+ }
+ });
+
+ if (currentController.vendor || currentController.model || currentController.bus || currentController.busAddress || currentController.vram !== null || currentController.vramDynamic) { // already a controller found
+ controllers.push(currentController);
+ }
+ return (controllers);
+ }
+
+ function parseLinesLinuxClinfo(controllers, lines) {
+ const fieldPattern = /\[([^\]]+)\]\s+(\w+)\s+(.*)/;
+ const devices = lines.reduce((devices, line) => {
+ const field = fieldPattern.exec(line.trim());
+ if (field) {
+ if (!devices[field[1]]) {
+ devices[field[1]] = {};
+ }
+ devices[field[1]][field[2]] = field[3];
+ }
+ return devices;
+ }, {});
+ for (let deviceId in devices) {
+ const device = devices[deviceId];
+ if (device['CL_DEVICE_TYPE'] === 'CL_DEVICE_TYPE_GPU') {
+ let busAddress;
+ if (device['CL_DEVICE_TOPOLOGY_AMD']) {
+ const bdf = device['CL_DEVICE_TOPOLOGY_AMD'].match(/[a-zA-Z0-9]+:\d+\.\d+/);
+ if (bdf) {
+ busAddress = bdf[0];
+ }
+ } else if (device['CL_DEVICE_PCI_BUS_ID_NV'] && device['CL_DEVICE_PCI_SLOT_ID_NV']) {
+ const bus = parseInt(device['CL_DEVICE_PCI_BUS_ID_NV']);
+ const slot = parseInt(device['CL_DEVICE_PCI_SLOT_ID_NV']);
+ if (!isNaN(bus) && !isNaN(slot)) {
+ const b = bus & 0xff;
+ const d = (slot >> 3) & 0xff;
+ const f = slot & 0x07;
+ busAddress = `${b.toString().padStart(2, '0')}:${d.toString().padStart(2, '0')}.${f}`;
+ }
+ }
+ if (busAddress) {
+ let controller = controllers.find(controller => controller.busAddress === busAddress);
+ if (!controller) {
+ controller = {
+ vendor: '',
+ model: '',
+ bus: '',
+ busAddress,
+ vram: null,
+ vramDynamic: false
+ };
+ controllers.push(controller);
+ }
+ controller.vendor = device['CL_DEVICE_VENDOR'];
+ if (device['CL_DEVICE_BOARD_NAME_AMD']) {
+ controller.model = device['CL_DEVICE_BOARD_NAME_AMD'];
+ } else {
+ controller.model = device['CL_DEVICE_NAME'];
+ }
+ const memory = parseInt(device['CL_DEVICE_GLOBAL_MEM_SIZE']);
+ if (!isNaN(memory)) {
+ controller.vram = Math.round(memory / 1024 / 1024);
+ }
+ }
+ }
+ }
+ return controllers;
+ }
+
+ function getNvidiaSmi() {
+ if (_nvidiaSmiPath) {
+ return _nvidiaSmiPath;
+ }
+
+ if (_windows) {
+ try {
+ const basePath = util.WINDIR + '\\System32\\DriverStore\\FileRepository';
+ // find all directories that have an nvidia-smi.exe file
+ const candidateDirs = fs.readdirSync(basePath).filter(dir => {
+ return fs.readdirSync([basePath, dir].join('/')).includes('nvidia-smi.exe');
+ });
+ // use the directory with the most recently created nvidia-smi.exe file
+ const targetDir = candidateDirs.reduce((prevDir, currentDir) => {
+ const previousNvidiaSmi = fs.statSync([basePath, prevDir, 'nvidia-smi.exe'].join('/'));
+ const currentNvidiaSmi = fs.statSync([basePath, currentDir, 'nvidia-smi.exe'].join('/'));
+ return (previousNvidiaSmi.ctimeMs > currentNvidiaSmi.ctimeMs) ? prevDir : currentDir;
+ });
+
+ if (targetDir) {
+ _nvidiaSmiPath = [basePath, targetDir, 'nvidia-smi.exe'].join('/');
+ }
+ } catch (e) {
+ util.noop();
+ }
+ } else if (_linux) {
+ _nvidiaSmiPath = 'nvidia-smi';
+ }
+ return _nvidiaSmiPath;
+ }
+
+ function nvidiaSmi(options) {
+ const nvidiaSmiExe = getNvidiaSmi();
+ options = options || util.execOptsWin;
+ if (nvidiaSmiExe) {
+ const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits';
+ const cmd = nvidiaSmiExe + ' ' + nvidiaSmiOpts + (_linux ? ' 2>/dev/null' : '');
+ try {
+ const res = execSync(cmd, options).toString();
+ return res;
+ } catch (e) {
+ util.noop();
+ }
+ }
+ return '';
+ }
+
+ function nvidiaDevices() {
+
+ function safeParseNumber(value) {
+ if ([null, undefined].includes(value)) {
+ return value;
+ }
+ return parseFloat(value);
+ }
+
+ const stdout = nvidiaSmi();
+ if (!stdout) {
+ return [];
+ }
+
+ const gpus = stdout.split('\n').filter(Boolean);
+ let results = gpus.map(gpu => {
+ const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value);
+ if (splittedData.length === 16) {
+ return {
+ driverVersion: splittedData[0],
+ subDeviceId: splittedData[1],
+ name: splittedData[2],
+ pciBus: splittedData[3],
+ fanSpeed: safeParseNumber(splittedData[4]),
+ memoryTotal: safeParseNumber(splittedData[5]),
+ memoryUsed: safeParseNumber(splittedData[6]),
+ memoryFree: safeParseNumber(splittedData[7]),
+ utilizationGpu: safeParseNumber(splittedData[8]),
+ utilizationMemory: safeParseNumber(splittedData[9]),
+ temperatureGpu: safeParseNumber(splittedData[10]),
+ temperatureMemory: safeParseNumber(splittedData[11]),
+ powerDraw: safeParseNumber(splittedData[12]),
+ powerLimit: safeParseNumber(splittedData[13]),
+ clockCore: safeParseNumber(splittedData[14]),
+ clockMemory: safeParseNumber(splittedData[15]),
+ };
+ } else {
+ return {};
+ }
+ });
+ results = results.filter((item) => {
+ return ('pciBus' in item);
+ });
+ return results;
+ }
+
+ function mergeControllerNvidia(controller, nvidia) {
+ if (nvidia.driverVersion) { controller.driverVersion = nvidia.driverVersion; }
+ if (nvidia.subDeviceId) { controller.subDeviceId = nvidia.subDeviceId; }
+ if (nvidia.name) { controller.name = nvidia.name; }
+ if (nvidia.pciBus) { controller.pciBus = nvidia.pciBus; }
+ if (nvidia.fanSpeed) { controller.fanSpeed = nvidia.fanSpeed; }
+ if (nvidia.memoryTotal) {
+ controller.memoryTotal = nvidia.memoryTotal;
+ controller.vram = nvidia.memoryTotal;
+ controller.vramDynamic = false;
+ }
+ if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; }
+ if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; }
+ if (nvidia.utilizationGpu) { controller.utilizationGpu = nvidia.utilizationGpu; }
+ if (nvidia.utilizationMemory) { controller.utilizationMemory = nvidia.utilizationMemory; }
+ if (nvidia.temperatureGpu) { controller.temperatureGpu = nvidia.temperatureGpu; }
+ if (nvidia.temperatureMemory) { controller.temperatureMemory = nvidia.temperatureMemory; }
+ if (nvidia.powerDraw) { controller.powerDraw = nvidia.powerDraw; }
+ if (nvidia.powerLimit) { controller.powerLimit = nvidia.powerLimit; }
+ if (nvidia.clockCore) { controller.clockCore = nvidia.clockCore; }
+ if (nvidia.clockMemory) { controller.clockMemory = nvidia.clockMemory; }
+ return controller;
+ }
+
+ function parseLinesLinuxEdid(edid) {
+ // parsen EDID
+ // --> model
+ // --> resolutionx
+ // --> resolutiony
+ // --> builtin = false
+ // --> pixeldepth (?)
+ // --> sizex
+ // --> sizey
+ let result = {
+ vendor: '',
+ model: '',
+ deviceName: '',
+ main: false,
+ builtin: false,
+ connection: '',
+ sizeX: null,
+ sizeY: null,
+ pixelDepth: null,
+ resolutionX: null,
+ resolutionY: null,
+ currentResX: null,
+ currentResY: null,
+ positionX: 0,
+ positionY: 0,
+ currentRefreshRate: null
+ };
+ // find first "Detailed Timing Description"
+ let start = 108;
+ if (edid.substr(start, 6) === '000000') {
+ start += 36;
+ }
+ if (edid.substr(start, 6) === '000000') {
+ start += 36;
+ }
+ if (edid.substr(start, 6) === '000000') {
+ start += 36;
+ }
+ if (edid.substr(start, 6) === '000000') {
+ start += 36;
+ }
+ result.resolutionX = parseInt('0x0' + edid.substr(start + 8, 1) + edid.substr(start + 4, 2));
+ result.resolutionY = parseInt('0x0' + edid.substr(start + 14, 1) + edid.substr(start + 10, 2));
+ result.sizeX = parseInt('0x0' + edid.substr(start + 28, 1) + edid.substr(start + 24, 2));
+ result.sizeY = parseInt('0x0' + edid.substr(start + 29, 1) + edid.substr(start + 26, 2));
+ // monitor name
+ start = edid.indexOf('000000fc00'); // find first "Monitor Description Data"
+ if (start >= 0) {
+ let model_raw = edid.substr(start + 10, 26);
+ if (model_raw.indexOf('0a') !== -1) {
+ model_raw = model_raw.substr(0, model_raw.indexOf('0a'));
+ }
+ try {
+ if (model_raw.length > 2) {
+ result.model = model_raw.match(/.{1,2}/g).map(function (v) {
+ return String.fromCharCode(parseInt(v, 16));
+ }).join('');
+ }
+ } catch (e) {
+ util.noop();
+ }
+ } else {
+ result.model = '';
+ }
+ return result;
+ }
+
+ function parseLinesLinuxDisplays(lines, depth) {
+ let displays = [];
+ let currentDisplay = {
+ vendor: '',
+ model: '',
+ deviceName: '',
+ main: false,
+ builtin: false,
+ connection: '',
+ sizeX: null,
+ sizeY: null,
+ pixelDepth: null,
+ resolutionX: null,
+ resolutionY: null,
+ currentResX: null,
+ currentResY: null,
+ positionX: 0,
+ positionY: 0,
+ currentRefreshRate: null
+ };
+ let is_edid = false;
+ let is_current = false;
+ let edid_raw = '';
+ let start = 0;
+ for (let i = 1; i < lines.length; i++) { // start with second line
+ if ('' !== lines[i].trim()) {
+ if (' ' !== lines[i][0] && '\t' !== lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') !== -1) { // first line of new entry
+ if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // push last display to array
+ displays.push(currentDisplay);
+ currentDisplay = {
+ vendor: '',
+ model: '',
+ main: false,
+ builtin: false,
+ connection: '',
+ sizeX: null,
+ sizeY: null,
+ pixelDepth: null,
+ resolutionX: null,
+ resolutionY: null,
+ currentResX: null,
+ currentResY: null,
+ positionX: 0,
+ positionY: 0,
+ currentRefreshRate: null
+ };
+ }
+ let parts = lines[i].split(' ');
+ currentDisplay.connection = parts[0];
+ currentDisplay.main = lines[i].toLowerCase().indexOf(' primary ') >= 0;
+ currentDisplay.builtin = (parts[0].toLowerCase().indexOf('edp') >= 0);
+ }
+
+ // try to read EDID information
+ if (is_edid) {
+ if (lines[i].search(/\S|$/) > start) {
+ edid_raw += lines[i].toLowerCase().trim();
+ } else {
+ // parsen EDID
+ let edid_decoded = parseLinesLinuxEdid(edid_raw);
+ currentDisplay.vendor = edid_decoded.vendor;
+ currentDisplay.model = edid_decoded.model;
+ currentDisplay.resolutionX = edid_decoded.resolutionX;
+ currentDisplay.resolutionY = edid_decoded.resolutionY;
+ currentDisplay.sizeX = edid_decoded.sizeX;
+ currentDisplay.sizeY = edid_decoded.sizeY;
+ currentDisplay.pixelDepth = depth;
+ is_edid = false;
+ }
+ }
+ if (lines[i].toLowerCase().indexOf('edid:') >= 0) {
+ is_edid = true;
+ start = lines[i].search(/\S|$/);
+ }
+ if (lines[i].toLowerCase().indexOf('*current') >= 0) {
+ const parts1 = lines[i].split('(');
+ if (parts1 && parts1.length > 1 && parts1[0].indexOf('x') >= 0) {
+ const resParts = parts1[0].trim().split('x');
+ currentDisplay.currentResX = util.toInt(resParts[0]);
+ currentDisplay.currentResY = util.toInt(resParts[1]);
+ }
+ is_current = true;
+ }
+ if (is_current && lines[i].toLowerCase().indexOf('clock') >= 0 && lines[i].toLowerCase().indexOf('hz') >= 0 && lines[i].toLowerCase().indexOf('v: height') >= 0) {
+ const parts1 = lines[i].split('clock');
+ if (parts1 && parts1.length > 1 && parts1[1].toLowerCase().indexOf('hz') >= 0) {
+ currentDisplay.currentRefreshRate = util.toInt(parts1[1]);
+ }
+ is_current = false;
+ }
+ }
+ }
+
+ // pushen displays
+ if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // still information there
+ displays.push(currentDisplay);
+ }
+ return displays;
+ }
+
+ // function starts here
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+ controllers: [],
+ displays: []
+ };
+ if (_darwin) {
+ let cmd = 'system_profiler -xml -detailLevel full SPDisplaysDataType';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ try {
+ const output = stdout.toString();
+ result = parseLinesDarwin(util.plistParser(output)[0]._items);
+ } catch (e) {
+ util.noop();
+ }
+ stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 });
+ const output = (stdout || '').toString();
+ const obj = util.plistReader(output);
+ if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) {
+ const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig'];
+ let i = 0;
+ current.forEach((o) => {
+ if (o['CurrentInfo'] && 'OriginX' in o['CurrentInfo'] && result.displays && result.displays[i]) {
+ result.displays[i].positionX = o['CurrentInfo']['OriginX'];
+ }
+ if (o['CurrentInfo'] && 'OriginY' in o['CurrentInfo'] && result.displays && result.displays[i]) {
+ result.displays[i].positionY = o['CurrentInfo']['OriginY'];
+ }
+ i++;
+ });
+ }
+ if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) {
+ const current = obj['DisplayAnyUserSets'][0];
+ let i = 0;
+ current.forEach((o) => {
+ if ('OriginX' in o && result.displays && result.displays[i]) {
+ result.displays[i].positionX = o['OriginX'];
+ }
+ if ('OriginY' in o && result.displays && result.displays[i]) {
+ result.displays[i].positionY = o['OriginY'];
+ }
+ if (o['Mode'] && 'BitsPerPixel' in o['Mode'] && result.displays && result.displays[i]) {
+ result.displays[i].pixelDepth = o['Mode']['BitsPerPixel'];
+ }
+ i++;
+ });
+ }
+
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_linux) {
+ // Raspberry: https://elinux.org/RPI_vcgencmd_usage
+ if (util.isRaspberry() && util.isRaspbian()) {
+ let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;';
+ exec(cmd, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 3 && lines[0].indexOf('mode "') >= -1 && lines[2].indexOf('0x12000a') > -1) {
+ const parts = lines[0].replace('mode', '').replace(/"/g, '').trim().split('x');
+ if (parts.length === 2) {
+ result.displays.push({
+ vendor: '',
+ model: util.getValue(lines, 'device_name', '='),
+ main: true,
+ builtin: false,
+ connection: 'HDMI',
+ sizeX: null,
+ sizeY: null,
+ pixelDepth: null,
+ resolutionX: parseInt(parts[0], 10),
+ resolutionY: parseInt(parts[1], 10),
+ currentResX: null,
+ currentResY: null,
+ positionX: 0,
+ positionY: 0,
+ currentRefreshRate: null
+ });
+ }
+ }
+ if (lines.length > 1 && stdout.toString().indexOf('gpu=') >= -1) {
+ result.controllers.push({
+ vendor: 'Broadcom',
+ model: 'VideoCore IV',
+ bus: '',
+ vram: util.getValue(lines, 'gpu', '=').replace('M', ''),
+ vramDynamic: true
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ let cmd = 'lspci -vvv 2>/dev/null';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result.controllers = parseLinesLinuxControllers(lines);
+ const nvidiaData = nvidiaDevices();
+ // needs to be rewritten ... using no spread operators
+ result.controllers = result.controllers.map((controller) => { // match by busAddress
+ return mergeControllerNvidia(controller, nvidiaData.find((contr) => contr.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {});
+ });
+ }
+ let cmd = 'clinfo --raw';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result.controllers = parseLinesLinuxClinfo(result.controllers, lines);
+ }
+ let cmd = 'xdpyinfo 2>/dev/null | grep \'depth of root window\' | awk \'{ print $5 }\'';
+ exec(cmd, function (error, stdout) {
+ let depth = 0;
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ depth = parseInt(lines[0]) || 0;
+ }
+ let cmd = 'xrandr --verbose 2>/dev/null';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result.displays = parseLinesLinuxDisplays(lines, depth);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ });
+ });
+ });
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ if (callback) { callback(null); }
+ resolve(null);
+ }
+ if (_sunos) {
+ if (callback) { callback(null); }
+ resolve(null);
+ }
+ if (_windows) {
+
+ // https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/
+ // https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/
+ try {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance win32_VideoController | fl *'));
+ workload.push(util.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl'));
+ workload.push(util.powerShell('Get-CimInstance win32_desktopmonitor | fl *'));
+ workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl'));
+ workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens'));
+ workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl'));
+ workload.push(util.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}'));
+
+ const nvidiaData = nvidiaDevices();
+
+ Promise.all(
+ workload
+ ).then((data) => {
+ // controller + vram
+ let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/);
+ let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/);
+ result.controllers = parseLinesWindowsControllers(csections, vsections);
+ result.controllers = result.controllers.map((controller) => { // match by subDeviceId
+ if (controller.vendor.toLowerCase() === 'nvidia') {
+ return mergeControllerNvidia(controller, nvidiaData.find(device => {
+ let windowsSubDeviceId = (controller.subDeviceId || '').toLowerCase();
+ const nvidiaSubDeviceIdParts = device.subDeviceId.split('x');
+ let nvidiaSubDeviceId = nvidiaSubDeviceIdParts.length > 1 ? nvidiaSubDeviceIdParts[1].toLowerCase() : nvidiaSubDeviceIdParts[0].toLowerCase();
+ const lengthDifference = Math.abs(windowsSubDeviceId.length - nvidiaSubDeviceId.length);
+ if (windowsSubDeviceId.length > nvidiaSubDeviceId.length) {
+ for (let i = 0; i < lengthDifference; i++) {
+ nvidiaSubDeviceId = '0' + nvidiaSubDeviceId;
+ }
+ } else if (windowsSubDeviceId.length < nvidiaSubDeviceId.length) {
+ for (let i = 0; i < lengthDifference; i++) {
+ windowsSubDeviceId = '0' + windowsSubDeviceId;
+ }
+ }
+ return windowsSubDeviceId === nvidiaSubDeviceId;
+ }) || {});
+ } else {
+ return controller;
+ }
+ });
+
+ // displays
+ let dsections = data[2].replace(/\r/g, '').split(/\n\s*\n/);
+ // result.displays = parseLinesWindowsDisplays(dsections);
+ if (dsections[0].trim() === '') { dsections.shift(); }
+ if (dsections.length && dsections[dsections.length - 1].trim() === '') { dsections.pop(); }
+
+ // monitor (powershell)
+ let msections = data[3].replace(/\r/g, '').split('Active ');
+ msections.shift();
+
+ // forms.screens (powershell)
+ let ssections = data[4].replace(/\r/g, '').split('BitsPerPixel ');
+ ssections.shift();
+
+ // connection params (powershell) - video type
+ let tsections = data[5].replace(/\r/g, '').split(/\n\s*\n/);
+ tsections.shift();
+
+ // monitor ID (powershell) - model / vendor
+ const res = data[6].replace(/\r/g, '').split(/\n/);
+ let isections = [];
+ res.forEach(element => {
+ const parts = element.split('|');
+ if (parts.length === 5) {
+ isections.push({
+ vendor: parts[0],
+ code: parts[1],
+ model: parts[2],
+ serial: parts[3],
+ instanceId: parts[4]
+ });
+ }
+ });
+
+ result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections);
+
+ if (result.displays.length === 1) {
+ if (_resolutionX) {
+ result.displays[0].resolutionX = _resolutionX;
+ if (!result.displays[0].currentResX) {
+ result.displays[0].currentResX = _resolutionX;
+ }
+ }
+ if (_resolutionY) {
+ result.displays[0].resolutionY = _resolutionY;
+ if (result.displays[0].currentResY === 0) {
+ result.displays[0].currentResY = _resolutionY;
+ }
+ }
+ if (_pixelDepth) {
+ result.displays[0].pixelDepth = _pixelDepth;
+ }
+ }
+ result.displays = result.displays.map(element => {
+ if (_refreshRate && !element.currentRefreshRate) {
+ element.currentRefreshRate = _refreshRate;
+ }
+ return element;
+ });
+
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ })
+ .catch(() => {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+
+ function parseLinesWindowsControllers(sections, vections) {
+ const memorySizes = {};
+ for (const i in vections) {
+ if ({}.hasOwnProperty.call(vections, i)) {
+ if (vections[i].trim() !== '') {
+ const lines = vections[i].trim().split('\n');
+ const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
+ if (matchingDeviceId) {
+ const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize'));
+ if (!isNaN(quadWordmemorySize)) {
+ let deviceId = matchingDeviceId[1].toUpperCase() + '&' + matchingDeviceId[2].toUpperCase();
+ if (matchingDeviceId[3]) {
+ deviceId += '&' + matchingDeviceId[3].toUpperCase();
+ }
+ if (matchingDeviceId[4]) {
+ deviceId += '&' + matchingDeviceId[4].toUpperCase();
+ }
+ memorySizes[deviceId] = quadWordmemorySize;
+ }
+ }
+ }
+ }
+ }
+
+ let controllers = [];
+ for (let i in sections) {
+ if ({}.hasOwnProperty.call(sections, i)) {
+ if (sections[i].trim() !== '') {
+ let lines = sections[i].trim().split('\n');
+ let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
+ let subDeviceId = null;
+ let memorySize = null;
+ if (pnpDeviceId) {
+ subDeviceId = pnpDeviceId[3] || '';
+ if (subDeviceId) {
+ subDeviceId = subDeviceId.split('_')[1];
+ }
+
+ // Match PCI device identifier (there's an order of increasing generality):
+ // https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-pci-devices
+
+ // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4)&REV_r(2)
+ if (memorySize == null && pnpDeviceId[3] && pnpDeviceId[4]) {
+ const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase();
+ if ({}.hasOwnProperty.call(memorySizes, deviceId)) {
+ memorySize = memorySizes[deviceId];
+ }
+ }
+
+ // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4)
+ if (memorySize == null && pnpDeviceId[3]) {
+ const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase();
+ if ({}.hasOwnProperty.call(memorySizes, deviceId)) {
+ memorySize = memorySizes[deviceId];
+ }
+ }
+
+ // PCI\VEN_v(4)&DEV_d(4)&REV_r(2)
+ if (memorySize == null && pnpDeviceId[4]) {
+ const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase();
+ if ({}.hasOwnProperty.call(memorySizes, deviceId)) {
+ memorySize = memorySizes[deviceId];
+ }
+ }
+
+ // PCI\VEN_v(4)&DEV_d(4)
+ if (memorySize == null) {
+ const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase();
+ if ({}.hasOwnProperty.call(memorySizes, deviceId)) {
+ memorySize = memorySizes[deviceId];
+ }
+ }
+ }
+
+ controllers.push({
+ vendor: util.getValue(lines, 'AdapterCompatibility', ':'),
+ model: util.getValue(lines, 'name', ':'),
+ bus: util.getValue(lines, 'PNPDeviceID', ':').startsWith('PCI') ? 'PCI' : '',
+ vram: (memorySize == null ? util.toInt(util.getValue(lines, 'AdapterRAM', ':')) : memorySize) / 1024 / 1024,
+ vramDynamic: (util.getValue(lines, 'VideoMemoryType', ':') === '2'),
+ subDeviceId
+ });
+ _resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', ':')) || _resolutionX;
+ _resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', ':')) || _resolutionY;
+ _refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', ':')) || _refreshRate;
+ _pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', ':')) || _pixelDepth;
+ }
+ }
+ }
+ return controllers;
+ }
+
+ function parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections) {
+ let displays = [];
+ let vendor = '';
+ let model = '';
+ let deviceID = '';
+ let resolutionX = 0;
+ let resolutionY = 0;
+ if (dsections && dsections.length) {
+ let linesDisplay = dsections[0].split('\n');
+ vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':');
+ model = util.getValue(linesDisplay, 'Name', ':');
+ deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&amp;/g, '&').toLowerCase();
+ resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', ':'));
+ resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', ':'));
+ }
+ for (let i = 0; i < ssections.length; i++) {
+ if (ssections[i].trim() !== '') {
+ ssections[i] = 'BitsPerPixel ' + ssections[i];
+ msections[i] = 'Active ' + msections[i];
+ // tsections can be empty OR undefined on earlier versions of powershell (<=2.0)
+ // Tag connection type as UNKNOWN by default if this information is missing
+ if (tsections.length === 0 || tsections[i] === undefined) {
+ tsections[i] = 'Unknown';
+ }
+ let linesScreen = ssections[i].split('\n');
+ let linesMonitor = msections[i].split('\n');
+
+ let linesConnection = tsections[i].split('\n');
+ const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel');
+ const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').replace(/=/g, ':').split(',');
+ const primary = util.getValue(linesScreen, 'Primary');
+ const sizeX = util.getValue(linesMonitor, 'MaxHorizontalImageSize');
+ const sizeY = util.getValue(linesMonitor, 'MaxVerticalImageSize');
+ const instanceName = util.getValue(linesMonitor, 'InstanceName').toLowerCase();
+ const videoOutputTechnology = util.getValue(linesConnection, 'VideoOutputTechnology');
+ const deviceName = util.getValue(linesScreen, 'DeviceName');
+ let displayVendor = '';
+ let displayModel = '';
+ isections.forEach(element => {
+ if (element.instanceId.toLowerCase().startsWith(instanceName) && vendor.startsWith('(') && model.startsWith('PnP')) {
+ displayVendor = element.vendor;
+ displayModel = element.model;
+ }
+ });
+ displays.push({
+ vendor: instanceName.startsWith(deviceID) && displayVendor === '' ? vendor : displayVendor,
+ model: instanceName.startsWith(deviceID) && displayModel === '' ? model : displayModel,
+ deviceName,
+ main: primary.toLowerCase() === 'true',
+ builtin: videoOutputTechnology === '2147483648',
+ connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '',
+ resolutionX: util.toInt(util.getValue(bounds, 'Width', ':')),
+ resolutionY: util.toInt(util.getValue(bounds, 'Height', ':')),
+ sizeX: sizeX ? parseInt(sizeX, 10) : null,
+ sizeY: sizeY ? parseInt(sizeY, 10) : null,
+ pixelDepth: bitsPerPixel,
+ currentResX: util.toInt(util.getValue(bounds, 'Width', ':')),
+ currentResY: util.toInt(util.getValue(bounds, 'Height', ':')),
+ positionX: util.toInt(util.getValue(bounds, 'X', ':')),
+ positionY: util.toInt(util.getValue(bounds, 'Y', ':')),
+ });
+ }
+ }
+ if (ssections.length === 0) {
+ displays.push({
+ vendor,
+ model,
+ main: true,
+ sizeX: null,
+ sizeY: null,
+ resolutionX,
+ resolutionY,
+ pixelDepth: null,
+ currentResX: resolutionX,
+ currentResY: resolutionY,
+ positionX: 0,
+ positionY: 0
+ });
+ }
+ return displays;
+ }
+}
+
+exports.graphics = graphics;
diff --git a/node_modules/systeminformation/lib/index.d.ts b/node_modules/systeminformation/lib/index.d.ts
new file mode 100644
index 0000000..70424a6
--- /dev/null
+++ b/node_modules/systeminformation/lib/index.d.ts
@@ -0,0 +1,1028 @@
+// Type definitions for systeminformation
+// Project: https://github.com/sebhildebrandt/systeminformation
+// Definitions by: sebhildebrandt <https://github.com/sebhildebrandt>
+
+export namespace Systeminformation {
+
+ // 1. General
+
+ interface TimeData {
+ current: number;
+ uptime: number;
+ timezone: string;
+ timezoneName: string;
+ }
+
+ // 2. System (HW)
+
+ interface RaspberryRevisionData {
+ manufacturer: string;
+ processor: string;
+ type: string;
+ revision: string;
+ }
+ interface SystemData {
+ manufacturer: string;
+ model: string;
+ version: string;
+ serial: string;
+ uuid: string;
+ sku: string;
+ virtual: boolean;
+ virtualHost?: string;
+ raspberry?: RaspberryRevisionData;
+ }
+
+ interface BiosData {
+ vendor: string;
+ version: string;
+ releaseDate: string;
+ revision: string;
+ serial?: string;
+ language?: string;
+ features?: string[];
+ }
+
+ interface BaseboardData {
+ manufacturer: string;
+ model: string;
+ version: string;
+ serial: string;
+ assetTag: string;
+ memMax: number | null;
+ memSlots: number | null;
+ }
+
+ interface ChassisData {
+ manufacturer: string;
+ model: string;
+ type: string;
+ version: string;
+ serial: string;
+ assetTag: string;
+ sku: string;
+ }
+
+ // 3. CPU, Memory, Disks, Battery, Graphics
+
+ interface CpuData {
+ manufacturer: string;
+ brand: string;
+ vendor: string;
+ family: string;
+ model: string;
+ stepping: string;
+ revision: string;
+ voltage: string;
+ speed: number;
+ speedMin: number;
+ speedMax: number;
+ governor: string;
+ cores: number;
+ physicalCores: number;
+ efficiencyCores?: number;
+ performanceCores?: number;
+ processors: number;
+ socket: string;
+ flags: string;
+ virtualization: boolean;
+ cache: CpuCacheData;
+ }
+
+ interface CpuCacheData {
+ l1d: number;
+ l1i: number;
+ l2: number;
+ l3: number;
+ }
+
+ interface CpuCurrentSpeedData {
+ min: number;
+ max: number;
+ avg: number;
+ cores: number[];
+ }
+
+ interface CpuTemperatureData {
+ main: number;
+ cores: number[];
+ max: number;
+ socket?: number[];
+ chipset?: number;
+ }
+
+ interface MemData {
+ total: number;
+ free: number;
+ used: number;
+ active: number;
+ available: number;
+ buffcache: number;
+ buffers: number;
+ cached: number;
+ slab: number;
+ swaptotal: number;
+ swapused: number;
+ swapfree: number;
+ }
+
+ interface MemLayoutData {
+ size: number;
+ bank: string;
+ type: string;
+ ecc?: boolean | null;
+ clockSpeed: number | null;
+ formFactor: string;
+ manufacturer?: string;
+ partNum: string;
+ serialNum: string;
+ voltageConfigured: number | null;
+ voltageMin: number | null;
+ voltageMax: number | null;
+ }
+
+ interface SmartData {
+ json_format_version: number[];
+ smartctl: {
+ version: number[];
+ platform_info: string;
+ build_info: string;
+ argv: string[];
+ exit_status: number;
+ };
+ device: {
+ name: string;
+ info_name: string;
+ type: string;
+ protocol: string;
+ };
+ model_family?: string;
+ model_name?: string;
+ serial_number?: string;
+ firmware_version?: string;
+ smart_status: {
+ passed: boolean;
+ };
+ trim?: {
+ supported: boolean;
+ };
+ ata_smart_attributes?: {
+ revision: number;
+ table: {
+ id: number;
+ name: string;
+ value: number;
+ worst: number;
+ thresh: number;
+ when_failed: string;
+ flags: {
+ value: number;
+ string: string;
+ prefailure: boolean;
+ updated_online: boolean;
+ performance: boolean;
+ error_rate: boolean;
+ event_count: boolean;
+ auto_keep: boolean;
+ };
+ raw: {
+ value: number;
+ string: string;
+ };
+ }[];
+ };
+ ata_smart_error_log?: {
+ summary: {
+ revision: number;
+ count: number;
+ };
+ };
+ ata_smart_self_test_log?: {
+ standard: {
+ revision: number;
+ table: {
+ type: {
+ value: number;
+ string: string;
+ };
+ status: {
+ value: number;
+ string: string;
+ passed: boolean;
+ };
+ lifetime_hours: number;
+ }[];
+ count: number;
+ error_count_total: number;
+ error_count_outdated: number;
+ };
+ };
+ nvme_pci_vendor?: {
+ id: number;
+ subsystem_id: number;
+ },
+ nvme_smart_health_information_log?: {
+ critical_warning?: number;
+ temperature?: number;
+ available_spare?: number;
+ available_spare_threshold?: number;
+ percentage_used?: number;
+ data_units_read?: number;
+ data_units_written?: number;
+ host_reads?: number;
+ host_writes?: number;
+ controller_busy_time?: number;
+ power_cycles?: number;
+ power_on_hours?: number;
+ unsafe_shutdowns?: number;
+ media_errors?: number;
+ num_err_log_entries?: number;
+ warning_temp_time?: number;
+ critical_comp_time?: number;
+ temperature_sensors?: number[];
+ },
+ user_capacity?: {
+ blocks: number;
+ bytes: number;
+ },
+ logical_block_size?: number;
+ temperature: {
+ current: number;
+ };
+ power_cycle_count: number;
+ power_on_time: {
+ hours: number;
+ };
+ }
+
+ interface DiskLayoutData {
+ device: string;
+ type: string;
+ name: string;
+ vendor: string;
+ size: number;
+ bytesPerSector: number;
+ totalCylinders: number;
+ totalHeads: number;
+ totalSectors: number;
+ totalTracks: number;
+ tracksPerCylinder: number;
+ sectorsPerTrack: number;
+ firmwareRevision: string;
+ serialNum: string;
+ interfaceType: string;
+ smartStatus: string;
+ temperature: null | number;
+ smartData?: SmartData;
+ }
+
+ interface BatteryData {
+ hasBattery: boolean;
+ cycleCount: number;
+ isCharging: boolean;
+ voltage: number;
+ designedCapacity: number;
+ maxCapacity: number;
+ currentCapacity: number;
+ capacityUnit: string;
+ percent: number;
+ timeRemaining: number;
+ acConnected: boolean;
+ type: string;
+ model: string;
+ manufacturer: string;
+ serial: string;
+ additionalBatteries?: BatteryData[];
+ }
+
+ interface GraphicsData {
+ controllers: GraphicsControllerData[];
+ displays: GraphicsDisplayData[];
+ }
+
+ interface GraphicsControllerData {
+ vendor: string;
+ vendorId?: string;
+ model: string;
+ deviceId?: string;
+ bus: string;
+ busAddress?: string;
+ vram: number | null;
+ vramDynamic: boolean;
+ external?: boolean;
+ cores?: number;
+ metalVersion?: string;
+ subDeviceId?: string;
+ driverVersion?: string;
+ name?: string;
+ pciBus?: string;
+ pciID?: string;
+ fanSpeed?: number;
+ memoryTotal?: number;
+ memoryUsed?: number;
+ memoryFree?: number;
+ utilizationGpu?: number;
+ utilizationMemory?: number;
+ temperatureGpu?: number;
+ temperatureMemory?: number;
+ powerDraw?: number;
+ powerLimit?: number;
+ clockCore?: number;
+ clockMemory?: number;
+ }
+
+ interface GraphicsDisplayData {
+ vendor: string;
+ vendorId: string | null;
+ model: string;
+ productionYear: number | null;
+ serial: string | null;
+ deviceName: string | null;
+ displayId: string | null;
+ main: boolean;
+ builtin: boolean;
+ connection: string | null;
+ sizeX: number | null;
+ sizeY: number | null;
+ pixelDepth: number | null;
+ resolutionX: number | null;
+ resolutionY: number | null;
+ currentResX: number | null;
+ currentResY: number | null;
+ positionX: number;
+ positionY: number;
+ currentRefreshRate: number | null;
+ }
+
+ // 4. Operating System
+
+ interface OsData {
+ platform: string;
+ distro: string;
+ release: string;
+ codename: string;
+ kernel: string;
+ arch: string;
+ hostname: string;
+ fqdn: string;
+ codepage: string;
+ logofile: string;
+ serial: string;
+ build: string;
+ servicepack: string;
+ uefi: boolean | null;
+ hypervizor?: boolean;
+ remoteSession?: boolean;
+ hypervisor?: boolean;
+ }
+
+ interface UuidData {
+ os: string;
+ hardware: string;
+ macs: string[];
+ }
+
+ interface VersionData {
+ kernel?: string;
+ openssl?: string;
+ systemOpenssl?: string;
+ systemOpensslLib?: string;
+ node?: string;
+ v8?: string;
+ npm?: string;
+ yarn?: string;
+ pm2?: string;
+ gulp?: string;
+ grunt?: string;
+ git?: string;
+ tsc?: string;
+ mysql?: string;
+ redis?: string;
+ mongodb?: string;
+ nginx?: string;
+ php?: string;
+ docker?: string;
+ postfix?: string;
+ postgresql?: string;
+ perl?: string;
+ python?: string;
+ python3?: string;
+ pip?: string;
+ pip3?: string;
+ java?: string;
+ gcc?: string;
+ virtualbox?: string;
+ dotnet?: string;
+ }
+
+ interface UserData {
+ user: string;
+ tty: string;
+ date: string;
+ time: string;
+ ip: string;
+ command: string;
+ }
+
+ // 5. File System
+
+ interface FsSizeData {
+ fs: string;
+ type: string;
+ size: number;
+ used: number;
+ available: number;
+ use: number;
+ mount: string;
+ rw: boolean | null;
+ }
+
+ interface FsOpenFilesData {
+ max: number;
+ allocated: number;
+ available: number;
+ }
+
+ interface BlockDevicesData {
+ name: string;
+ identifier: string;
+ type: string;
+ fsType: string;
+ mount: string;
+ size: number;
+ physical: string;
+ uuid: string;
+ label: string;
+ model: string;
+ serial: string;
+ removable: boolean;
+ protocol: string;
+ group?: string;
+ device?: string;
+ }
+
+ interface FsStatsData {
+ rx: number;
+ wx: number;
+ tx: number;
+ rx_sec: number | null;
+ wx_sec: number | null;
+ tx_sec: number | null;
+ ms: number;
+ }
+
+ interface DisksIoData {
+ rIO: number;
+ wIO: number;
+ tIO: number;
+ rIO_sec: number | null;
+ wIO_sec: number | null;
+ tIO_sec: number | null;
+ rWaitTime: number;
+ wWaitTime: number;
+ tWaitTime: number;
+ rWaitPercent: number | null;
+ wWaitPercent: number | null;
+ tWaitPercent: number | null;
+ ms: number;
+ }
+
+ // 6. Network related functions
+
+ interface NetworkInterfacesData {
+ iface: string;
+ ifaceName: string;
+ default: boolean;
+ ip4: string;
+ ip4subnet: string;
+ ip6: string;
+ ip6subnet: string;
+ mac: string;
+ internal: boolean;
+ virtual: boolean;
+ operstate: string;
+ type: string;
+ duplex: string;
+ mtu: number | null;
+ speed: number | null;
+ dhcp: boolean;
+ dnsSuffix: string;
+ ieee8021xAuth: string;
+ ieee8021xState: string;
+ carrierChanges: number;
+ }
+
+ interface NetworkStatsData {
+ iface: string;
+ operstate: string;
+ rx_bytes: number;
+ rx_dropped: number;
+ rx_errors: number;
+ tx_bytes: number;
+ tx_dropped: number;
+ tx_errors: number;
+ rx_sec: number;
+ tx_sec: number;
+ ms: number;
+ }
+
+ interface NetworkConnectionsData {
+ protocol: string;
+ localAddress: string;
+ localPort: string;
+ peerAddress: string;
+ peerPort: string;
+ state: string;
+ pid: number;
+ process: string;
+ }
+
+ interface InetChecksiteData {
+ url: string;
+ ok: boolean;
+ status: number;
+ ms: number;
+ }
+
+ interface WifiNetworkData {
+ ssid: string;
+ bssid: string;
+ mode: string;
+ channel: number;
+ frequency: number;
+ signalLevel: number;
+ quality: number;
+ security: string[];
+ wpaFlags: string[];
+ rsnFlags: string[];
+ }
+
+ interface WifiInterfaceData {
+ id: string;
+ iface: string;
+ model: string;
+ vendor: string;
+ mac: string;
+ }
+
+ interface WifiConnectionData {
+ id: string;
+ iface: string;
+ model: string;
+ ssid: string;
+ bssid: string;
+ channel: number;
+ type: string;
+ security: string;
+ frequency: number;
+ signalLevel: number;
+ txRate: number;
+ }
+
+ // 7. Current Load, Processes & Services
+
+ interface CurrentLoadData {
+ avgLoad: number;
+ currentLoad: number;
+ currentLoadUser: number;
+ currentLoadSystem: number;
+ currentLoadNice: number;
+ currentLoadIdle: number;
+ currentLoadIrq: number;
+ rawCurrentLoad: number;
+ rawCurrentLoadUser: number;
+ rawCurrentLoadSystem: number;
+ rawCurrentLoadNice: number;
+ rawCurrentLoadIdle: number;
+ rawCurrentLoadIrq: number;
+ cpus: CurrentLoadCpuData[];
+ }
+
+ interface CurrentLoadCpuData {
+ load: number;
+ loadUser: number;
+ loadSystem: number;
+ loadNice: number;
+ loadIdle: number;
+ loadIrq: number;
+ rawLoad: number;
+ rawLoadUser: number;
+ rawLoadSystem: number;
+ rawLoadNice: number;
+ rawLoadIdle: number;
+ rawLoadIrq: number;
+ }
+
+ interface ProcessesData {
+ all: number;
+ running: number;
+ blocked: number;
+ sleeping: number;
+ unknown: number;
+ list: ProcessesProcessData[];
+ }
+
+ interface ProcessesProcessData {
+ pid: number;
+ parentPid: number;
+ name: string;
+ cpu: number;
+ cpuu: number;
+ cpus: number;
+ mem: number;
+ priority: number;
+ memVsz: number;
+ memRss: number;
+ nice: number;
+ started: string;
+ state: string;
+ tty: string;
+ user: string;
+ command: string;
+ params: string;
+ path: string;
+ }
+
+ interface ProcessesProcessLoadData {
+ proc: string;
+ pid: number;
+ pids: number[];
+ cpu: number;
+ mem: number;
+ }
+
+ interface ServicesData {
+ name: string;
+ running: boolean;
+ startmode: string;
+ pids: number[];
+ cpu: number;
+ mem: number;
+ }
+
+ // 8. Docker
+
+ interface DockerInfoData {
+ id: string;
+ containers: number;
+ containersRunning: number;
+ containersPaused: number;
+ containersStopped: number;
+ images: number;
+ driver: string;
+ memoryLimit: boolean;
+ swapLimit: boolean;
+ kernelMemory: boolean;
+ cpuCfsPeriod: boolean;
+ cpuCfsQuota: boolean;
+ cpuShares: boolean;
+ cpuSet: boolean;
+ ipv4Forwarding: boolean;
+ bridgeNfIptables: boolean;
+ bridgeNfIp6tables: boolean;
+ debug: boolean;
+ nfd: number;
+ oomKillDisable: boolean;
+ ngoroutines: number;
+ systemTime: string;
+ loggingDriver: string;
+ cgroupDriver: string;
+ nEventsListener: number;
+ kernelVersion: string;
+ operatingSystem: string;
+ osType: string;
+ architecture: string;
+ ncpu: number;
+ memTotal: number;
+ dockerRootDir: string;
+ httpProxy: string;
+ httpsProxy: string;
+ noProxy: string;
+ name: string;
+ labels: string[];
+ experimentalBuild: boolean;
+ serverVersion: string;
+ clusterStore: string;
+ clusterAdvertise: string;
+ defaultRuntime: string;
+ liveRestoreEnabled: boolean;
+ isolation: string;
+ initBinary: string;
+ productLicense: string;
+ }
+
+ interface DockerImageData {
+ id: string;
+ container: string;
+ comment: string;
+ os: string;
+ architecture: string;
+ parent: string;
+ dockerVersion: string;
+ size: number;
+ sharedSize: number;
+ virtualSize: number;
+ author: string;
+ created: number;
+ containerConfig: any;
+ graphDriver: any;
+ repoDigests: any;
+ repoTags: any;
+ config: any;
+ rootFS: any;
+ }
+
+ interface DockerContainerData {
+ id: string;
+ name: string;
+ image: string;
+ imageID: string;
+ command: string;
+ created: number;
+ started: number;
+ finished: number;
+ createdAt: string;
+ startedAt: string;
+ finishedAt: string;
+ state: string;
+ restartCount: number;
+ platform: string;
+ driver: string;
+ ports: number[];
+ mounts: DockerContainerMountData[];
+ }
+
+ interface DockerContainerMountData {
+ Type: string;
+ Source: string;
+ Destination: string;
+ Mode: string;
+ RW: boolean;
+ Propagation: string;
+ }
+
+ interface DockerContainerStatsData {
+ id: string;
+ memUsage: number;
+ memLimit: number;
+ memPercent: number;
+ cpuPercent: number;
+ pids: number;
+ netIO: {
+ rx: number;
+ wx: number;
+ };
+ blockIO: {
+ r: number;
+ w: number;
+ };
+ restartCount: number;
+ cpuStats: any;
+ precpuStats: any;
+ memoryStats: any;
+ networks: any;
+ }
+
+ interface DockerContainerProcessData {
+ pidHost: string;
+ ppid: string;
+ pgid: string;
+ user: string;
+ ruser: string;
+ group: string;
+ rgroup: string;
+ stat: string;
+ time: string;
+ elapsed: string;
+ nice: string;
+ rss: string;
+ vsz: string;
+ command: string;
+ }
+
+ interface DockerVolumeData {
+ name: string;
+ driver: string;
+ labels: any;
+ mountpoint: string;
+ options: any;
+ scope: string;
+ created: number;
+ }
+
+ // 9. Virtual Box
+
+ interface VboxInfoData {
+ id: string;
+ name: string;
+ running: boolean;
+ started: string;
+ runningSince: number;
+ stopped: string;
+ stoppedSince: number;
+ guestOS: string;
+ hardwareUUID: string;
+ memory: number;
+ vram: number;
+ cpus: number;
+ cpuExepCap: string;
+ cpuProfile: string;
+ chipset: string;
+ firmware: string;
+ pageFusion: boolean;
+ configFile: string;
+ snapshotFolder: string;
+ logFolder: string;
+ hpet: boolean;
+ pae: boolean;
+ longMode: boolean;
+ tripleFaultReset: boolean;
+ apic: boolean;
+ x2Apic: boolean;
+ acpi: boolean;
+ ioApic: boolean;
+ biosApicMode: string;
+ bootMenuMode: string;
+ bootDevice1: string;
+ bootDevice2: string;
+ bootDevice3: string;
+ bootDevice4: string;
+ timeOffset: string;
+ rtc: string;
+ }
+
+ interface PrinterData {
+ id: number;
+ name: string;
+ model: string;
+ uri: string;
+ uuid: string;
+ local: boolean;
+ status: string;
+ default: boolean;
+ shared: boolean;
+ }
+
+ interface UsbData {
+ id: number | string;
+ bus: number;
+ deviceId: number;
+ name: string;
+ type: string;
+ removable: boolean;
+ vendor: string;
+ manufacturer: string;
+ maxPower: string;
+ serialNumber: string;
+ }
+
+ interface AudioData {
+ id: number | string;
+ name: string;
+ manufacturer: string;
+ default: boolean;
+ revision: string;
+ driver: string;
+ channel: string;
+ in: boolean;
+ out: boolean;
+ type: string;
+ status: string;
+ }
+
+ interface BluetoothDeviceData {
+ device: string;
+ name: string;
+ macDevice: string;
+ macHost: string;
+ batteryPercent: number;
+ manufacturer: string;
+ type: string;
+ connected: boolean;
+ }
+
+ // 10. "Get All at once" - functions
+
+ interface StaticData {
+ version: string;
+ system: SystemData;
+ bios: BiosData;
+ baseboard: BaseboardData;
+ chassis: ChassisData;
+ os: OsData;
+ uuid: UuidData;
+ versions: VersionData;
+ cpu: CpuData;
+ graphics: GraphicsData;
+ net: NetworkInterfacesData[];
+ memLayout: MemLayoutData[];
+ diskLayout: DiskLayoutData[];
+ }
+
+ interface DynamicData {
+ time: TimeData;
+ node: string;
+ v8: string;
+ cpuCurrentSpeed: CpuCurrentSpeedData;
+ users: UserData[];
+ processes: ProcessesData[];
+ currentLoad: CurrentLoadData;
+ cpuTemperature: CpuTemperatureData;
+ networkStats: NetworkStatsData[];
+ networkConnections: NetworkConnectionsData[];
+ mem: MemData;
+ battery: BatteryData;
+ services: ServicesData[];
+ fsSize: FsSizeData;
+ fsStats: FsStatsData;
+ disksIO: DisksIoData;
+ wifiNetworks: WifiNetworkData;
+ inetLatency: number;
+ }
+}
+
+export function version(): string;
+export function system(cb?: (data: Systeminformation.SystemData) => any): Promise<Systeminformation.SystemData>;
+export function bios(cb?: (data: Systeminformation.BiosData) => any): Promise<Systeminformation.BiosData>;
+export function baseboard(cb?: (data: Systeminformation.BaseboardData) => any): Promise<Systeminformation.BaseboardData>;
+export function chassis(cb?: (data: Systeminformation.ChassisData) => any): Promise<Systeminformation.ChassisData>;
+
+export function time(): Systeminformation.TimeData;
+export function osInfo(cb?: (data: Systeminformation.OsData) => any): Promise<Systeminformation.OsData>;
+export function versions(apps?: string, cb?: (data: Systeminformation.VersionData) => any): Promise<Systeminformation.VersionData>;
+export function shell(cb?: (data: string) => any): Promise<string>;
+export function uuid(cb?: (data: Systeminformation.UuidData) => any): Promise<Systeminformation.UuidData>;
+
+export function cpu(cb?: (data: Systeminformation.CpuData) => any): Promise<Systeminformation.CpuData>;
+export function cpuFlags(cb?: (data: string) => any): Promise<string>;
+export function cpuCache(cb?: (data: Systeminformation.CpuCacheData) => any): Promise<Systeminformation.CpuCacheData>;
+export function cpuCurrentSpeed(cb?: (data: Systeminformation.CpuCurrentSpeedData) => any): Promise<Systeminformation.CpuCurrentSpeedData>;
+export function cpuTemperature(cb?: (data: Systeminformation.CpuTemperatureData) => any): Promise<Systeminformation.CpuTemperatureData>;
+export function currentLoad(cb?: (data: Systeminformation.CurrentLoadData) => any): Promise<Systeminformation.CurrentLoadData>;
+export function fullLoad(cb?: (data: number) => any): Promise<number>;
+
+export function mem(cb?: (data: Systeminformation.MemData) => any): Promise<Systeminformation.MemData>;
+export function memLayout(cb?: (data: Systeminformation.MemLayoutData[]) => any): Promise<Systeminformation.MemLayoutData[]>;
+
+export function battery(cb?: (data: Systeminformation.BatteryData) => any): Promise<Systeminformation.BatteryData>;
+export function graphics(cb?: (data: Systeminformation.GraphicsData) => any): Promise<Systeminformation.GraphicsData>;
+
+export function fsSize(drive?: string, cb?: (data: Systeminformation.FsSizeData[]) => any): Promise<Systeminformation.FsSizeData[]>;
+export function fsOpenFiles(cb?: (data: Systeminformation.FsOpenFilesData[]) => any): Promise<Systeminformation.FsOpenFilesData[]>;
+export function blockDevices(cb?: (data: Systeminformation.BlockDevicesData[]) => any): Promise<Systeminformation.BlockDevicesData[]>;
+export function fsStats(cb?: (data: Systeminformation.FsStatsData) => any): Promise<Systeminformation.FsStatsData>;
+export function disksIO(cb?: (data: Systeminformation.DisksIoData) => any): Promise<Systeminformation.DisksIoData>;
+export function diskLayout(cb?: (data: Systeminformation.DiskLayoutData[]) => any): Promise<Systeminformation.DiskLayoutData[]>;
+
+export function networkInterfaceDefault(cb?: (data: string) => any): Promise<string>;
+export function networkGatewayDefault(cb?: (data: string) => any): Promise<string>;
+export function networkInterfaces(
+ cb?:
+ | ((data: Systeminformation.NetworkInterfacesData[] | Systeminformation.NetworkInterfacesData) => any)
+ | boolean
+ | string,
+ rescan?: boolean,
+ defaultString?: string
+): Promise<Systeminformation.NetworkInterfacesData[] | Systeminformation.NetworkInterfacesData>;
+
+export function networkStats(ifaces?: string, cb?: (data: Systeminformation.NetworkStatsData[]) => any): Promise<Systeminformation.NetworkStatsData[]>;
+export function networkConnections(cb?: (data: Systeminformation.NetworkConnectionsData[]) => any): Promise<Systeminformation.NetworkConnectionsData[]>;
+export function inetChecksite(url: string, cb?: (data: Systeminformation.InetChecksiteData) => any): Promise<Systeminformation.InetChecksiteData>;
+export function inetLatency(host?: string, cb?: (data: number) => any): Promise<number>;
+
+export function wifiNetworks(cb?: (data: Systeminformation.WifiNetworkData[]) => any): Promise<Systeminformation.WifiNetworkData[]>;
+export function wifiInterfaces(cb?: (data: Systeminformation.WifiInterfaceData[]) => any): Promise<Systeminformation.WifiInterfaceData[]>;
+export function wifiConnections(cb?: (data: Systeminformation.WifiConnectionData[]) => any): Promise<Systeminformation.WifiConnectionData[]>;
+
+export function users(cb?: (data: Systeminformation.UserData[]) => any): Promise<Systeminformation.UserData[]>;
+
+export function processes(cb?: (data: Systeminformation.ProcessesData) => any): Promise<Systeminformation.ProcessesData>;
+export function processLoad(processNames: string, cb?: (data: Systeminformation.ProcessesProcessLoadData[]) => any): Promise<Systeminformation.ProcessesProcessLoadData[]>;
+export function services(serviceName: string, cb?: (data: Systeminformation.ServicesData[]) => any): Promise<Systeminformation.ServicesData[]>;
+
+export function dockerInfo(cb?: (data: Systeminformation.DockerInfoData) => any): Promise<Systeminformation.DockerInfoData>;
+export function dockerImages(all?: boolean, cb?: (data: Systeminformation.DockerImageData[]) => any): Promise<Systeminformation.DockerImageData[]>;
+export function dockerContainers(all?: boolean, cb?: (data: Systeminformation.DockerContainerData[]) => any): Promise<Systeminformation.DockerContainerData[]>;
+export function dockerContainerStats(id?: string, cb?: (data: Systeminformation.DockerContainerStatsData[]) => any): Promise<Systeminformation.DockerContainerStatsData[]>;
+export function dockerContainerProcesses(id?: string, cb?: (data: any) => any): Promise<Systeminformation.DockerContainerProcessData[]>;
+export function dockerVolumes(cb?: (data: Systeminformation.DockerVolumeData[]) => any): Promise<Systeminformation.DockerVolumeData[]>;
+export function dockerAll(cb?: (data: any) => any): Promise<any>;
+
+export function vboxInfo(cb?: (data: Systeminformation.VboxInfoData[]) => any): Promise<Systeminformation.VboxInfoData[]>;
+
+export function printer(cb?: (data: Systeminformation.PrinterData[]) => any): Promise<Systeminformation.PrinterData[]>;
+
+export function usb(cb?: (data: Systeminformation.UsbData[]) => any): Promise<Systeminformation.UsbData[]>;
+
+export function audio(cb?: (data: Systeminformation.AudioData[]) => any): Promise<Systeminformation.AudioData[]>;
+
+export function bluetoothDevices(cb?: (data: Systeminformation.BluetoothDeviceData[]) => any): Promise<Systeminformation.BluetoothDeviceData[]>;
+
+export function getStaticData(cb?: (data: Systeminformation.StaticData) => any): Promise<Systeminformation.StaticData>;
+export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<Systeminformation.DynamicData>;
+export function getAllData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<Systeminformation.StaticData & Systeminformation.DynamicData>;
+export function get(valuesObject: any, cb?: (data: any) => any): Promise<any>;
+export function observe(valuesObject: any, interval: number, cb?: (data: any) => any): number;
+
+export function powerShellStart(): void;
+export function powerShellRelease(): void;
diff --git a/node_modules/systeminformation/lib/index.js b/node_modules/systeminformation/lib/index.js
new file mode 100644
index 0000000..52c99b3
--- /dev/null
+++ b/node_modules/systeminformation/lib/index.js
@@ -0,0 +1,504 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// index.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// Contributors: Guillaume Legrain (https://github.com/glegrain)
+// Riccardo Novaglia (https://github.com/richy24)
+// Quentin Busuttil (https://github.com/Buzut)
+// Lapsio (https://github.com/lapsio)
+// csy (https://github.com/csy1983)
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+
+// ----------------------------------------------------------------------------------
+// Dependencies
+// ----------------------------------------------------------------------------------
+
+const lib_version = require('../package.json').version;
+const util = require('./util');
+const system = require('./system');
+const osInfo = require('./osinfo');
+const cpu = require('./cpu');
+const memory = require('./memory');
+const battery = require('./battery');
+const graphics = require('./graphics');
+const filesystem = require('./filesystem');
+const network = require('./network');
+const wifi = require('./wifi');
+const processes = require('./processes');
+const users = require('./users');
+const internet = require('./internet');
+const docker = require('./docker');
+const vbox = require('./virtualbox');
+const printer = require('./printer');
+const usb = require('./usb');
+const audio = require('./audio');
+const bluetooth = require('./bluetooth');
+
+let _platform = process.platform;
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+// ----------------------------------------------------------------------------------
+// init
+// ----------------------------------------------------------------------------------
+
+if (_windows) {
+ util.getCodepage();
+}
+
+// ----------------------------------------------------------------------------------
+// General
+// ----------------------------------------------------------------------------------
+
+function version() {
+ return lib_version;
+}
+
+// ----------------------------------------------------------------------------------
+// Get static and dynamic data (all)
+// ----------------------------------------------------------------------------------
+
+// --------------------------
+// get static data - they should not change until restarted
+
+function getStaticData(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let data = {};
+
+ data.version = version();
+
+ Promise.all([
+ system.system(),
+ system.bios(),
+ system.baseboard(),
+ system.chassis(),
+ osInfo.osInfo(),
+ osInfo.uuid(),
+ osInfo.versions(),
+ cpu.cpu(),
+ cpu.cpuFlags(),
+ graphics.graphics(),
+ network.networkInterfaces(),
+ memory.memLayout(),
+ filesystem.diskLayout()
+ ]).then((res) => {
+ data.system = res[0];
+ data.bios = res[1];
+ data.baseboard = res[2];
+ data.chassis = res[3];
+ data.os = res[4];
+ data.uuid = res[5];
+ data.versions = res[6];
+ data.cpu = res[7];
+ data.cpu.flags = res[8];
+ data.graphics = res[9];
+ data.net = res[10];
+ data.memLayout = res[11];
+ data.diskLayout = res[12];
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ });
+ });
+}
+
+
+// --------------------------
+// get all dynamic data - e.g. for monitoring agents
+// may take some seconds to get all data
+// --------------------------
+// 2 additional parameters needed
+// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql"
+// - iface: define network interface for which you like to monitor network speed e.g. "eth0"
+
+function getDynamicData(srv, iface, callback) {
+
+ if (util.isFunction(iface)) {
+ callback = iface;
+ iface = '';
+ }
+ if (util.isFunction(srv)) {
+ callback = srv;
+ srv = '';
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ iface = iface || network.getDefaultNetworkInterface();
+ srv = srv || '';
+
+ // use closure to track ƒ completion
+ let functionProcessed = (function () {
+ let totalFunctions = 15;
+ if (_windows) { totalFunctions = 13; }
+ if (_freebsd || _openbsd || _netbsd) { totalFunctions = 11; }
+ if (_sunos) { totalFunctions = 6; }
+
+ return function () {
+ if (--totalFunctions === 0) {
+ if (callback) {
+ callback(data);
+ }
+ resolve(data);
+ }
+ };
+ })();
+
+ let data = {};
+
+ // get time
+ data.time = osInfo.time();
+
+ /**
+ * @namespace
+ * @property {Object} versions
+ * @property {string} versions.node
+ * @property {string} versions.v8
+ */
+ data.node = process.versions.node;
+ data.v8 = process.versions.v8;
+
+ cpu.cpuCurrentSpeed().then((res) => {
+ data.cpuCurrentSpeed = res;
+ functionProcessed();
+ });
+
+ users.users().then((res) => {
+ data.users = res;
+ functionProcessed();
+ });
+
+ processes.processes().then((res) => {
+ data.processes = res;
+ functionProcessed();
+ });
+
+ cpu.currentLoad().then((res) => {
+ data.currentLoad = res;
+ functionProcessed();
+ });
+
+ if (!_sunos) {
+ cpu.cpuTemperature().then((res) => {
+ data.temp = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
+ network.networkStats(iface).then((res) => {
+ data.networkStats = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_sunos) {
+ network.networkConnections().then((res) => {
+ data.networkConnections = res;
+ functionProcessed();
+ });
+ }
+
+ memory.mem().then((res) => {
+ data.mem = res;
+ functionProcessed();
+ });
+
+ if (!_sunos) {
+ battery().then((res) => {
+ data.battery = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_sunos) {
+ processes.services(srv).then((res) => {
+ data.services = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_sunos) {
+ filesystem.fsSize().then((res) => {
+ data.fsSize = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
+ filesystem.fsStats().then((res) => {
+ data.fsStats = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
+ filesystem.disksIO().then((res) => {
+ data.disksIO = res;
+ functionProcessed();
+ });
+ }
+
+ if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
+ wifi.wifiNetworks().then((res) => {
+ data.wifiNetworks = res;
+ functionProcessed();
+ });
+ }
+
+ internet.inetLatency().then((res) => {
+ data.inetLatency = res;
+ functionProcessed();
+ });
+ });
+ });
+}
+
+// --------------------------
+// get all data at once
+// --------------------------
+// 2 additional parameters needed
+// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql"
+// - iface: define network interface for which you like to monitor network speed e.g. "eth0"
+
+function getAllData(srv, iface, callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let data = {};
+
+ if (iface && util.isFunction(iface) && !callback) {
+ callback = iface;
+ iface = '';
+ }
+
+ if (srv && util.isFunction(srv) && !iface && !callback) {
+ callback = srv;
+ srv = '';
+ iface = '';
+ }
+
+ getStaticData().then((res) => {
+ data = res;
+ getDynamicData(srv, iface).then((res) => {
+ for (let key in res) {
+ if ({}.hasOwnProperty.call(res, key)) {
+ data[key] = res[key];
+ }
+ }
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ });
+ });
+ });
+}
+
+function get(valueObject, callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ const allPromises = Object.keys(valueObject)
+ .filter(func => ({}.hasOwnProperty.call(exports, func)))
+ .map(func => {
+ const params = valueObject[func].substring(valueObject[func].lastIndexOf('(') + 1, valueObject[func].lastIndexOf(')'));
+ let funcWithoutParams = func.indexOf(')') >= 0 ? func.split(')')[1].trim() : func;
+ funcWithoutParams = func.indexOf('|') >= 0 ? func.split('|')[0].trim() : funcWithoutParams;
+ if (params) {
+ return exports[funcWithoutParams](params);
+ } else {
+ return exports[funcWithoutParams]('');
+ }
+ });
+
+ Promise.all(allPromises).then((data) => {
+ const result = {};
+ let i = 0;
+ for (let key in valueObject) {
+ if ({}.hasOwnProperty.call(valueObject, key) && {}.hasOwnProperty.call(exports, key) && data.length > i) {
+ if (valueObject[key] === '*' || valueObject[key] === 'all') {
+ result[key] = data[i];
+ } else {
+ let keys = valueObject[key];
+ let filter = '';
+ let filterParts = [];
+ // remove params
+ if (keys.indexOf(')') >= 0) {
+ keys = keys.split(')')[1].trim();
+ }
+ // extract filter and remove it from keys
+ if (keys.indexOf('|') >= 0) {
+ filter = keys.split('|')[1].trim();
+ filterParts = filter.split(':');
+
+ keys = keys.split('|')[0].trim();
+ }
+ keys = keys.replace(/,/g, ' ').replace(/ +/g, ' ').split(' ');
+ if (data[i]) {
+ if (Array.isArray(data[i])) {
+ // result is in an array, go through all elements of array and pick only the right ones
+ const partialArray = [];
+ data[i].forEach(element => {
+ let partialRes = {};
+ if (keys.length === 1 && (keys[0] === '*' || keys[0] === 'all')) {
+ partialRes = element;
+ } else {
+ keys.forEach(k => {
+ if ({}.hasOwnProperty.call(element, k)) {
+ partialRes[k] = element[k];
+ }
+ });
+ }
+ // if there is a filter, then just take those elements
+ if (filter && filterParts.length === 2) {
+ if ({}.hasOwnProperty.call(partialRes, filterParts[0].trim())) {
+ const val = partialRes[filterParts[0].trim()];
+ if (typeof val == 'number') {
+ if (val === parseFloat(filterParts[1].trim())) {
+ partialArray.push(partialRes);
+ }
+ } else if (typeof val == 'string') {
+ if (val.toLowerCase() === filterParts[1].trim().toLowerCase()) {
+ partialArray.push(partialRes);
+ }
+ }
+ }
+ } else {
+ partialArray.push(partialRes);
+ }
+
+ });
+ result[key] = partialArray;
+ } else {
+ const partialRes = {};
+ keys.forEach(k => {
+ if ({}.hasOwnProperty.call(data[i], k)) {
+ partialRes[k] = data[i][k];
+ }
+ });
+ result[key] = partialRes;
+ }
+ } else {
+ result[key] = {};
+ }
+ }
+ i++;
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ });
+}
+
+function observe(valueObject, interval, callback) {
+ let _data = null;
+
+ const result = setInterval(() => {
+ get(valueObject).then((data) => {
+ if (JSON.stringify(_data) !== JSON.stringify(data)) {
+ _data = Object.assign({}, data);
+ callback(data);
+ }
+ });
+ }, interval);
+ return result;
+}
+
+// ----------------------------------------------------------------------------------
+// export all libs
+// ----------------------------------------------------------------------------------
+
+exports.version = version;
+exports.system = system.system;
+exports.bios = system.bios;
+exports.baseboard = system.baseboard;
+exports.chassis = system.chassis;
+
+exports.time = osInfo.time;
+exports.osInfo = osInfo.osInfo;
+exports.versions = osInfo.versions;
+exports.shell = osInfo.shell;
+exports.uuid = osInfo.uuid;
+
+exports.cpu = cpu.cpu;
+exports.cpuFlags = cpu.cpuFlags;
+exports.cpuCache = cpu.cpuCache;
+exports.cpuCurrentSpeed = cpu.cpuCurrentSpeed;
+exports.cpuTemperature = cpu.cpuTemperature;
+exports.currentLoad = cpu.currentLoad;
+exports.fullLoad = cpu.fullLoad;
+
+exports.mem = memory.mem;
+exports.memLayout = memory.memLayout;
+
+exports.battery = battery;
+
+exports.graphics = graphics.graphics;
+
+exports.fsSize = filesystem.fsSize;
+exports.fsOpenFiles = filesystem.fsOpenFiles;
+exports.blockDevices = filesystem.blockDevices;
+exports.fsStats = filesystem.fsStats;
+exports.disksIO = filesystem.disksIO;
+exports.diskLayout = filesystem.diskLayout;
+
+exports.networkInterfaceDefault = network.networkInterfaceDefault;
+exports.networkGatewayDefault = network.networkGatewayDefault;
+exports.networkInterfaces = network.networkInterfaces;
+exports.networkStats = network.networkStats;
+exports.networkConnections = network.networkConnections;
+
+exports.wifiNetworks = wifi.wifiNetworks;
+exports.wifiInterfaces = wifi.wifiInterfaces;
+exports.wifiConnections = wifi.wifiConnections;
+
+exports.services = processes.services;
+exports.processes = processes.processes;
+exports.processLoad = processes.processLoad;
+
+exports.users = users.users;
+
+exports.inetChecksite = internet.inetChecksite;
+exports.inetLatency = internet.inetLatency;
+
+exports.dockerInfo = docker.dockerInfo;
+exports.dockerImages = docker.dockerImages;
+exports.dockerContainers = docker.dockerContainers;
+exports.dockerContainerStats = docker.dockerContainerStats;
+exports.dockerContainerProcesses = docker.dockerContainerProcesses;
+exports.dockerVolumes = docker.dockerVolumes;
+exports.dockerAll = docker.dockerAll;
+
+exports.vboxInfo = vbox.vboxInfo;
+
+exports.printer = printer.printer;
+
+exports.usb = usb.usb;
+
+exports.audio = audio.audio;
+exports.bluetoothDevices = bluetooth.bluetoothDevices;
+
+exports.getStaticData = getStaticData;
+exports.getDynamicData = getDynamicData;
+exports.getAllData = getAllData;
+exports.get = get;
+exports.observe = observe;
+
+exports.powerShellStart = util.powerShellStart;
+exports.powerShellRelease = util.powerShellRelease;
diff --git a/node_modules/systeminformation/lib/internet.js b/node_modules/systeminformation/lib/internet.js
new file mode 100644
index 0000000..84ac517
--- /dev/null
+++ b/node_modules/systeminformation/lib/internet.js
@@ -0,0 +1,236 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// internet.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 12. Internet
+// ----------------------------------------------------------------------------------
+
+// const exec = require('child_process').exec;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+// --------------------------
+// check if external site is available
+
+function inetChecksite(url, callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+ url: url,
+ ok: false,
+ status: 404,
+ ms: null
+ };
+ if (typeof url !== 'string') {
+ if (callback) { callback(result); }
+ return resolve(result);
+ }
+ let urlSanitized = '';
+ const s = util.sanitizeShellString(url, true);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ s[i].__proto__.toLowerCase = util.stringToLower;
+ const sl = s[i].toLowerCase();
+ if (sl && sl[0] && !sl[1] && sl[0].length === 1) {
+ urlSanitized = urlSanitized + sl[0];
+ }
+ }
+ }
+ result.url = urlSanitized;
+ try {
+ if (urlSanitized && !util.isPrototypePolluted()) {
+ urlSanitized.__proto__.startsWith = util.stringStartWith;
+ if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) {
+ if (callback) { callback(result); }
+ return resolve(result);
+ }
+ let t = Date.now();
+ if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
+ let args = ['-I', '--connect-timeout', '5', '-m', '5'];
+ args.push(urlSanitized);
+ let cmd = 'curl';
+ util.execSafe(cmd, args).then((stdout) => {
+ const lines = stdout.split('\n');
+ let statusCode = lines[0] && lines[0].indexOf(' ') >= 0 ? parseInt(lines[0].split(' ')[1], 10) : 404;
+ result.status = statusCode || 404;
+ result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
+ result.ms = (result.ok ? Date.now() - t : null);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_windows) { // if this is stable, this can be used for all OS types
+ const http = (urlSanitized.startsWith('https:') ? require('https') : require('http'));
+ try {
+ http.get(urlSanitized, (res) => {
+ const statusCode = res.statusCode;
+
+ result.status = statusCode || 404;
+ result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
+
+ if (statusCode !== 200) {
+ res.resume();
+ result.ms = (result.ok ? Date.now() - t : null);
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ res.on('data', () => { });
+ res.on('end', () => {
+ result.ms = (result.ok ? Date.now() - t : null);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ }).on('error', () => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (err) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } catch (err) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.inetChecksite = inetChecksite;
+
+// --------------------------
+// check inet latency
+
+function inetLatency(host, callback) {
+
+ // fallback - if only callback is given
+ if (util.isFunction(host) && !callback) {
+ callback = host;
+ host = '';
+ }
+
+ host = host || '8.8.8.8';
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (typeof host !== 'string') {
+ if (callback) { callback(null); }
+ return resolve(null);
+ }
+ let hostSanitized = '';
+ const s = (util.isPrototypePolluted() ? '8.8.8.8' : util.sanitizeShellString(host, true)).trim();
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (!(s[i] === undefined)) {
+ s[i].__proto__.toLowerCase = util.stringToLower;
+ const sl = s[i].toLowerCase();
+ if (sl && sl[0] && !sl[1]) {
+ hostSanitized = hostSanitized + sl[0];
+ }
+ }
+ }
+ hostSanitized.__proto__.startsWith = util.stringStartWith;
+ if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) {
+ if (callback) { callback(null); }
+ return resolve(null);
+ }
+ let params;
+ if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
+ if (_linux) {
+ params = ['-c', '2', '-w', '3', hostSanitized];
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ params = ['-c', '2', '-t', '3', hostSanitized];
+ }
+ if (_darwin) {
+ params = ['-c2', '-t3', hostSanitized];
+ }
+ util.execSafe('ping', params).then((stdout) => {
+ let result = null;
+ if (stdout) {
+ const lines = stdout.split('\n').filter((line) => (line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)).join('\n');
+
+ const line = lines.split('=');
+ if (line.length > 1) {
+ const parts = line[1].split('/');
+ if (parts.length > 1) {
+ result = parseFloat(parts[1]);
+ }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ const params = ['-s', '-a', hostSanitized, '56', '2'];
+ const filt = 'avg';
+ util.execSafe('ping', params, { timeout: 3000 }).then((stdout) => {
+ let result = null;
+ if (stdout) {
+ const lines = stdout.split('\n').filter(line => line.indexOf(filt) >= 0).join('\n');
+ const line = lines.split('=');
+ if (line.length > 1) {
+ const parts = line[1].split('/');
+ if (parts.length > 1) {
+ result = parseFloat(parts[1].replace(',', '.'));
+ }
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ let result = null;
+ try {
+ const params = [hostSanitized, '-n', '1'];
+ util.execSafe('ping', params, util.execOptsWin).then((stdout) => {
+ if (stdout) {
+ let lines = stdout.split('\r\n');
+ lines.shift();
+ lines.forEach(function (line) {
+ if ((line.toLowerCase().match(/ms/g) || []).length === 3) {
+ let l = line.replace(/ +/g, ' ').split(' ');
+ if (l.length > 6) {
+ result = parseFloat(l[l.length - 1]);
+ }
+ }
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.inetLatency = inetLatency;
diff --git a/node_modules/systeminformation/lib/memory.js b/node_modules/systeminformation/lib/memory.js
new file mode 100644
index 0000000..ba09b0b
--- /dev/null
+++ b/node_modules/systeminformation/lib/memory.js
@@ -0,0 +1,551 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// memory.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 5. Memory
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const util = require('./util');
+const fs = require('fs');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+const OSX_RAM_manufacturers = {
+ '0x014F': 'Transcend Information',
+ '0x2C00': 'Micron Technology Inc.',
+ '0x802C': 'Micron Technology Inc.',
+ '0x80AD': 'Hynix Semiconductor Inc.',
+ '0x80CE': 'Samsung Electronics Inc.',
+ '0xAD00': 'Hynix Semiconductor Inc.',
+ '0xCE00': 'Samsung Electronics Inc.',
+ '0x02FE': 'Elpida',
+ '0x5105': 'Qimonda AG i. In.',
+ '0x8551': 'Qimonda AG i. In.',
+ '0x859B': 'Crucial',
+ '0x04CD': 'G-Skill'
+};
+
+const LINUX_RAM_manufacturers = {
+ '017A': 'Apacer',
+ '0198': 'HyperX',
+ '029E': 'Corsair',
+ '04CB': 'A-DATA',
+ '04CD': 'G-Skill',
+ '059B': 'Crucial',
+ '00CE': 'Samsung',
+ '1315': 'Crutial',
+ '014F': 'Transcend Information',
+ '2C00': 'Micron Technology Inc.',
+ '802C': 'Micron Technology Inc.',
+ '80AD': 'Hynix Semiconductor Inc.',
+ '80CE': 'Samsung Electronics Inc.',
+ 'AD00': 'Hynix Semiconductor Inc.',
+ 'CE00': 'Samsung Electronics Inc.',
+ '02FE': 'Elpida',
+ '5105': 'Qimonda AG i. In.',
+ '8551': 'Qimonda AG i. In.',
+ '859B': 'Crucial'
+};
+
+// _______________________________________________________________________________________
+// | R A M | H D |
+// |______________________|_________________________| | |
+// | active buffers/cache | | |
+// |________________________________________________|___________|_________|______________|
+// | used free | used free |
+// |____________________________________________________________|________________________|
+// | total | swap |
+// |____________________________________________________________|________________________|
+
+// free (older versions)
+// ----------------------------------
+// # free
+// total used free shared buffers cached
+// Mem: 16038 (1) 15653 (2) 384 (3) 0 (4) 236 (5) 14788 (6)
+// -/+ buffers/cache: 628 (7) 15409 (8)
+// Swap: 16371 83 16288
+//
+// |------------------------------------------------------------|
+// | R A M |
+// |______________________|_____________________________________|
+// | active (2-(5+6) = 7) | available (3+5+6 = 8) |
+// |______________________|_________________________|___________|
+// | active | buffers/cache (5+6) | |
+// |________________________________________________|___________|
+// | used (2) | free (3) |
+// |____________________________________________________________|
+// | total (1) |
+// |____________________________________________________________|
+
+//
+// free (since free von procps-ng 3.3.10)
+// ----------------------------------
+// # free
+// total used free shared buffers/cache available
+// Mem: 16038 (1) 628 (2) 386 (3) 0 (4) 15024 (5) 14788 (6)
+// Swap: 16371 83 16288
+//
+// |------------------------------------------------------------|
+// | R A M |
+// |______________________|_____________________________________|
+// | | available (6) estimated |
+// |______________________|_________________________|___________|
+// | active (2) | buffers/cache (5) | free (3) |
+// |________________________________________________|___________|
+// | total (1) |
+// |____________________________________________________________|
+//
+// Reference: http://www.software-architect.net/blog/article/date/2015/06/12/-826c6e5052.html
+
+// /procs/meminfo - sample (all in kB)
+//
+// MemTotal: 32806380 kB
+// MemFree: 17977744 kB
+// MemAvailable: 19768972 kB
+// Buffers: 517028 kB
+// Cached: 2161876 kB
+// SwapCached: 456 kB
+// Active: 12081176 kB
+// Inactive: 2164616 kB
+// Active(anon): 10832884 kB
+// Inactive(anon): 1477272 kB
+// Active(file): 1248292 kB
+// Inactive(file): 687344 kB
+// Unevictable: 0 kB
+// Mlocked: 0 kB
+// SwapTotal: 16768892 kB
+// SwapFree: 16768304 kB
+// Dirty: 268 kB
+// Writeback: 0 kB
+// AnonPages: 11568832 kB
+// Mapped: 719992 kB
+// Shmem: 743272 kB
+// Slab: 335716 kB
+// SReclaimable: 256364 kB
+// SUnreclaim: 79352 kB
+
+function mem(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ total: os.totalmem(),
+ free: os.freemem(),
+ used: os.totalmem() - os.freemem(),
+
+ active: os.totalmem() - os.freemem(), // temporarily (fallback)
+ available: os.freemem(), // temporarily (fallback)
+ buffers: 0,
+ cached: 0,
+ slab: 0,
+ buffcache: 0,
+
+ swaptotal: 0,
+ swapused: 0,
+ swapfree: 0
+ };
+
+ if (_linux) {
+ fs.readFile('/proc/meminfo', function (error, stdout) {
+ if (!error) {
+ const lines = stdout.toString().split('\n');
+ result.total = parseInt(util.getValue(lines, 'memtotal'), 10);
+ result.total = result.total ? result.total * 1024 : os.totalmem();
+ result.free = parseInt(util.getValue(lines, 'memfree'), 10);
+ result.free = result.free ? result.free * 1024 : os.freemem();
+ result.used = result.total - result.free;
+
+ result.buffers = parseInt(util.getValue(lines, 'buffers'), 10);
+ result.buffers = result.buffers ? result.buffers * 1024 : 0;
+ result.cached = parseInt(util.getValue(lines, 'cached'), 10);
+ result.cached = result.cached ? result.cached * 1024 : 0;
+ result.slab = parseInt(util.getValue(lines, 'slab'), 10);
+ result.slab = result.slab ? result.slab * 1024 : 0;
+ result.buffcache = result.buffers + result.cached + result.slab;
+
+ let available = parseInt(util.getValue(lines, 'memavailable'), 10);
+ result.available = available ? available * 1024 : result.free + result.buffcache;
+ result.active = result.total - result.available;
+
+ result.swaptotal = parseInt(util.getValue(lines, 'swaptotal'), 10);
+ result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0;
+ result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10);
+ result.swapfree = result.swapfree ? result.swapfree * 1024 : 0;
+ result.swapused = result.swaptotal - result.swapfree;
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ 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) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
+ const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
+ const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
+
+ result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
+ if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
+ result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
+ result.buffcache = inactive + cache;
+ result.available = result.buffcache + result.free;
+ result.active = result.total - result.free - result.buffcache;
+
+ result.swaptotal = 0;
+ result.swapfree = 0;
+ result.swapused = 0;
+
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_darwin) {
+ let pageSize = 4096;
+ try {
+ let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString());
+ pageSize = sysPpageSize || pageSize;
+ } catch (e) {
+ util.noop();
+ }
+ exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+
+ result.active = parseInt(lines[0].split(':')[1], 10) * pageSize;
+ result.buffcache = result.used - result.active;
+ result.available = result.free + result.buffcache;
+ }
+ exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0) {
+ let firstline = lines[0].replace(/,/g, '.').replace(/M/g, '');
+ let lineArray = firstline.trim().split(' ');
+ lineArray.forEach(line => {
+ if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
+ if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
+ if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
+ });
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ }
+ if (_windows) {
+ let swaptotal = 0;
+ let swapused = 0;
+ try {
+ util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
+ lines.forEach(function (line) {
+ if (line !== '') {
+ line = line.trim().split(/\s\s+/);
+ swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
+ swapused = swapused + (parseInt(line[1], 10) || 0);
+ }
+ });
+ }
+ result.swaptotal = swaptotal * 1024 * 1024;
+ result.swapused = swapused * 1024 * 1024;
+ result.swapfree = result.swaptotal - result.swapused;
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.mem = mem;
+
+function memLayout(callback) {
+
+ function getManufacturerDarwin(manId) {
+ if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) {
+ return (OSX_RAM_manufacturers[manId]);
+ }
+ return manId;
+ }
+
+ function getManufacturerLinux(manId) {
+ const manIdSearch = manId.replace('0x', '').toUpperCase();
+ if (manIdSearch.length === 4 && {}.hasOwnProperty.call(LINUX_RAM_manufacturers, manIdSearch)) {
+ return (LINUX_RAM_manufacturers[manIdSearch]);
+ }
+ return manId;
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = [];
+
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) {
+ if (!error) {
+ let devices = stdout.toString().split('Memory Device');
+ devices.shift();
+ devices.forEach(function (device) {
+ let lines = device.split('\n');
+ const sizeString = util.getValue(lines, 'Size');
+ const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
+ let bank = util.getValue(lines, 'Bank Locator');
+ if (bank.toLowerCase().indexOf('bad') >= 0) {
+ bank = '';
+ }
+ if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
+ const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
+ const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
+ result.push({
+ size,
+ bank,
+ type: util.getValue(lines, 'Type:'),
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
+ clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)),
+ formFactor: util.getValue(lines, 'Form Factor:'),
+ manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
+ partNum: util.getValue(lines, 'Part Number:'),
+ serialNum: util.getValue(lines, 'Serial Number:'),
+ voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
+ voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
+ voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null,
+ });
+ } else {
+ result.push({
+ size: 0,
+ bank,
+ type: 'Empty',
+ ecc: null,
+ clockSpeed: 0,
+ formFactor: util.getValue(lines, 'Form Factor:'),
+ partNum: '',
+ serialNum: '',
+ voltageConfigured: null,
+ voltageMin: null,
+ voltageMax: null,
+ });
+ }
+ });
+ }
+ if (!result.length) {
+ result.push({
+ size: os.totalmem(),
+ bank: '',
+ type: '',
+ ecc: null,
+ clockSpeed: 0,
+ formFactor: '',
+ partNum: '',
+ serialNum: '',
+ voltageConfigured: null,
+ voltageMin: null,
+ voltageMax: null,
+ });
+
+ // Try Raspberry PI
+ try {
+ let stdout = execSync('cat /proc/cpuinfo 2>/dev/null');
+ let lines = stdout.toString().split('\n');
+ let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
+ let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
+
+ if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') {
+
+ const clockSpeed = {
+ '0': 400,
+ '1': 450,
+ '2': 450,
+ '3': 3200
+ };
+ result[0].type = 'LPDDR2';
+ result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
+ result[0].ecc = false;
+ result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
+ result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
+ result[0].formFactor = 'SoC';
+
+ stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
+ lines = stdout.toString().split('\n');
+ let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
+ if (freq) {
+ result[0].clockSpeed = freq;
+ }
+
+ stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
+ lines = stdout.toString().split('\n');
+ let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
+ if (voltage) {
+ result[0].voltageConfigured = voltage;
+ result[0].voltageMin = voltage;
+ result[0].voltageMax = voltage;
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+
+ if (_darwin) {
+ exec('system_profiler SPMemoryDataType', function (error, stdout) {
+ if (!error) {
+ const allLines = stdout.toString().split('\n');
+ const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
+ let devices = stdout.toString().split(' BANK ');
+ let hasBank = true;
+ if (devices.length === 1) {
+ devices = stdout.toString().split(' DIMM');
+ hasBank = false;
+ }
+ devices.shift();
+ devices.forEach(function (device) {
+ let lines = device.split('\n');
+ const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0];
+ const size = parseInt(util.getValue(lines, ' Size'));
+ if (size) {
+ result.push({
+ size: size * 1024 * 1024 * 1024,
+ bank: bank,
+ type: util.getValue(lines, ' Type:'),
+ ecc: eccStatus ? eccStatus === 'enabled' : null,
+ clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10),
+ formFactor: '',
+ manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')),
+ partNum: util.getValue(lines, ' Part Number:'),
+ serialNum: util.getValue(lines, ' Serial Number:'),
+ voltageConfigured: null,
+ voltageMin: null,
+ voltageMax: null,
+ });
+ } else {
+ result.push({
+ size: 0,
+ bank: bank,
+ type: 'Empty',
+ ecc: null,
+ clockSpeed: 0,
+ formFactor: '',
+ manufacturer: '',
+ partNum: '',
+ serialNum: '',
+ voltageConfigured: null,
+ voltageMin: null,
+ voltageMax: null,
+ });
+ }
+ });
+ }
+ if (!result.length) {
+ const lines = stdout.toString().split('\n');
+ const size = parseInt(util.getValue(lines, ' Memory:'));
+ const type = util.getValue(lines, ' Type:');
+ if (size && type) {
+ result.push({
+ size: size * 1024 * 1024 * 1024,
+ bank: '0',
+ type,
+ ecc: false,
+ clockSpeed: 0,
+ formFactor: '',
+ manufacturer: 'Apple',
+ partNum: '',
+ serialNum: '',
+ voltageConfigured: null,
+ voltageMin: null,
+ voltageMax: null,
+ });
+
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4'.split('|');
+ const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
+
+ try {
+ util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage | fl').then((stdout, error) => {
+ if (!error) {
+ let devices = stdout.toString().split(/\n\s*\n/);
+ devices.shift();
+ devices.forEach(function (device) {
+ let lines = device.split('\r\n');
+ const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
+ const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
+ const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
+ if (size) {
+ result.push({
+ size,
+ bank: util.getValue(lines, 'BankLabel', ':'), // BankLabel
+ type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
+ clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
+ formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
+ manufacturer: util.getValue(lines, 'Manufacturer', ':'),
+ partNum: util.getValue(lines, 'PartNumber', ':'),
+ serialNum: util.getValue(lines, 'SerialNumber', ':'),
+ voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
+ voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
+ voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
+ });
+ }
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.memLayout = memLayout;
+
diff --git a/node_modules/systeminformation/lib/network.js b/node_modules/systeminformation/lib/network.js
new file mode 100644
index 0000000..6f0253d
--- /dev/null
+++ b/node_modules/systeminformation/lib/network.js
@@ -0,0 +1,1779 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// network.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 9. Network
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const fs = require('fs');
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+let _network = {};
+let _default_iface = '';
+let _ifaces = {};
+let _dhcpNics = [];
+let _networkInterfaces = [];
+let _mac = {};
+let pathToIp;
+
+function getDefaultNetworkInterface() {
+
+ let ifacename = '';
+ let ifacenameFirst = '';
+ try {
+ let ifaces = os.networkInterfaces();
+
+ let scopeid = 9999;
+
+ // fallback - "first" external interface (sorted by scopeid)
+ for (let dev in ifaces) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
+ ifaces[dev].forEach(function (details) {
+ if (details && details.internal === false) {
+ ifacenameFirst = ifacenameFirst || dev; // fallback if no scopeid
+ if (details.scopeid && details.scopeid < scopeid) {
+ ifacename = dev;
+ scopeid = details.scopeid;
+ }
+ }
+ });
+ }
+ }
+ ifacename = ifacename || ifacenameFirst || '';
+
+ if (_windows) {
+ // https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml
+ let defaultIp = '';
+ const cmd = 'netstat -r';
+ const result = execSync(cmd, util.execOptsWin);
+ const lines = result.toString().split(os.EOL);
+ lines.forEach(line => {
+ line = line.replace(/\s+/g, ' ').trim();
+ if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) {
+ const parts = line.split(' ');
+ if (parts.length >= 5) {
+ defaultIp = parts[parts.length - 2];
+ }
+ }
+ });
+ if (defaultIp) {
+ for (let dev in ifaces) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
+ ifaces[dev].forEach(function (details) {
+ if (details && details.address && details.address === defaultIp) {
+ ifacename = dev;
+ }
+ });
+ }
+ }
+ }
+ }
+ if (_linux) {
+ let cmd = 'ip route 2> /dev/null | grep default';
+ let result = execSync(cmd);
+ let parts = result.toString().split('\n')[0].split(/\s+/);
+ if (parts[0] === 'none' && parts[5]) {
+ ifacename = parts[5];
+ } else if (parts[4]) {
+ ifacename = parts[4];
+ }
+
+ if (ifacename.indexOf(':') > -1) {
+ ifacename = ifacename.split(':')[1].trim();
+ }
+ }
+ if (_darwin || _freebsd || _openbsd || _netbsd || _sunos) {
+ let cmd = '';
+ if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
+ if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
+ if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
+ let result = execSync(cmd);
+ ifacename = result.toString().split('\n')[0];
+ if (ifacename.indexOf(':') > -1) {
+ ifacename = ifacename.split(':')[1].trim();
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ if (ifacename) { _default_iface = ifacename; }
+ return _default_iface;
+}
+
+exports.getDefaultNetworkInterface = getDefaultNetworkInterface;
+
+function getMacAddresses() {
+ let iface = '';
+ let mac = '';
+ let result = {};
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ if (typeof pathToIp === 'undefined') {
+ try {
+ const lines = execSync('which ip').toString().split('\n');
+ if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) {
+ pathToIp = lines[0];
+ } else {
+ pathToIp = '';
+ }
+ } catch (e) {
+ pathToIp = '';
+ }
+ }
+ try {
+ const cmd = 'export LC_ALL=C; ' + ((pathToIp) ? pathToIp + ' link show up' : '/sbin/ifconfig') + '; unset LC_ALL';
+ let res = execSync(cmd);
+ const lines = res.toString().split('\n');
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i] && lines[i][0] !== ' ') {
+ if (pathToIp) {
+ let nextline = lines[i + 1].trim().split(' ');
+ if (nextline[0] === 'link/ether') {
+ iface = lines[i].split(' ')[1];
+ iface = iface.slice(0, iface.length - 1);
+ mac = nextline[1];
+ }
+ } else {
+ iface = lines[i].split(' ')[0];
+ mac = lines[i].split('HWaddr ')[1];
+ }
+
+ if (iface && mac) {
+ result[iface] = mac.trim();
+ iface = '';
+ mac = '';
+ }
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (_darwin) {
+ try {
+ const cmd = '/sbin/ifconfig';
+ let res = execSync(cmd);
+ const lines = res.toString().split('\n');
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) {
+ iface = lines[i].split(':')[0];
+ } else if (lines[i].indexOf('\tether ') === 0) {
+ mac = lines[i].split('\tether ')[1];
+ if (iface && mac) {
+ result[iface] = mac.trim();
+ iface = '';
+ mac = '';
+ }
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ return result;
+}
+
+function networkInterfaceDefault(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = getDefaultNetworkInterface();
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+}
+
+exports.networkInterfaceDefault = networkInterfaceDefault;
+
+// --------------------------
+// NET - interfaces
+
+function parseLinesWindowsNics(sections, nconfigsections) {
+ let nics = [];
+ for (let i in sections) {
+ if ({}.hasOwnProperty.call(sections, i)) {
+
+ if (sections[i].trim() !== '') {
+
+ let lines = sections[i].trim().split('\r\n');
+ let linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : [];
+ let netEnabled = util.getValue(lines, 'NetEnabled', ':');
+ let adapterType = util.getValue(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired';
+ let ifacename = util.getValue(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '(');
+ let iface = util.getValue(lines, 'NetConnectionID', ':').replace(/\]/g, ')').replace(/\[/g, '(');
+ if (ifacename.toLowerCase().indexOf('wi-fi') >= 0 || ifacename.toLowerCase().indexOf('wireless') >= 0) {
+ adapterType = 'wireless';
+ }
+ if (netEnabled !== '') {
+ const speed = parseInt(util.getValue(lines, 'speed', ':').trim(), 10) / 1000000;
+ nics.push({
+ mac: util.getValue(lines, 'MACAddress', ':').toLowerCase(),
+ dhcp: util.getValue(linesNicConfig, 'dhcpEnabled', ':').toLowerCase() === 'true',
+ name: ifacename,
+ iface,
+ netEnabled: netEnabled === 'TRUE',
+ speed: isNaN(speed) ? null : speed,
+ operstate: util.getValue(lines, 'NetConnectionStatus', ':') === '2' ? 'up' : 'down',
+ type: adapterType
+ });
+ }
+ }
+ }
+ }
+ return nics;
+}
+
+function getWindowsNics() {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let cmd = 'Get-CimInstance Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
+ cmd += 'Get-CimInstance Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + '';
+ try {
+ util.powerShell(cmd).then((data) => {
+ data = data.split('#-#-#-#');
+ const nsections = (data[0] || '').split(/\n\s*\n/);
+ const nconfigsections = (data[1] || '').split(/\n\s*\n/);
+ resolve(parseLinesWindowsNics(nsections, nconfigsections));
+ });
+ } catch (e) {
+ resolve([]);
+ }
+ });
+ });
+}
+
+function getWindowsDNSsuffixes() {
+
+ let iface = {};
+
+ let dnsSuffixes = {
+ primaryDNS: '',
+ exitCode: 0,
+ ifaces: [],
+ };
+
+ try {
+ const ipconfig = execSync('ipconfig /all', util.execOptsWin);
+ const ipconfigArray = ipconfig.split('\r\n\r\n');
+
+ ipconfigArray.forEach((element, index) => {
+
+ if (index == 1) {
+ const longPrimaryDNS = element.split('\r\n').filter((element) => {
+ return element.toUpperCase().includes('DNS');
+ });
+ const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(':') + 1);
+ dnsSuffixes.primaryDNS = primaryDNS.trim();
+ if (!dnsSuffixes.primaryDNS) { dnsSuffixes.primaryDNS = 'Not defined'; }
+ }
+ if (index > 1) {
+ if (index % 2 == 0) {
+ const name = element.substring(element.lastIndexOf(' ') + 1).replace(':', '');
+ iface.name = name;
+ } else {
+ const connectionSpecificDNS = element.split('\r\n').filter((element) => {
+ return element.toUpperCase().includes('DNS');
+ });
+ const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(':') + 1);
+ iface.dnsSuffix = dnsSuffix.trim();
+ dnsSuffixes.ifaces.push(iface);
+ iface = {};
+ }
+ }
+ });
+
+ return dnsSuffixes;
+ } catch (error) {
+ return {
+ primaryDNS: '',
+ exitCode: 0,
+ ifaces: [],
+ };
+ }
+}
+
+function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
+ let dnsSuffix = '';
+ // Adding (.) to ensure ifacename compatibility when duplicated iface-names
+ const interfaceName = ifacename + '.';
+ try {
+ const connectionDnsSuffix = ifaces.filter((iface) => {
+ return interfaceName.includes(iface.name + '.');
+ }).map((iface) => iface.dnsSuffix);
+ if (connectionDnsSuffix[0]) {
+ dnsSuffix = connectionDnsSuffix[0];
+ }
+ if (!dnsSuffix) { dnsSuffix = ''; }
+ return dnsSuffix;
+ } catch (error) {
+ return 'Unknown';
+ }
+}
+
+function getWindowsWiredProfilesInformation() {
+ try {
+ const result = execSync('netsh lan show profiles', util.execOptsWin);
+ const profileList = result.split('\r\nProfile on interface');
+ return profileList;
+ } catch (error) {
+ if (error.status === 1 && error.stdout.includes('AutoConfig')) {
+ return 'Disabled';
+ }
+ return [];
+ }
+}
+
+function getWindowsWirelessIfaceSSID(interfaceName) {
+ try {
+ const result = execSync(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, util.execOptsWin);
+ const SSID = result.split('\r\n').shift();
+ const parseSSID = SSID.split(':').pop();
+ return parseSSID;
+ } catch (error) {
+ return 'Unknown';
+ }
+}
+function getWindowsIEEE8021x(connectionType, iface, ifaces) {
+ let i8021x = {
+ state: 'Unknown',
+ protocol: 'Unknown',
+ };
+
+ if (ifaces === 'Disabled') {
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
+ return i8021x;
+ }
+
+ if (connectionType == 'wired' && ifaces.length > 0) {
+ try {
+ // Get 802.1x information by interface name
+ const iface8021xInfo = ifaces.find((element) => {
+ return element.includes(iface + '\r\n');
+ });
+ const arrayIface8021xInfo = iface8021xInfo.split('\r\n');
+ const state8021x = arrayIface8021xInfo.find((element) => {
+ return element.includes('802.1x');
+ });
+
+ if (state8021x.includes('Disabled')) {
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
+ } else if (state8021x.includes('Enabled')) {
+ const protocol8021x = arrayIface8021xInfo.find((element) => {
+ return element.includes('EAP');
+ });
+ i8021x.protocol = protocol8021x.split(':').pop();
+ i8021x.state = 'Enabled';
+ }
+ } catch (error) {
+ return i8021x;
+ }
+ } else if (connectionType == 'wireless') {
+
+ let i8021xState = '';
+ let i8021xProtocol = '';
+
+
+
+ try {
+ const SSID = getWindowsWirelessIfaceSSID(iface);
+ if (SSID !== 'Unknown') {
+ i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin);
+ i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin);
+ }
+
+ if (i8021xState.includes(':') && i8021xProtocol.includes(':')) {
+ i8021x.state = i8021xState.split(':').pop();
+ i8021x.protocol = i8021xProtocol.split(':').pop();
+ }
+ } catch (error) {
+ if (error.status === 1 && error.stdout.includes('AutoConfig')) {
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
+ }
+ return i8021x;
+ }
+ }
+
+ return i8021x;
+}
+
+function splitSectionsNics(lines) {
+ const result = [];
+ let section = [];
+ lines.forEach(function (line) {
+ if (!line.startsWith('\t') && !line.startsWith(' ')) {
+ if (section.length) {
+ result.push(section);
+ section = [];
+ }
+ }
+ section.push(line);
+ });
+ if (section.length) {
+ result.push(section);
+ }
+ return result;
+}
+
+function parseLinesDarwinNics(sections) {
+ let nics = [];
+ sections.forEach(section => {
+ let nic = {
+ iface: '',
+ mtu: null,
+ mac: '',
+ ip6: '',
+ ip4: '',
+ speed: null,
+ type: '',
+ operstate: '',
+ duplex: '',
+ internal: false
+ };
+ const first = section[0];
+ nic.iface = first.split(':')[0].trim();
+ let parts = first.split('> mtu');
+ nic.mtu = parts.length > 1 ? parseInt(parts[1], 10) : null;
+ if (isNaN(nic.mtu)) {
+ nic.mtu = null;
+ }
+ nic.internal = parts[0].toLowerCase().indexOf('loopback') > -1;
+ section.forEach(line => {
+ if (line.trim().startsWith('ether ')) {
+ nic.mac = line.split('ether ')[1].toLowerCase().trim();
+ }
+ if (line.trim().startsWith('inet6 ') && !nic.ip6) {
+ nic.ip6 = line.split('inet6 ')[1].toLowerCase().split('%')[0].split(' ')[0];
+ }
+ if (line.trim().startsWith('inet ') && !nic.ip4) {
+ nic.ip4 = line.split('inet ')[1].toLowerCase().split(' ')[0];
+ }
+ });
+ let speed = util.getValue(section, 'link rate');
+ nic.speed = speed ? parseFloat(speed) : null;
+ if (nic.speed === null) {
+ speed = util.getValue(section, 'uplink rate');
+ nic.speed = speed ? parseFloat(speed) : null;
+ if (nic.speed !== null && speed.toLowerCase().indexOf('gbps') >= 0) {
+ nic.speed = nic.speed * 1000;
+ }
+ } else {
+ if (speed.toLowerCase().indexOf('gbps') >= 0) {
+ nic.speed = nic.speed * 1000;
+ }
+ }
+ nic.type = util.getValue(section, 'type').toLowerCase().indexOf('wi-fi') > -1 ? 'wireless' : 'wired';
+ const operstate = util.getValue(section, 'status').toLowerCase();
+ nic.operstate = (operstate === 'active' ? 'up' : (operstate === 'inactive' ? 'down' : 'unknown'));
+ nic.duplex = util.getValue(section, 'media').toLowerCase().indexOf('half-duplex') > -1 ? 'half' : 'full';
+ if (nic.ip6 || nic.ip4 || nic.mac) {
+ nics.push(nic);
+ }
+ });
+ return nics;
+}
+
+function getDarwinNics() {
+ const cmd = '/sbin/ifconfig -v';
+ try {
+ const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
+ const nsections = splitSectionsNics(lines);
+ return (parseLinesDarwinNics(nsections));
+ } catch (e) {
+ return [];
+ }
+}
+
+function getLinuxIfaceConnectionName(interfaceName) {
+ const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`;
+
+ try {
+ const result = execSync(cmd).toString();
+ const resultFormat = result.replace(/\s+/g, ' ').trim();
+ const connectionNameLines = resultFormat.split(' ').slice(3);
+ const connectionName = connectionNameLines.join(' ');
+ return connectionName != '--' ? connectionName : '';
+ } catch (e) {
+ return '';
+ }
+}
+
+function checkLinuxDCHPInterfaces(file) {
+ let result = [];
+ try {
+ let cmd = `cat ${file} 2> /dev/null | grep 'iface\\|source'`;
+ const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
+
+ lines.forEach(line => {
+ const parts = line.replace(/\s+/g, ' ').trim().split(' ');
+ if (parts.length >= 4) {
+ if (line.toLowerCase().indexOf(' inet ') >= 0 && line.toLowerCase().indexOf('dhcp') >= 0) {
+ result.push(parts[1]);
+ }
+ }
+ if (line.toLowerCase().includes('source')) {
+ let file = line.split(' ')[1];
+ result = result.concat(checkLinuxDCHPInterfaces(file));
+ }
+ });
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function getLinuxDHCPNics() {
+ // alternate methods getting interfaces using DHCP
+ let cmd = 'ip a 2> /dev/null';
+ let result = [];
+ try {
+ const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
+ const nsections = splitSectionsNics(lines);
+ result = (parseLinuxDHCPNics(nsections));
+ } catch (e) {
+ util.noop();
+ }
+ try {
+ result = checkLinuxDCHPInterfaces('/etc/network/interfaces');
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function parseLinuxDHCPNics(sections) {
+ const result = [];
+ if (sections && sections.length) {
+ sections.forEach(lines => {
+ if (lines && lines.length) {
+ const parts = lines[0].split(':');
+ if (parts.length > 2) {
+ for (let line of lines) {
+ if (line.indexOf(' inet ') >= 0 && line.indexOf(' dynamic ') >= 0) {
+ const parts2 = line.split(' ');
+ const nic = parts2[parts2.length - 1].trim();
+ result.push(nic);
+ break;
+ }
+ }
+ }
+ }
+ });
+ }
+ return result;
+}
+
+function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
+ let result = false;
+ if (connectionName) {
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.method;`;
+ try {
+ const lines = execSync(cmd).toString();
+ const resultFormat = lines.replace(/\s+/g, ' ').trim();
+
+ let dhcStatus = resultFormat.split(' ').slice(1).toString();
+ switch (dhcStatus) {
+ case 'auto':
+ result = true;
+ break;
+
+ default:
+ result = false;
+ break;
+ }
+ return result;
+ } catch (e) {
+ return (DHCPNics.indexOf(iface) >= 0);
+ }
+ } else {
+ return (DHCPNics.indexOf(iface) >= 0);
+ }
+}
+
+function getDarwinIfaceDHCPstatus(iface) {
+ let result = false;
+ const cmd = `ipconfig getpacket "${iface}" 2>/dev/null | grep lease_time;`;
+ try {
+ const lines = execSync(cmd).toString().split('\n');
+ if (lines.length && lines[0].startsWith('lease_time')) {
+ result = true;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+function getLinuxIfaceDNSsuffix(connectionName) {
+ if (connectionName) {
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.dns-search;`;
+ try {
+ const result = execSync(cmd).toString();
+ const resultFormat = result.replace(/\s+/g, ' ').trim();
+ const dnsSuffix = resultFormat.split(' ').slice(1).toString();
+ return dnsSuffix == '--' ? 'Not defined' : dnsSuffix;
+ } catch (e) {
+ return 'Unknown';
+ }
+ } else {
+ return 'Unknown';
+ }
+}
+
+function getLinuxIfaceIEEE8021xAuth(connectionName) {
+ if (connectionName) {
+ const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep 802-1x.eap;`;
+ try {
+ const result = execSync(cmd).toString();
+ const resultFormat = result.replace(/\s+/g, ' ').trim();
+ const authenticationProtocol = resultFormat.split(' ').slice(1).toString();
+
+
+ return authenticationProtocol == '--' ? '' : authenticationProtocol;
+ } catch (e) {
+ return 'Not defined';
+ }
+ } else {
+ return 'Not defined';
+ }
+}
+
+function getLinuxIfaceIEEE8021xState(authenticationProtocol) {
+ if (authenticationProtocol) {
+ if (authenticationProtocol == 'Not defined') {
+ return 'Disabled';
+ }
+ return 'Enabled';
+ } else {
+ return 'Unknown';
+ }
+}
+
+function testVirtualNic(iface, ifaceName, mac) {
+ const virtualMacs = ['00:00:00:00:00:00', '00:03:FF', '00:05:69', '00:0C:29', '00:0F:4B', '00:13:07', '00:13:BE', '00:15:5d', '00:16:3E', '00:1C:42', '00:21:F6', '00:24:0B', '00:50:56', '00:A0:B1', '00:E0:C8', '08:00:27', '0A:00:27', '18:92:2C', '16:DF:49', '3C:F3:92', '54:52:00', 'FC:15:97'];
+ if (mac) {
+ return virtualMacs.filter(item => { return mac.toUpperCase().toUpperCase().startsWith(item.substring(0, mac.length)); }).length > 0 ||
+ iface.toLowerCase().indexOf(' virtual ') > -1 ||
+ ifaceName.toLowerCase().indexOf(' virtual ') > -1 ||
+ iface.toLowerCase().indexOf('vethernet ') > -1 ||
+ ifaceName.toLowerCase().indexOf('vethernet ') > -1 ||
+ iface.toLowerCase().startsWith('veth') ||
+ ifaceName.toLowerCase().startsWith('veth') ||
+ iface.toLowerCase().startsWith('vboxnet') ||
+ ifaceName.toLowerCase().startsWith('vboxnet');
+ } else { return false; }
+}
+
+function networkInterfaces(callback, rescan, defaultString) {
+
+ if (typeof callback === 'string') {
+ defaultString = callback;
+ rescan = true;
+ callback = null;
+ }
+
+ if (typeof callback === 'boolean') {
+ rescan = callback;
+ callback = null;
+ defaultString = '';
+ }
+ if (typeof rescan === 'undefined') {
+ rescan = true;
+ }
+ defaultString = defaultString || '';
+ defaultString = '' + defaultString;
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let ifaces = os.networkInterfaces();
+
+ let result = [];
+ let nics = [];
+ let dnsSuffixes = [];
+ let nics8021xInfo = [];
+ // seperate handling in OSX
+ if (_darwin || _freebsd || _openbsd || _netbsd) {
+ if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
+ // no changes - just return object
+ result = _networkInterfaces;
+
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ const defaultInterface = getDefaultNetworkInterface();
+ _ifaces = JSON.parse(JSON.stringify(ifaces));
+
+ nics = getDarwinNics();
+
+
+ nics.forEach(nic => {
+
+ if ({}.hasOwnProperty.call(ifaces, nic.iface)) {
+ ifaces[nic.iface].forEach(function (details) {
+ if (details.family === 'IPv4' || details.family === 4) {
+ nic.ip4subnet = details.netmask;
+ }
+ if (details.family === 'IPv6' || details.family === 6) {
+ nic.ip6subnet = details.netmask;
+ }
+ });
+ }
+
+ let ifaceSanitized = '';
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(nic.iface);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ ifaceSanitized = ifaceSanitized + s[i];
+ }
+ }
+
+ result.push({
+ iface: nic.iface,
+ ifaceName: nic.iface,
+ default: nic.iface === defaultInterface,
+ ip4: nic.ip4,
+ ip4subnet: nic.ip4subnet || '',
+ ip6: nic.ip6,
+ ip6subnet: nic.ip6subnet || '',
+ mac: nic.mac,
+ internal: nic.internal,
+ virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac),
+ operstate: nic.operstate,
+ type: nic.type,
+ duplex: nic.duplex,
+ mtu: nic.mtu,
+ speed: nic.speed,
+ dhcp: getDarwinIfaceDHCPstatus(ifaceSanitized),
+ dnsSuffix: '',
+ ieee8021xAuth: '',
+ ieee8021xState: '',
+ carrierChanges: 0
+ });
+ });
+ _networkInterfaces = result;
+ if (defaultString.toLowerCase().indexOf('default') >= 0) {
+ result = result.filter(item => item.default);
+ if (result.length > 0) {
+ result = result[0];
+ } else {
+ result = [];
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_linux) {
+ if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
+ // no changes - just return object
+ result = _networkInterfaces;
+
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ _ifaces = JSON.parse(JSON.stringify(ifaces));
+ _dhcpNics = getLinuxDHCPNics();
+ const defaultInterface = getDefaultNetworkInterface();
+ for (let dev in ifaces) {
+ let ip4 = '';
+ let ip4subnet = '';
+ let ip6 = '';
+ let ip6subnet = '';
+ let mac = '';
+ let duplex = '';
+ let mtu = '';
+ let speed = null;
+ let carrierChanges = 0;
+ let dhcp = false;
+ let dnsSuffix = '';
+ let ieee8021xAuth = '';
+ let ieee8021xState = '';
+ let type = '';
+
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
+ let ifaceName = dev;
+ ifaces[dev].forEach(function (details) {
+ if (details.family === 'IPv4' || details.family === 4) {
+ ip4 = details.address;
+ ip4subnet = details.netmask;
+ }
+ if (details.family === 'IPv6' || details.family === 6) {
+ if (!ip6 || ip6.match(/^fe80::/i)) {
+ ip6 = details.address;
+ ip6subnet = details.netmask;
+ }
+ }
+ mac = details.mac;
+ // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
+ const nodeMainVersion = parseInt(process.versions.node.split('.'), 10);
+ if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) {
+ if (Object.keys(_mac).length === 0) {
+ _mac = getMacAddresses();
+ }
+ mac = _mac[dev] || '';
+ }
+ });
+ let iface = dev.split(':')[0].trim().toLowerCase();
+ let ifaceSanitized = '';
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ ifaceSanitized = ifaceSanitized + s[i];
+ }
+ }
+ const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${ifaceSanitized}/addr_assign_type 2>/dev/null; echo;
+ echo -n "address: "; cat /sys/class/net/${ifaceSanitized}/address 2>/dev/null; echo;
+ echo -n "addr_len: "; cat /sys/class/net/${ifaceSanitized}/addr_len 2>/dev/null; echo;
+ echo -n "broadcast: "; cat /sys/class/net/${ifaceSanitized}/broadcast 2>/dev/null; echo;
+ echo -n "carrier: "; cat /sys/class/net/${ifaceSanitized}/carrier 2>/dev/null; echo;
+ echo -n "carrier_changes: "; cat /sys/class/net/${ifaceSanitized}/carrier_changes 2>/dev/null; echo;
+ echo -n "dev_id: "; cat /sys/class/net/${ifaceSanitized}/dev_id 2>/dev/null; echo;
+ echo -n "dev_port: "; cat /sys/class/net/${ifaceSanitized}/dev_port 2>/dev/null; echo;
+ echo -n "dormant: "; cat /sys/class/net/${ifaceSanitized}/dormant 2>/dev/null; echo;
+ echo -n "duplex: "; cat /sys/class/net/${ifaceSanitized}/duplex 2>/dev/null; echo;
+ echo -n "flags: "; cat /sys/class/net/${ifaceSanitized}/flags 2>/dev/null; echo;
+ echo -n "gro_flush_timeout: "; cat /sys/class/net/${ifaceSanitized}/gro_flush_timeout 2>/dev/null; echo;
+ echo -n "ifalias: "; cat /sys/class/net/${ifaceSanitized}/ifalias 2>/dev/null; echo;
+ echo -n "ifindex: "; cat /sys/class/net/${ifaceSanitized}/ifindex 2>/dev/null; echo;
+ echo -n "iflink: "; cat /sys/class/net/${ifaceSanitized}/iflink 2>/dev/null; echo;
+ echo -n "link_mode: "; cat /sys/class/net/${ifaceSanitized}/link_mode 2>/dev/null; echo;
+ echo -n "mtu: "; cat /sys/class/net/${ifaceSanitized}/mtu 2>/dev/null; echo;
+ echo -n "netdev_group: "; cat /sys/class/net/${ifaceSanitized}/netdev_group 2>/dev/null; echo;
+ echo -n "operstate: "; cat /sys/class/net/${ifaceSanitized}/operstate 2>/dev/null; echo;
+ echo -n "proto_down: "; cat /sys/class/net/${ifaceSanitized}/proto_down 2>/dev/null; echo;
+ echo -n "speed: "; cat /sys/class/net/${ifaceSanitized}/speed 2>/dev/null; echo;
+ echo -n "tx_queue_len: "; cat /sys/class/net/${ifaceSanitized}/tx_queue_len 2>/dev/null; echo;
+ echo -n "type: "; cat /sys/class/net/${ifaceSanitized}/type 2>/dev/null; echo;
+ echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${ifaceSanitized}; echo;
+ echo -n "wirelessspeed: "; iw dev ${ifaceSanitized} link 2>&1 | grep bitrate; echo;`;
+
+ let lines = [];
+ try {
+ lines = execSync(cmd).toString().split('\n');
+ const connectionName = getLinuxIfaceConnectionName(ifaceSanitized);
+ dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, connectionName, _dhcpNics);
+ dnsSuffix = getLinuxIfaceDNSsuffix(connectionName);
+ ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(connectionName);
+ ieee8021xState = getLinuxIfaceIEEE8021xState(ieee8021xAuth);
+ } catch (e) {
+ util.noop();
+ }
+ duplex = util.getValue(lines, 'duplex');
+ duplex = duplex.startsWith('cat') ? '' : duplex;
+ mtu = parseInt(util.getValue(lines, 'mtu'), 10);
+ let myspeed = parseInt(util.getValue(lines, 'speed'), 10);
+ speed = isNaN(myspeed) ? null : myspeed;
+ let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: ');
+ if (speed === null && wirelessspeed.length === 2) {
+ myspeed = parseFloat(wirelessspeed[1]);
+ speed = isNaN(myspeed) ? null : myspeed;
+ }
+ carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
+ const operstate = util.getValue(lines, 'operstate');
+ type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
+ if (ifaceSanitized === 'lo' || ifaceSanitized.startsWith('bond')) { type = 'virtual'; }
+
+ let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false;
+ if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) {
+ internal = true;
+ }
+ const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac);
+ result.push({
+ iface: ifaceSanitized,
+ ifaceName,
+ default: iface === defaultInterface,
+ ip4,
+ ip4subnet,
+ ip6,
+ ip6subnet,
+ mac,
+ internal,
+ virtual,
+ operstate,
+ type,
+ duplex,
+ mtu,
+ speed,
+ dhcp,
+ dnsSuffix,
+ ieee8021xAuth,
+ ieee8021xState,
+ carrierChanges,
+ });
+ }
+ }
+ _networkInterfaces = result;
+ if (defaultString.toLowerCase().indexOf('default') >= 0) {
+ result = result.filter(item => item.default);
+ if (result.length > 0) {
+ result = result[0];
+ } else {
+ result = [];
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_windows) {
+ if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
+ // no changes - just return object
+ result = _networkInterfaces;
+
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ _ifaces = JSON.parse(JSON.stringify(ifaces));
+ const defaultInterface = getDefaultNetworkInterface();
+
+ getWindowsNics().then(function (nics) {
+ nics.forEach(nic => {
+ let found = false;
+ Object.keys(ifaces).forEach(key => {
+ if (!found) {
+ ifaces[key].forEach(value => {
+ if (Object.keys(value).indexOf('mac') >= 0) {
+ found = value['mac'] === nic.mac;
+ }
+ });
+ }
+ });
+
+ if (!found) {
+ ifaces[nic.name] = [{ mac: nic.mac }];
+ }
+ });
+ nics8021xInfo = getWindowsWiredProfilesInformation();
+ dnsSuffixes = getWindowsDNSsuffixes();
+ for (let dev in ifaces) {
+
+ let ifaceSanitized = '';
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(dev);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ ifaceSanitized = ifaceSanitized + s[i];
+ }
+ }
+
+ let iface = dev;
+ let ip4 = '';
+ let ip4subnet = '';
+ let ip6 = '';
+ let ip6subnet = '';
+ let mac = '';
+ let duplex = '';
+ let mtu = '';
+ let speed = null;
+ let carrierChanges = 0;
+ let operstate = 'down';
+ let dhcp = false;
+ let dnsSuffix = '';
+ let ieee8021xAuth = '';
+ let ieee8021xState = '';
+ let type = '';
+
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
+ let ifaceName = dev;
+ ifaces[dev].forEach(function (details) {
+ if (details.family === 'IPv4' || details.family === 4) {
+ ip4 = details.address;
+ ip4subnet = details.netmask;
+ }
+ if (details.family === 'IPv6' || details.family === 6) {
+ if (!ip6 || ip6.match(/^fe80::/i)) {
+ ip6 = details.address;
+ ip6subnet = details.netmask;
+ }
+ }
+ mac = details.mac;
+ // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
+ const nodeMainVersion = parseInt(process.versions.node.split('.'), 10);
+ if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) {
+ if (Object.keys(_mac).length === 0) {
+ _mac = getMacAddresses();
+ }
+ mac = _mac[dev] || '';
+ }
+ });
+
+
+
+ dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.ifaces, ifaceSanitized);
+ let foundFirst = false;
+ nics.forEach(detail => {
+ if (detail.mac === mac && !foundFirst) {
+ iface = detail.iface || iface;
+ ifaceName = detail.name;
+ dhcp = detail.dhcp;
+ operstate = detail.operstate;
+ speed = detail.speed;
+ type = detail.type;
+ foundFirst = true;
+ }
+ });
+
+ if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('802.11n') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0 || ifaceName.toLowerCase().indexOf('wi-fi') >= 0 || ifaceName.toLowerCase().indexOf('wifi') >= 0) {
+ type = 'wireless';
+ }
+
+ const IEEE8021x = getWindowsIEEE8021x(type, ifaceSanitized, nics8021xInfo);
+ ieee8021xAuth = IEEE8021x.protocol;
+ ieee8021xState = IEEE8021x.state;
+ let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false;
+ if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) {
+ internal = true;
+ }
+ const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac);
+ result.push({
+ iface,
+ ifaceName,
+ default: iface === defaultInterface,
+ ip4,
+ ip4subnet,
+ ip6,
+ ip6subnet,
+ mac,
+ internal,
+ virtual,
+ operstate,
+ type,
+ duplex,
+ mtu,
+ speed,
+ dhcp,
+ dnsSuffix,
+ ieee8021xAuth,
+ ieee8021xState,
+ carrierChanges,
+ });
+ }
+ }
+ _networkInterfaces = result;
+ if (defaultString.toLowerCase().indexOf('default') >= 0) {
+ result = result.filter(item => item.default);
+ if (result.length > 0) {
+ result = result[0];
+ } else {
+ result = [];
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ }
+ });
+ });
+}
+
+exports.networkInterfaces = networkInterfaces;
+
+// --------------------------
+// NET - Speed
+
+function calcNetworkSpeed(iface, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors) {
+ let result = {
+ iface,
+ operstate,
+ rx_bytes,
+ rx_dropped,
+ rx_errors,
+ tx_bytes,
+ tx_dropped,
+ tx_errors,
+ rx_sec: null,
+ tx_sec: null,
+ ms: 0
+ };
+
+ if (_network[iface] && _network[iface].ms) {
+ result.ms = Date.now() - _network[iface].ms;
+ result.rx_sec = (rx_bytes - _network[iface].rx_bytes) >= 0 ? (rx_bytes - _network[iface].rx_bytes) / (result.ms / 1000) : 0;
+ result.tx_sec = (tx_bytes - _network[iface].tx_bytes) >= 0 ? (tx_bytes - _network[iface].tx_bytes) / (result.ms / 1000) : 0;
+ _network[iface].rx_bytes = rx_bytes;
+ _network[iface].tx_bytes = tx_bytes;
+ _network[iface].rx_sec = result.rx_sec;
+ _network[iface].tx_sec = result.tx_sec;
+ _network[iface].ms = Date.now();
+ _network[iface].last_ms = result.ms;
+ _network[iface].operstate = operstate;
+ } else {
+ if (!_network[iface]) { _network[iface] = {}; }
+ _network[iface].rx_bytes = rx_bytes;
+ _network[iface].tx_bytes = tx_bytes;
+ _network[iface].rx_sec = null;
+ _network[iface].tx_sec = null;
+ _network[iface].ms = Date.now();
+ _network[iface].last_ms = 0;
+ _network[iface].operstate = operstate;
+ }
+ return result;
+}
+
+function networkStats(ifaces, callback) {
+
+ let ifacesArray = [];
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ // fallback - if only callback is given
+ if (util.isFunction(ifaces) && !callback) {
+ callback = ifaces;
+ ifacesArray = [getDefaultNetworkInterface()];
+ } else {
+ if (typeof ifaces !== 'string' && ifaces !== undefined) {
+ if (callback) { callback([]); }
+ return resolve([]);
+ }
+ ifaces = ifaces || getDefaultNetworkInterface();
+
+ ifaces.__proto__.toLowerCase = util.stringToLower;
+ ifaces.__proto__.replace = util.stringReplace;
+ ifaces.__proto__.trim = util.stringTrim;
+
+ ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|');
+ ifacesArray = ifaces.split('|');
+ }
+
+ const result = [];
+
+ const workload = [];
+ if (ifacesArray.length && ifacesArray[0].trim() === '*') {
+ ifacesArray = [];
+ networkInterfaces(false).then(allIFaces => {
+ for (let iface of allIFaces) {
+ ifacesArray.push(iface.iface);
+ }
+ networkStats(ifacesArray.join(',')).then(result => {
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ });
+ } else {
+ for (let iface of ifacesArray) {
+ workload.push(networkStatsSingle(iface.trim()));
+ }
+ if (workload.length) {
+ Promise.all(
+ workload
+ ).then((data) => {
+ if (callback) { callback(data); }
+ resolve(data);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+function networkStatsSingle(iface) {
+
+ function parseLinesWindowsPerfData(sections) {
+ let perfData = [];
+ for (let i in sections) {
+ if ({}.hasOwnProperty.call(sections, i)) {
+ if (sections[i].trim() !== '') {
+ let lines = sections[i].trim().split('\r\n');
+ perfData.push({
+ name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase(),
+ rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10),
+ rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10),
+ rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10),
+ tx_bytes: parseInt(util.getValue(lines, 'BytesSentPersec', ':'), 10),
+ tx_errors: parseInt(util.getValue(lines, 'PacketsOutboundErrors', ':'), 10),
+ tx_dropped: parseInt(util.getValue(lines, 'PacketsOutboundDiscarded', ':'), 10)
+ });
+ }
+ }
+ }
+ return perfData;
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let ifaceSanitized = '';
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ ifaceSanitized = ifaceSanitized + s[i];
+ }
+ }
+
+ let result = {
+ iface: ifaceSanitized,
+ operstate: 'unknown',
+ rx_bytes: 0,
+ rx_dropped: 0,
+ rx_errors: 0,
+ tx_bytes: 0,
+ tx_dropped: 0,
+ tx_errors: 0,
+ rx_sec: null,
+ tx_sec: null,
+ ms: 0
+ };
+
+ let operstate = 'unknown';
+ let rx_bytes = 0;
+ let tx_bytes = 0;
+ let rx_dropped = 0;
+ let rx_errors = 0;
+ let tx_dropped = 0;
+ let tx_errors = 0;
+
+ let cmd, lines, stats;
+ if (!_network[ifaceSanitized] || (_network[ifaceSanitized] && !_network[ifaceSanitized].ms) || (_network[ifaceSanitized] && _network[ifaceSanitized].ms && Date.now() - _network[ifaceSanitized].ms >= 500)) {
+ if (_linux) {
+ if (fs.existsSync('/sys/class/net/' + ifaceSanitized)) {
+ cmd =
+ 'cat /sys/class/net/' + ifaceSanitized + '/operstate; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_bytes; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_bytes; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_dropped; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_errors; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_dropped; ' +
+ 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_errors; ';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ lines = stdout.toString().split('\n');
+ operstate = lines[0].trim();
+ rx_bytes = parseInt(lines[1], 10);
+ tx_bytes = parseInt(lines[2], 10);
+ rx_dropped = parseInt(lines[3], 10);
+ rx_errors = parseInt(lines[4], 10);
+ tx_dropped = parseInt(lines[5], 10);
+ tx_errors = parseInt(lines[6], 10);
+
+ result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors);
+
+ }
+ resolve(result);
+ });
+ } else {
+ resolve(result);
+ }
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ cmd = 'netstat -ibndI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input]
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ lines = stdout.toString().split('\n');
+ for (let i = 1; i < lines.length; i++) {
+ const line = lines[i].replace(/ +/g, ' ').split(' ');
+ if (line && line[0] && line[7] && line[10]) {
+ rx_bytes = rx_bytes + parseInt(line[7]);
+ if (line[6].trim() !== '-') { rx_dropped = rx_dropped + parseInt(line[6]); }
+ if (line[5].trim() !== '-') { rx_errors = rx_errors + parseInt(line[5]); }
+ tx_bytes = tx_bytes + parseInt(line[10]);
+ if (line[12].trim() !== '-') { tx_dropped = tx_dropped + parseInt(line[12]); }
+ if (line[9].trim() !== '-') { tx_errors = tx_errors + parseInt(line[9]); }
+ operstate = 'up';
+ }
+ }
+ result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors);
+ }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ cmd = 'ifconfig ' + ifaceSanitized + ' | grep "status"'; // lgtm [js/shell-command-constructed-from-input]
+ exec(cmd, function (error, stdout) {
+ result.operstate = (stdout.toString().split(':')[1] || '').trim();
+ result.operstate = (result.operstate || '').toLowerCase();
+ result.operstate = (result.operstate === 'active' ? 'up' : (result.operstate === 'inactive' ? 'down' : 'unknown'));
+ cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input]
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ lines = stdout.toString().split('\n');
+ // if there is less than 2 lines, no information for this interface was found
+ if (lines.length > 1 && lines[1].trim() !== '') {
+ // skip header line
+ // use the second line because it is tied to the NIC instead of the ipv4 or ipv6 address
+ stats = lines[1].replace(/ +/g, ' ').split(' ');
+ const offset = stats.length > 11 ? 1 : 0;
+ rx_bytes = parseInt(stats[offset + 5]);
+ rx_dropped = parseInt(stats[offset + 10]);
+ rx_errors = parseInt(stats[offset + 4]);
+ tx_bytes = parseInt(stats[offset + 8]);
+ tx_dropped = parseInt(stats[offset + 10]);
+ tx_errors = parseInt(stats[offset + 7]);
+ result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, result.operstate, rx_dropped, rx_errors, tx_dropped, tx_errors);
+ }
+ }
+ resolve(result);
+ });
+ });
+ }
+ if (_windows) {
+ let perfData = [];
+ let ifaceName = ifaceSanitized;
+
+ // Performance Data
+ util.powerShell('Get-CimInstance Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl').then((stdout, error) => {
+ if (!error) {
+ const psections = stdout.toString().split(/\n\s*\n/);
+ perfData = parseLinesWindowsPerfData(psections);
+ }
+
+ // Network Interfaces
+ networkInterfaces(false).then(interfaces => {
+ // get bytes sent, received from perfData by name
+ rx_bytes = 0;
+ tx_bytes = 0;
+ perfData.forEach(detail => {
+ interfaces.forEach(det => {
+ if ((det.iface.toLowerCase() === ifaceSanitized.toLowerCase() ||
+ det.mac.toLowerCase() === ifaceSanitized.toLowerCase() ||
+ det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() ||
+ det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() ||
+ det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) &&
+ (det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === detail.name)) {
+ ifaceName = det.iface;
+ rx_bytes = detail.rx_bytes;
+ rx_dropped = detail.rx_dropped;
+ rx_errors = detail.rx_errors;
+ tx_bytes = detail.tx_bytes;
+ tx_dropped = detail.tx_dropped;
+ tx_errors = detail.tx_errors;
+ operstate = det.operstate;
+ }
+ });
+ });
+ if (rx_bytes && tx_bytes) {
+ result = calcNetworkSpeed(ifaceName, parseInt(rx_bytes), parseInt(tx_bytes), operstate, rx_dropped, rx_errors, tx_dropped, tx_errors);
+ }
+ resolve(result);
+ });
+ });
+ }
+ } else {
+ result.rx_bytes = _network[ifaceSanitized].rx_bytes;
+ result.tx_bytes = _network[ifaceSanitized].tx_bytes;
+ result.rx_sec = _network[ifaceSanitized].rx_sec;
+ result.tx_sec = _network[ifaceSanitized].tx_sec;
+ result.ms = _network[ifaceSanitized].last_ms;
+ result.operstate = _network[ifaceSanitized].operstate;
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.networkStats = networkStats;
+
+// --------------------------
+// NET - connections (sockets)
+
+function getProcessName(processes, pid) {
+ let cmd = '';
+ processes.forEach(line => {
+ const parts = line.split(' ');
+ const id = parseInt(parts[0], 10) || -1;
+ if (id === pid) {
+ parts.shift();
+ cmd = parts.join(' ').split(':')[0];
+ }
+ });
+ cmd = cmd.split(' -')[0];
+ // return cmd;
+ const cmdParts = cmd.split('/');
+ return cmdParts[cmdParts.length - 1];
+}
+
+function networkConnections(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ let cmd = 'export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';
+ if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; }
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ if (!error && (lines.length > 1 || lines[0] != '')) {
+ lines.forEach(function (line) {
+ line = line.replace(/ +/g, ' ').split(' ');
+ if (line.length >= 7) {
+ let localip = line[3];
+ let localport = '';
+ let localaddress = line[3].split(':');
+ if (localaddress.length > 1) {
+ localport = localaddress[localaddress.length - 1];
+ localaddress.pop();
+ localip = localaddress.join(':');
+ }
+ let peerip = line[4];
+ let peerport = '';
+ let peeraddress = line[4].split(':');
+ if (peeraddress.length > 1) {
+ peerport = peeraddress[peeraddress.length - 1];
+ peeraddress.pop();
+ peerip = peeraddress.join(':');
+ }
+ let connstate = line[5];
+ let proc = line[6].split('/');
+
+ if (connstate) {
+ result.push({
+ protocol: line[0],
+ localAddress: localip,
+ localPort: localport,
+ peerAddress: peerip,
+ peerPort: peerport,
+ state: connstate,
+ pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null,
+ process: proc[1] ? proc[1].split(' ')[0].split(':')[0] : ''
+ });
+ }
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else {
+ cmd = 'ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"';
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ line = line.replace(/ +/g, ' ').split(' ');
+ if (line.length >= 6) {
+ let localip = line[4];
+ let localport = '';
+ let localaddress = line[4].split(':');
+ if (localaddress.length > 1) {
+ localport = localaddress[localaddress.length - 1];
+ localaddress.pop();
+ localip = localaddress.join(':');
+ }
+ let peerip = line[5];
+ let peerport = '';
+ let peeraddress = line[5].split(':');
+ if (peeraddress.length > 1) {
+ peerport = peeraddress[peeraddress.length - 1];
+ peeraddress.pop();
+ peerip = peeraddress.join(':');
+ }
+ let connstate = line[1];
+ if (connstate === 'ESTAB') { connstate = 'ESTABLISHED'; }
+ if (connstate === 'TIME-WAIT') { connstate = 'TIME_WAIT'; }
+ let pid = null;
+ let process = '';
+ if (line.length >= 7 && line[6].indexOf('users:') > -1) {
+ let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(',');
+ if (proc.length > 2) {
+ process = proc[0].split(' ')[0].split(':')[0];
+ pid = parseInt(proc[1], 10);
+ }
+ }
+ if (connstate) {
+ result.push({
+ protocol: line[0],
+ localAddress: localip,
+ localPort: localport,
+ peerAddress: peerip,
+ peerPort: peerport,
+ state: connstate,
+ pid,
+ process
+ });
+ }
+ }
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ });
+ }
+ if (_darwin) {
+ // let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"';
+ let cmd = 'netstat -natv | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
+ const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ if (!error) {
+ exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
+ let processes = stdout2.toString().split('\n');
+ processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
+ let lines = stdout.toString().split('\n');
+
+ lines.forEach(function (line) {
+ line = line.replace(/ +/g, ' ').split(' ');
+ if (line.length >= 8) {
+ let localip = line[3];
+ let localport = '';
+ let localaddress = line[3].split('.');
+ if (localaddress.length > 1) {
+ localport = localaddress[localaddress.length - 1];
+ localaddress.pop();
+ localip = localaddress.join('.');
+ }
+ let peerip = line[4];
+ let peerport = '';
+ let peeraddress = line[4].split('.');
+ if (peeraddress.length > 1) {
+ peerport = peeraddress[peeraddress.length - 1];
+ peeraddress.pop();
+ peerip = peeraddress.join('.');
+ }
+ const hasState = states.indexOf(line[5]) >= 0;
+ let connstate = hasState ? line[5] : 'UNKNOWN';
+ let pid = parseInt(line[8 + (hasState ? 0 : -1)], 10);
+ if (connstate) {
+ result.push({
+ protocol: line[0],
+ localAddress: localip,
+ localPort: localport,
+ peerAddress: peerip,
+ peerPort: peerport,
+ state: connstate,
+ pid: pid,
+ process: getProcessName(processes, pid)
+ });
+ }
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+
+ }
+ });
+ }
+ if (_windows) {
+ let cmd = 'netstat -nao';
+ try {
+ exec(cmd, util.execOptsWin, function (error, stdout) {
+ if (!error) {
+
+ let lines = stdout.toString().split('\r\n');
+
+ lines.forEach(function (line) {
+ line = line.trim().replace(/ +/g, ' ').split(' ');
+ if (line.length >= 4) {
+ let localip = line[1];
+ let localport = '';
+ let localaddress = line[1].split(':');
+ if (localaddress.length > 1) {
+ localport = localaddress[localaddress.length - 1];
+ localaddress.pop();
+ localip = localaddress.join(':');
+ }
+ localip = localip.replace(/\[/g, '').replace(/\]/g, '');
+ let peerip = line[2];
+ let peerport = '';
+ let peeraddress = line[2].split(':');
+ if (peeraddress.length > 1) {
+ peerport = peeraddress[peeraddress.length - 1];
+ peeraddress.pop();
+ peerip = peeraddress.join(':');
+ }
+ peerip = peerip.replace(/\[/g, '').replace(/\]/g, '');
+ let pid = util.toInt(line[4]);
+ let connstate = line[3];
+ if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; }
+ if (connstate.startsWith('ABH')) { connstate = 'LISTEN'; }
+ if (connstate === 'SCHLIESSEN_WARTEN') { connstate = 'CLOSE_WAIT'; }
+ if (connstate === 'WARTEND') { connstate = 'TIME_WAIT'; }
+ if (connstate === 'SYN_GESENDET') { connstate = 'SYN_SENT'; }
+
+ if (connstate === 'LISTENING') { connstate = 'LISTEN'; }
+ if (connstate === 'SYN_RECEIVED') { connstate = 'SYN_RECV'; }
+ if (connstate === 'FIN_WAIT_1') { connstate = 'FIN_WAIT1'; }
+ if (connstate === 'FIN_WAIT_2') { connstate = 'FIN_WAIT2'; }
+ if (line[0].toLowerCase() !== 'udp' && connstate) {
+ result.push({
+ protocol: line[0].toLowerCase(),
+ localAddress: localip,
+ localPort: localport,
+ peerAddress: peerip,
+ peerPort: peerport,
+ state: connstate,
+ pid,
+ process: ''
+ });
+ } else if (line[0].toLowerCase() === 'udp') {
+ result.push({
+ protocol: line[0].toLowerCase(),
+ localAddress: localip,
+ localPort: localport,
+ peerAddress: peerip,
+ peerPort: peerport,
+ state: '',
+ pid: parseInt(line[3], 10),
+ process: ''
+ });
+ }
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.networkConnections = networkConnections;
+
+function networkGatewayDefault(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = '';
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ let cmd = 'ip route get 1';
+ try {
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ const line = lines && lines[0] ? lines[0] : '';
+ let parts = line.split(' via ');
+ if (parts && parts[1]) {
+ parts = parts[1].split(' ');
+ result = parts[0];
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_darwin) {
+ let cmd = 'route -n get default';
+ try {
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ if (!error) {
+ const lines = stdout.toString().split('\n').map(line => line.trim());
+ result = util.getValue(lines, 'gateway');
+ }
+ if (!result) {
+ cmd = 'netstat -rn | awk \'/default/ {print $2}\'';
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ const lines = stdout.toString().split('\n').map(line => line.trim());
+ result = lines.find(line => (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(line)));
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_windows) {
+ try {
+ exec('netstat -r', util.execOptsWin, function (error, stdout) {
+ const lines = stdout.toString().split(os.EOL);
+ lines.forEach(line => {
+ line = line.replace(/\s+/g, ' ').trim();
+ if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) {
+ const parts = line.split(' ');
+ if (parts.length >= 5 && (parts[parts.length - 3]).indexOf('.') > -1) {
+ result = parts[parts.length - 3];
+ }
+ }
+ });
+ if (!result) {
+ util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }')
+ .then((data) => {
+ let lines = data.toString().split('\r\n');
+ if (lines.length > 1 && !result) {
+ result = util.getValue(lines, 'NextHop');
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ // } else {
+ // exec('ipconfig', util.execOptsWin, function (error, stdout) {
+ // let lines = stdout.toString().split('\r\n');
+ // lines.forEach(function (line) {
+ // line = line.trim().replace(/\. /g, '');
+ // line = line.trim().replace(/ +/g, '');
+ // const parts = line.split(':');
+ // if ((parts[0].toLowerCase().startsWith('standardgate') || parts[0].toLowerCase().indexOf('gateway') > -1 || parts[0].toLowerCase().indexOf('enlace') > -1) && parts[1]) {
+ // result = parts[1];
+ // }
+ // });
+ // if (callback) { callback(result); }
+ // resolve(result);
+ // });
+ }
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.networkGatewayDefault = networkGatewayDefault;
diff --git a/node_modules/systeminformation/lib/osinfo.js b/node_modules/systeminformation/lib/osinfo.js
new file mode 100644
index 0000000..39573ed
--- /dev/null
+++ b/node_modules/systeminformation/lib/osinfo.js
@@ -0,0 +1,1167 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// osinfo.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 3. Operating System
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const fs = require('fs');
+const util = require('./util');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+// --------------------------
+// Get current time and OS uptime
+
+function time() {
+ let t = new Date().toString().split(' ');
+ return {
+ current: Date.now(),
+ uptime: os.uptime(),
+ timezone: (t.length >= 7) ? t[5] : '',
+ timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
+ };
+}
+
+exports.time = time;
+
+// --------------------------
+// Get logo filename of OS distribution
+
+function getLogoFile(distro) {
+ distro = distro || '';
+ distro = distro.toLowerCase();
+ let result = _platform;
+ if (_windows) {
+ result = 'windows';
+ }
+ else if (distro.indexOf('mac os') !== -1) {
+ result = 'apple';
+ }
+ else if (distro.indexOf('arch') !== -1) {
+ result = 'arch';
+ }
+ else if (distro.indexOf('centos') !== -1) {
+ result = 'centos';
+ }
+ else if (distro.indexOf('coreos') !== -1) {
+ result = 'coreos';
+ }
+ else if (distro.indexOf('debian') !== -1) {
+ result = 'debian';
+ }
+ else if (distro.indexOf('deepin') !== -1) {
+ result = 'deepin';
+ }
+ else if (distro.indexOf('elementary') !== -1) {
+ result = 'elementary';
+ }
+ else if (distro.indexOf('fedora') !== -1) {
+ result = 'fedora';
+ }
+ else if (distro.indexOf('gentoo') !== -1) {
+ result = 'gentoo';
+ }
+ else if (distro.indexOf('mageia') !== -1) {
+ result = 'mageia';
+ }
+ else if (distro.indexOf('mandriva') !== -1) {
+ result = 'mandriva';
+ }
+ else if (distro.indexOf('manjaro') !== -1) {
+ result = 'manjaro';
+ }
+ else if (distro.indexOf('mint') !== -1) {
+ result = 'mint';
+ }
+ else if (distro.indexOf('mx') !== -1) {
+ result = 'mx';
+ }
+ else if (distro.indexOf('openbsd') !== -1) {
+ result = 'openbsd';
+ }
+ else if (distro.indexOf('freebsd') !== -1) {
+ result = 'freebsd';
+ }
+ else if (distro.indexOf('opensuse') !== -1) {
+ result = 'opensuse';
+ }
+ else if (distro.indexOf('pclinuxos') !== -1) {
+ result = 'pclinuxos';
+ }
+ else if (distro.indexOf('puppy') !== -1) {
+ result = 'puppy';
+ }
+ else if (distro.indexOf('raspbian') !== -1) {
+ result = 'raspbian';
+ }
+ else if (distro.indexOf('reactos') !== -1) {
+ result = 'reactos';
+ }
+ else if (distro.indexOf('redhat') !== -1) {
+ result = 'redhat';
+ }
+ else if (distro.indexOf('slackware') !== -1) {
+ result = 'slackware';
+ }
+ else if (distro.indexOf('sugar') !== -1) {
+ result = 'sugar';
+ }
+ else if (distro.indexOf('steam') !== -1) {
+ result = 'steam';
+ }
+ else if (distro.indexOf('suse') !== -1) {
+ result = 'suse';
+ }
+ else if (distro.indexOf('mate') !== -1) {
+ result = 'ubuntu-mate';
+ }
+ else if (distro.indexOf('lubuntu') !== -1) {
+ result = 'lubuntu';
+ }
+ else if (distro.indexOf('xubuntu') !== -1) {
+ result = 'xubuntu';
+ }
+ else if (distro.indexOf('ubuntu') !== -1) {
+ result = 'ubuntu';
+ }
+ else if (distro.indexOf('solaris') !== -1) {
+ result = 'solaris';
+ }
+ else if (distro.indexOf('tails') !== -1) {
+ result = 'tails';
+ }
+ else if (distro.indexOf('feren') !== -1) {
+ result = 'ferenos';
+ }
+ else if (distro.indexOf('robolinux') !== -1) {
+ result = 'robolinux';
+ } else if (_linux && distro) {
+ result = distro.toLowerCase().trim().replace(/\s+/g, '-');
+ }
+ return result;
+}
+
+// --------------------------
+// FQDN
+
+function getFQDN() {
+ let fqdn = os.hostname;
+ if (_linux || _darwin) {
+ try {
+ const stdout = execSync('hostnamectl --json short 2>/dev/null');
+ const json = JSON.parse(stdout.toString());
+
+ fqdn = json['StaticHostname'];
+ } catch (e) {
+ try {
+ const stdout = execSync('hostname -f 2>/dev/null');
+ fqdn = stdout.toString().split(os.EOL)[0];
+ } catch (e) {
+ util.noop();
+ }
+ }
+ } if (_freebsd || _openbsd || _netbsd) {
+ try {
+ const stdout = execSync('hostname 2>/dev/null');
+ fqdn = stdout.toString().split(os.EOL)[0];
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (_windows) {
+ try {
+ const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
+ fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
+ } catch (e) {
+ util.noop();
+ }
+ }
+ return fqdn;
+}
+
+// --------------------------
+// OS Information
+
+function osInfo(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+
+ platform: (_platform === 'win32' ? 'Windows' : _platform),
+ distro: 'unknown',
+ release: 'unknown',
+ codename: '',
+ kernel: os.release(),
+ arch: os.arch(),
+ hostname: os.hostname(),
+ fqdn: getFQDN(),
+ codepage: '',
+ logofile: '',
+ serial: '',
+ build: '',
+ servicepack: '',
+ uefi: false
+ };
+
+ if (_linux) {
+
+ exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
+ /**
+ * @namespace
+ * @property {string} DISTRIB_ID
+ * @property {string} NAME
+ * @property {string} DISTRIB_RELEASE
+ * @property {string} VERSION_ID
+ * @property {string} DISTRIB_CODENAME
+ */
+ let release = {};
+ let lines = stdout.toString().split('\n');
+ lines.forEach(function (line) {
+ if (line.indexOf('=') !== -1) {
+ release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
+ }
+ });
+ let releaseVersion = (release.VERSION || '').replace(/"/g, '');
+ let codename = (release.DISTRIB_CODENAME || release.VERSION_CODENAME || '').replace(/"/g, '');
+ if (releaseVersion.indexOf('(') >= 0) {
+ codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim();
+ releaseVersion = releaseVersion.split('(')[0].trim();
+ }
+ result.distro = (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, '');
+ result.logofile = getLogoFile(result.distro);
+ result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, '');
+ result.codename = codename;
+ result.codepage = util.getCodepage();
+ result.build = (release.BUILD_ID || '').replace(/"/g, '').trim();
+ isUefiLinux().then(uefi => {
+ result.uefi = uefi;
+ uuid().then((data) => {
+ result.serial = data.os;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ });
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+
+ exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ const distro = util.getValue(lines, 'kern.ostype');
+ const logofile = util.getValue(lines, 'kern.ostype');
+ const release = util.getValue(lines, 'kern.osrelease').split('-')[0];
+ const serial = util.getValue(lines, 'kern.uuid');
+ const bootmethod = util.getValue(lines, 'machdep.bootmethod');
+ const uefiConf = stdout.toString().indexOf('<type>efi</type>') >= 0;
+ const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : (uefiConf ? uefiConf : null);
+ result.distro = distro || result.distro;
+ result.logofile = logofile || result.logofile;
+ result.release = release || result.release;
+ result.serial = serial || result.serial;
+ result.codename = '';
+ result.codepage = util.getCodepage();
+ result.uefi = uefi || null;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ result.serial = util.getValue(lines, 'kern.uuid');
+ result.distro = util.getValue(lines, 'ProductName');
+ result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim();
+ result.build = util.getValue(lines, 'BuildVersion');
+ result.logofile = getLogoFile(result.distro);
+ result.codename = 'macOS';
+ result.codename = (result.release.indexOf('10.4') > -1 ? 'Mac OS X Tiger' : result.codename);
+ result.codename = (result.release.indexOf('10.5') > -1 ? 'Mac OS X Leopard' : result.codename);
+ result.codename = (result.release.indexOf('10.6') > -1 ? 'Mac OS X Snow Leopard' : result.codename);
+ result.codename = (result.release.indexOf('10.7') > -1 ? 'Mac OS X Lion' : result.codename);
+ result.codename = (result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename);
+ result.codename = (result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename);
+ result.codename = (result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename);
+ result.codename = (result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename);
+ result.codename = (result.release.indexOf('10.12') > -1 ? 'macOS Sierra' : result.codename);
+ result.codename = (result.release.indexOf('10.13') > -1 ? 'macOS High Sierra' : result.codename);
+ result.codename = (result.release.indexOf('10.14') > -1 ? 'macOS Mojave' : result.codename);
+ result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
+ result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
+ result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
+ result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
+ result.uefi = true;
+ result.codepage = util.getCodepage();
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ result.release = result.kernel;
+ exec('uname -o', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ result.distro = lines[0];
+ result.logofile = getLogoFile(result.distro);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ result.logofile = getLogoFile();
+ result.release = result.kernel;
+ try {
+ const workload = [];
+ workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
+ workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
+ workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
+ result.distro = util.getValue(lines, 'Caption', ':').trim();
+ result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
+ result.build = util.getValue(lines, 'BuildNumber', ':').trim();
+ result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
+ result.codepage = util.getCodepage();
+ const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
+ result.hypervisor = hyperv.indexOf('true') !== -1;
+ const term = data.results[2] ? data.results[2].toString() : '';
+ result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0);
+ isUefiWindows().then(uefi => {
+ result.uefi = uefi;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.osInfo = osInfo;
+
+function isUefiLinux() {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ fs.stat('/sys/firmware/efi', function (err) {
+ if (!err) {
+ return resolve(true);
+ } else {
+ exec('dmesg | grep -E "EFI v"', function (error, stdout) {
+ if (!error) {
+ const lines = stdout.toString().split('\n');
+ return resolve(lines.length > 0);
+ }
+ return resolve(false);
+ });
+ }
+ });
+ });
+ });
+}
+
+function isUefiWindows() {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ try {
+ exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) {
+ if (!error) {
+ const line = stdout.toString().split('\n\r')[0];
+ return resolve(line.toLowerCase().indexOf('efi') >= 0);
+ } else {
+ exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) {
+ if (!error) {
+ const line = stdout.toString() || '';
+ return resolve(line.toLowerCase().indexOf('efi') >= 0);
+ } else {
+ return resolve(false);
+ }
+ });
+ }
+ });
+ } catch (e) {
+ return resolve(false);
+ }
+ });
+ });
+}
+
+function versions(apps, callback) {
+ let versionObject = {
+ kernel: os.release(),
+ openssl: '',
+ systemOpenssl: '',
+ systemOpensslLib: '',
+ node: process.versions.node,
+ v8: process.versions.v8,
+ npm: '',
+ yarn: '',
+ pm2: '',
+ gulp: '',
+ grunt: '',
+ git: '',
+ tsc: '',
+ mysql: '',
+ redis: '',
+ mongodb: '',
+ apache: '',
+ nginx: '',
+ php: '',
+ docker: '',
+ postfix: '',
+ postgresql: '',
+ perl: '',
+ python: '',
+ python3: '',
+ pip: '',
+ pip3: '',
+ java: '',
+ gcc: '',
+ virtualbox: '',
+ bash: '',
+ zsh: '',
+ fish: '',
+ powershell: '',
+ dotnet: ''
+ };
+
+ function checkVersionParam(apps) {
+ if (apps === '*') {
+ return {
+ versions: versionObject,
+ counter: 30
+ };
+ }
+ if (!Array.isArray(apps)) {
+ apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
+ apps = apps.split('|');
+ const result = {
+ versions: {},
+ counter: 0
+ };
+ apps.forEach(el => {
+ if (el) {
+ for (let key in versionObject) {
+ if ({}.hasOwnProperty.call(versionObject, key)) {
+ if (key.toLowerCase() === el.toLowerCase() && !{}.hasOwnProperty.call(result.versions, key)) {
+ result.versions[key] = versionObject[key];
+ if (key === 'openssl') {
+ result.versions.systemOpenssl = '';
+ result.versions.systemOpensslLib = '';
+ }
+
+ if (!result.versions[key]) { result.counter++; }
+ }
+ }
+ }
+ }
+ });
+ return result;
+ }
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (util.isFunction(apps) && !callback) {
+ callback = apps;
+ apps = '*';
+ } else {
+ apps = apps || '*';
+ if (typeof apps !== 'string') {
+ if (callback) { callback({}); }
+ return resolve({});
+ }
+ }
+ const appsObj = checkVersionParam(apps);
+ let totalFunctions = appsObj.counter;
+
+ let functionProcessed = (function () {
+ return function () {
+ if (--totalFunctions === 0) {
+ if (callback) {
+ callback(appsObj.versions);
+ }
+ resolve(appsObj.versions);
+ }
+ };
+ })();
+
+ let cmd = '';
+ try {
+ if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
+ appsObj.versions.openssl = process.versions.openssl;
+ exec('openssl version', function (error, stdout) {
+ if (!error) {
+ let openssl_string = stdout.toString().split('\n')[0].trim();
+ let openssl = openssl_string.split(' ');
+ appsObj.versions.systemOpenssl = openssl.length > 0 ? openssl[1] : openssl[0];
+ appsObj.versions.systemOpensslLib = openssl.length > 0 ? openssl[0] : 'openssl';
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
+ exec('npm -v', function (error, stdout) {
+ if (!error) {
+ appsObj.versions.npm = stdout.toString().split('\n')[0];
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) {
+ cmd = 'pm2';
+ if (_windows) {
+ cmd += '.cmd';
+ }
+ exec(`${cmd} -v`, function (error, stdout) {
+ if (!error) {
+ let pm2 = stdout.toString().split('\n')[0].trim();
+ if (!pm2.startsWith('[PM2]')) {
+ appsObj.versions.pm2 = pm2;
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
+ exec('yarn --version', function (error, stdout) {
+ if (!error) {
+ appsObj.versions.yarn = stdout.toString().split('\n')[0];
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) {
+ cmd = 'gulp';
+ if (_windows) {
+ cmd += '.cmd';
+ }
+ exec(`${cmd} --version`, function (error, stdout) {
+ if (!error) {
+ const gulp = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) {
+ cmd = 'tsc';
+ if (_windows) {
+ cmd += '.cmd';
+ }
+ exec(`${cmd} --version`, function (error, stdout) {
+ if (!error) {
+ const tsc = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) {
+ cmd = 'grunt';
+ if (_windows) {
+ cmd += '.cmd';
+ }
+ exec(`${cmd} --version`, function (error, stdout) {
+ if (!error) {
+ const grunt = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'git')) {
+ if (_darwin) {
+ const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
+ if (util.darwinXcodeExists() || gitHomebrewExists) {
+ exec('git --version', function (error, stdout) {
+ if (!error) {
+ let git = stdout.toString().split('\n')[0] || '';
+ git = (git.toLowerCase().split('version')[1] || '').trim();
+ appsObj.versions.git = (git.split(' ')[0] || '').trim();
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('git --version', function (error, stdout) {
+ if (!error) {
+ let git = stdout.toString().split('\n')[0] || '';
+ git = (git.toLowerCase().split('version')[1] || '').trim();
+ appsObj.versions.git = (git.split(' ')[0] || '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
+ exec('apachectl -v 2>&1', function (error, stdout) {
+ if (!error) {
+ const apache = (stdout.toString().split('\n')[0] || '').split(':');
+ appsObj.versions.apache = (apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '');
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
+ exec('nginx -v 2>&1', function (error, stdout) {
+ if (!error) {
+ const nginx = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
+ exec('mysql -V', function (error, stdout) {
+ if (!error) {
+ let mysql = stdout.toString().split('\n')[0] || '';
+ mysql = mysql.toLowerCase();
+ if (mysql.indexOf(',') > -1) {
+ mysql = (mysql.split(',')[0] || '').trim();
+ const parts = mysql.split(' ');
+ appsObj.versions.mysql = (parts[parts.length - 1] || '').trim();
+ } else {
+ if (mysql.indexOf(' ver ') > -1) {
+ mysql = mysql.split(' ver ')[1];
+ appsObj.versions.mysql = mysql.split(' ')[0];
+ }
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
+ exec('php -v', function (error, stdout) {
+ if (!error) {
+ const php = stdout.toString().split('\n')[0] || '';
+ let parts = php.split('(');
+ if (parts[0].indexOf('-')) {
+ parts = parts[0].split('-');
+ }
+ appsObj.versions.php = parts[0].replace(/[^0-9.]/g, '');
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
+ exec('redis-server --version', function (error, stdout) {
+ if (!error) {
+ const redis = stdout.toString().split('\n')[0] || '';
+ const parts = redis.split(' ');
+ appsObj.versions.redis = util.getValue(parts, 'v', '=', true);
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
+ exec('docker --version', function (error, stdout) {
+ if (!error) {
+ const docker = stdout.toString().split('\n')[0] || '';
+ const parts = docker.split(' ');
+ appsObj.versions.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : '';
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
+ exec('postconf -d | grep mail_version', function (error, stdout) {
+ if (!error) {
+ const postfix = stdout.toString().split('\n') || [];
+ appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
+ exec('mongod --version', function (error, stdout) {
+ if (!error) {
+ const mongodb = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
+ if (_linux) {
+ exec('locate bin/postgres', function (error, stdout) {
+ if (!error) {
+ const postgresqlBin = stdout.toString().split('\n').sort();
+ if (postgresqlBin.length) {
+ exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', function (error, stdout) {
+ if (!error) {
+ const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
+ appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('psql -V', function (error, stdout) {
+ if (!error) {
+ const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
+ appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
+ appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0];
+ }
+ functionProcessed();
+ });
+ }
+ });
+ } else {
+ if (_windows) {
+ util.powerShell('Get-CimInstance Win32_Service | select caption | fl').then((stdout) => {
+ let serviceSections = stdout.split(/\n\s*\n/);
+ serviceSections.forEach((item) => {
+ if (item.trim() !== '') {
+ let lines = item.trim().split('\r\n');
+ let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase();
+ if (srvCaption.indexOf('postgresql') > -1) {
+ const parts = srvCaption.split(' server ');
+ if (parts.length > 1) {
+ appsObj.versions.postgresql = parts[1];
+ }
+ }
+ }
+ });
+ functionProcessed();
+ });
+ } else {
+ exec('postgres -V', function (error, stdout) {
+ if (!error) {
+ const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
+ appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
+ }
+ functionProcessed();
+ });
+ }
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
+ exec('perl -v', function (error, stdout) {
+ if (!error) {
+ const perl = stdout.toString().split('\n') || '';
+ while (perl.length > 0 && perl[0].trim() === '') {
+ perl.shift();
+ }
+ if (perl.length > 0) {
+ appsObj.versions.perl = perl[0].split('(').pop().split(')')[0].replace('v', '');
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
+ if (_darwin) {
+ const stdout = execSync('sw_vers');
+ const lines = stdout.toString().split('\n');
+ const osVersion = util.getValue(lines, 'ProductVersion', ':');
+ const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
+ const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
+ if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
+ const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ const python = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('python -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const python = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) {
+ if (_darwin) {
+ const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
+ if (util.darwinXcodeExists() || gitHomebrewExists) {
+ exec('python3 -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const python = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('python3 -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const python = stdout.toString().split('\n')[0] || '';
+ appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) {
+ if (_darwin) {
+ const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
+ if (util.darwinXcodeExists() || gitHomebrewExists) {
+ exec('pip -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const pip = stdout.toString().split('\n')[0] || '';
+ const parts = pip.split(' ');
+ appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('pip -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const pip = stdout.toString().split('\n')[0] || '';
+ const parts = pip.split(' ');
+ appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) {
+ if (_darwin) {
+ const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
+ if (util.darwinXcodeExists() || gitHomebrewExists) {
+ exec('pip3 -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const pip = stdout.toString().split('\n')[0] || '';
+ const parts = pip.split(' ');
+ appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ } else {
+ exec('pip3 -V 2>&1', function (error, stdout) {
+ if (!error) {
+ const pip = stdout.toString().split('\n')[0] || '';
+ const parts = pip.split(' ');
+ appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
+ if (_darwin) {
+ // check if any JVM is installed but avoid dialog box that Java needs to be installed
+ exec('/usr/libexec/java_home -V 2>&1', function (error, stdout) {
+ if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
+ // now this can be done savely
+ exec('java -version 2>&1', function (error, stdout) {
+ if (!error) {
+ const java = stdout.toString().split('\n')[0] || '';
+ const parts = java.split('"');
+ appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
+ }
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ });
+ } else {
+ exec('java -version 2>&1', function (error, stdout) {
+ if (!error) {
+ const java = stdout.toString().split('\n')[0] || '';
+ const parts = java.split('"');
+ appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
+ }
+ functionProcessed();
+ });
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
+ if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
+ exec('gcc -dumpversion', function (error, stdout) {
+ if (!error) {
+ appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
+ }
+ if (appsObj.versions.gcc.indexOf('.') > -1) {
+ functionProcessed();
+ } else {
+ exec('gcc --version', function (error, stdout) {
+ if (!error) {
+ const gcc = stdout.toString().split('\n')[0].trim();
+ if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
+ const parts = gcc.split(')');
+ appsObj.versions.gcc = parts[1].trim() || appsObj.versions.gcc;
+ }
+ }
+ functionProcessed();
+ });
+ }
+ });
+ } else {
+ functionProcessed();
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
+ exec(util.getVboxmanage() + ' -v 2>&1', function (error, stdout) {
+ if (!error) {
+ const vbox = stdout.toString().split('\n')[0] || '';
+ const parts = vbox.split('r');
+ appsObj.versions.virtualbox = parts[0];
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
+ exec('bash --version', function (error, stdout) {
+ if (!error) {
+ const line = stdout.toString().split('\n')[0];
+ const parts = line.split(' version ');
+ if (parts.length > 1) {
+ appsObj.versions.bash = parts[1].split(' ')[0].split('(')[0];
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
+ exec('zsh --version', function (error, stdout) {
+ if (!error) {
+ const line = stdout.toString().split('\n')[0];
+ const parts = line.split('zsh ');
+ if (parts.length > 1) {
+ appsObj.versions.zsh = parts[1].split(' ')[0];
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
+ exec('fish --version', function (error, stdout) {
+ if (!error) {
+ const line = stdout.toString().split('\n')[0];
+ const parts = line.split(' version ');
+ if (parts.length > 1) {
+ appsObj.versions.fish = parts[1].split(' ')[0];
+ }
+ }
+ functionProcessed();
+ });
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
+ if (_windows) {
+ util.powerShell('$PSVersionTable').then(stdout => {
+ const lines = stdout.toString().split('\n').map(line => line.replace(/ +/g, ' ').replace(/ +/g, ':'));
+ appsObj.versions.powershell = util.getValue(lines, 'psversion');
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ }
+ if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
+ if (_windows) {
+ util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => {
+ const lines = stdout.toString().split('\r\n');
+ let dotnet = '';
+ lines.forEach(line => {
+ line = line.replace(/ +/g, ' ');
+ const parts = line.split(' ');
+ dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : ''));
+ });
+ appsObj.versions.dotnet = dotnet.trim();
+ functionProcessed();
+ });
+ } else {
+ functionProcessed();
+ }
+ }
+ } catch (e) {
+ if (callback) { callback(appsObj.versions); }
+ resolve(appsObj.versions);
+ }
+ });
+ });
+}
+
+exports.versions = versions;
+
+function shell(callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (_windows) {
+ resolve('cmd');
+ } else {
+ let result = '';
+ exec('echo $SHELL', function (error, stdout) {
+ if (!error) {
+ result = stdout.toString().split('\n')[0];
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ });
+ });
+}
+
+exports.shell = shell;
+
+function getUniqueMacAdresses() {
+ let macs = [];
+ try {
+ const ifaces = os.networkInterfaces();
+ for (let dev in ifaces) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
+ ifaces[dev].forEach(function (details) {
+ if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
+ const mac = details.mac.toLowerCase();
+ if (macs.indexOf(mac) === -1) {
+ macs.push(mac);
+ }
+ }
+ });
+ }
+ }
+ macs = macs.sort(function (a, b) {
+ if (a < b) { return -1; }
+ if (a > b) { return 1; }
+ return 0;
+ });
+ } catch (e) {
+ macs.push('00:00:00:00:00:00');
+ }
+ return macs;
+}
+
+function uuid(callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ os: '',
+ hardware: '',
+ macs: getUniqueMacAdresses()
+ };
+ let parts;
+
+ if (_darwin) {
+ exec('system_profiler SPHardwareDataType -json', function (error, stdout) {
+ if (!error) {
+ try {
+ const jsonObj = JSON.parse(stdout.toString());
+ if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
+ const spHardware = jsonObj.SPHardwareDataType[0];
+ result.os = spHardware.platform_UUID.toLowerCase();
+ result.hardware = spHardware.serial_number;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_linux) {
+ const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null; echo;
+echo -n "os: "; cat /etc/machine-id 2> /dev/null; echo;
+echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
+ exec(cmd, function (error, stdout) {
+ const lines = stdout.toString().split('\n');
+ result.os = util.getValue(lines, 'os').toLowerCase();
+ result.hardware = util.getValue(lines, 'hardware').toLowerCase();
+ if (!result.hardware) {
+ const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
+ const serial = util.getValue(lines, 'serial');
+ result.hardware = serial || '';
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('sysctl -i kern.hostid kern.hostuuid', function (error, stdout) {
+ const lines = stdout.toString().split('\n');
+ result.os = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
+ result.hardware = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
+ if (result.os.indexOf('unknown') >= 0) { result.os = ''; }
+ if (result.hardware.indexOf('unknown') >= 0) { result.hardware = ''; }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ let sysdir = '%windir%\\System32';
+ if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
+ sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
+ }
+ util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
+ let lines = stdout.split('\r\n');
+ result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
+ exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
+ parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
+ result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : '';
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ });
+ }
+ });
+ });
+}
+
+exports.uuid = uuid;
diff --git a/node_modules/systeminformation/lib/printer.js b/node_modules/systeminformation/lib/printer.js
new file mode 100644
index 0000000..90b7781
--- /dev/null
+++ b/node_modules/systeminformation/lib/printer.js
@@ -0,0 +1,210 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// printers.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 15. printers
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+const winPrinterStatus = {
+ 1: 'Other',
+ 2: 'Unknown',
+ 3: 'Idle',
+ 4: 'Printing',
+ 5: 'Warmup',
+ 6: 'Stopped Printing',
+ 7: 'Offline',
+};
+
+function parseLinuxCupsHeader(lines) {
+ const result = {};
+ if (lines && lines.length) {
+ if (lines[0].indexOf(' CUPS v') > 0) {
+ const parts = lines[0].split(' CUPS v');
+ result.cupsVersion = parts[1];
+ }
+ }
+ return result;
+}
+
+function parseLinuxCupsPrinter(lines) {
+ const result = {};
+ const printerId = util.getValue(lines, 'PrinterId', ' ');
+ result.id = printerId ? parseInt(printerId, 10) : null;
+ result.name = util.getValue(lines, 'Info', ' ');
+ result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '';
+ result.uri = util.getValue(lines, 'DeviceURI', ' ');
+ result.uuid = util.getValue(lines, 'UUID', ' ');
+ result.status = util.getValue(lines, 'State', ' ');
+ result.local = util.getValue(lines, 'Location', ' ').toLowerCase().startsWith('local');
+ result.default = null;
+ result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes');
+
+ return result;
+}
+
+function parseLinuxLpstatPrinter(lines, id) {
+ const result = {};
+ result.id = id;
+ result.name = util.getValue(lines, 'Description', ':', true);
+ result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '';
+ result.uri = null;
+ result.uuid = null;
+ result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : (lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown')) : null;
+ result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local');
+ result.default = null;
+ result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes');
+
+ return result;
+}
+
+function parseDarwinPrinters(printerObject, id) {
+ const result = {};
+ const uriParts = printerObject.uri.split('/');
+ result.id = id;
+ result.name = printerObject._name;
+ result.model = uriParts.length ? uriParts[uriParts.length - 1] : '';
+ result.uri = printerObject.uri;
+ result.uuid = null;
+ result.status = printerObject.status;
+ result.local = printerObject.printserver === 'local';
+ result.default = printerObject.default === 'yes';
+ result.shared = printerObject.shared === 'yes';
+
+ return result;
+}
+
+function parseWindowsPrinters(lines, id) {
+ const result = {};
+ const status = parseInt(util.getValue(lines, 'PrinterStatus', ':'), 10);
+
+ result.id = id;
+ result.name = util.getValue(lines, 'name', ':');
+ result.model = util.getValue(lines, 'DriverName', ':');
+ result.uri = null;
+ result.uuid = null;
+ result.status = winPrinterStatus[status] ? winPrinterStatus[status] : null;
+ result.local = util.getValue(lines, 'Local', ':').toUpperCase() === 'TRUE';
+ result.default = util.getValue(lines, 'Default', ':').toUpperCase() === 'TRUE';
+ result.shared = util.getValue(lines, 'Shared', ':').toUpperCase() === 'TRUE';
+
+ return result;
+}
+
+function printer(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ let cmd = 'cat /etc/cups/printers.conf 2>/dev/null';
+ exec(cmd, function (error, stdout) {
+ // printers.conf
+ if (!error) {
+ const parts = stdout.toString().split('<Printer ');
+ const printerHeader = parseLinuxCupsHeader(parts[0]);
+ for (let i = 1; i < parts.length; i++) {
+ const printers = parseLinuxCupsPrinter(parts[i].split('\n'));
+ if (printers.name) {
+ printers.engine = 'CUPS';
+ printers.engineVersion = printerHeader.cupsVersion;
+ result.push(printers);
+ }
+ }
+ }
+ if (result.length === 0) {
+ if (_linux) {
+ cmd = 'export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL';
+ // lpstat
+ exec(cmd, function (error, stdout) {
+ const parts = ('\n' + stdout.toString()).split('\nprinter ');
+ for (let i = 1; i < parts.length; i++) {
+ const printers = parseLinuxLpstatPrinter(parts[i].split('\n'), i);
+ result.push(printers);
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ }
+ if (_darwin) {
+ let cmd = 'system_profiler SPPrintersDataType -json';
+ exec(cmd, function (error, stdout) {
+ if (!error) {
+ try {
+ const outObj = JSON.parse(stdout.toString());
+ if (outObj.SPPrintersDataType && outObj.SPPrintersDataType.length) {
+ for (let i = 0; i < outObj.SPPrintersDataType.length; i++) {
+ const printer = parseDarwinPrinters(outObj.SPPrintersDataType[i], i);
+ result.push(printer);
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ util.powerShell('Get-CimInstance Win32_Printer | select PrinterStatus,Name,DriverName,Local,Default,Shared | fl').then((stdout, error) => {
+ if (!error) {
+ const parts = stdout.toString().split(/\n\s*\n/);
+ for (let i = 0; i < parts.length; i++) {
+ const printer = parseWindowsPrinters(parts[i].split('\n'), i);
+ if (printer.name || printer.model) {
+ result.push(printer);
+ }
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ resolve(null);
+ }
+ });
+ });
+}
+
+exports.printer = printer;
diff --git a/node_modules/systeminformation/lib/processes.js b/node_modules/systeminformation/lib/processes.js
new file mode 100644
index 0000000..68f2255
--- /dev/null
+++ b/node_modules/systeminformation/lib/processes.js
@@ -0,0 +1,1289 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// processes.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 10. Processes
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const fs = require('fs');
+const path = require('path');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+const _processes_cpu = {
+ all: 0,
+ all_utime: 0,
+ all_stime: 0,
+ list: {},
+ ms: 0,
+ result: {}
+};
+const _services_cpu = {
+ all: 0,
+ all_utime: 0,
+ all_stime: 0,
+ list: {},
+ ms: 0,
+ result: {}
+};
+const _process_cpu = {
+ all: 0,
+ all_utime: 0,
+ all_stime: 0,
+ list: {},
+ ms: 0,
+ result: {}
+};
+
+const _winStatusValues = {
+ '0': 'unknown',
+ '1': 'other',
+ '2': 'ready',
+ '3': 'running',
+ '4': 'blocked',
+ '5': 'suspended blocked',
+ '6': 'suspended ready',
+ '7': 'terminated',
+ '8': 'stopped',
+ '9': 'growing',
+};
+
+function parseTimeUnix(time) {
+ let result = time;
+ let parts = time.replace(/ +/g, ' ').split(' ');
+ if (parts.length === 5) {
+ result = parts[4] + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(parts[1].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + parts[2]).slice(-2) + ' ' + parts[3];
+ }
+ return result;
+}
+
+function parseElapsedTime(etime) {
+ let current = new Date();
+ current = new Date(current.getTime() - current.getTimezoneOffset() * 60000);
+
+ const elapsed = etime.split('-');
+
+ const timeIndex = elapsed.length - 1;
+ const days = timeIndex > 0 ? parseInt(elapsed[timeIndex - 1]) : 0;
+
+ const timeStr = elapsed[timeIndex].split(':');
+ const hours = timeStr.length === 3 ? parseInt(timeStr[0] || 0) : 0;
+ const mins = parseInt(timeStr[timeStr.length === 3 ? 1 : 0] || 0);
+ const secs = parseInt(timeStr[timeStr.length === 3 ? 2 : 1] || 0);
+ const ms = (((((days * 24 + hours) * 60) + mins) * 60 + secs) * 1000);
+
+ let res = new Date(current.getTime());
+ let result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19);
+ try {
+ res = new Date(current.getTime() - ms);
+ result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19);
+ } catch (e) {
+ util.noop();
+ }
+ return result;
+}
+
+// --------------------------
+// PS - services
+// pass a comma separated string with services to check (mysql, apache, postgresql, ...)
+// this function gives an array back, if the services are running.
+
+function services(srv, callback) {
+
+ // fallback - if only callback is given
+ if (util.isFunction(srv) && !callback) {
+ callback = srv;
+ srv = '';
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ if (typeof srv !== 'string') {
+ if (callback) { callback([]); }
+ return resolve([]);
+ }
+
+ if (srv) {
+ let srvString = '';
+ srvString.__proto__.toLowerCase = util.stringToLower;
+ srvString.__proto__.replace = util.stringReplace;
+ srvString.__proto__.trim = util.stringTrim;
+
+ const s = util.sanitizeShellString(srv);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ srvString = srvString + s[i];
+ }
+ }
+
+ srvString = srvString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|');
+ if (srvString === '') {
+ srvString = '*';
+ }
+ if (util.isPrototypePolluted() && srvString !== '*') {
+ srvString = '------';
+ }
+ let srvs = srvString.split('|');
+ let result = [];
+ let dataSrv = [];
+
+ if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
+ if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
+ try {
+ const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null').toString().split('\n');
+ srvs = [];
+ for (const s of tmpsrv) {
+ const name = s.split('.service')[0];
+ if (name && s.indexOf(' not-found ') === -1) {
+ srvs.push(name.trim());
+ }
+ }
+ srvString = srvs.join('|');
+ } catch (d) {
+ try {
+ srvString = '';
+ const tmpsrv = execSync('service --status-all 2> /dev/null').toString().split('\n');
+ for (const s of tmpsrv) {
+ const parts = s.split(']');
+ if (parts.length === 2) {
+ srvString += (srvString !== '' ? '|' : '') + parts[1].trim();
+ }
+ }
+ srvs = srvString.split('|');
+ } catch (e) {
+ try {
+ const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null').toString().split('\n').join('');
+ srvString = '';
+ if (srvStr) {
+ const tmpsrv = srvStr.split(',');
+ for (const s of tmpsrv) {
+ const name = s.trim();
+ if (name) {
+ srvString += (srvString !== '' ? '|' : '') + name;
+ }
+ }
+ srvs = srvString.split('|');
+ }
+ } catch (f) {
+ srvString = '';
+ srvs = [];
+ }
+ }
+ }
+ }
+ if ((_darwin) && srvString === '*') { // service enumeration not yet suported on mac OS
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ let args = (_darwin) ? ['-caxo', 'pcpu,pmem,pid,command'] : ['-axo', 'pcpu,pmem,pid,command'];
+ if (srvString !== '' && srvs.length > 0) {
+ util.execSafe('ps', args).then((stdout) => {
+ if (stdout) {
+ let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n');
+ srvs.forEach(function (srv) {
+ let ps;
+ if (_darwin) {
+ ps = lines.filter(function (e) {
+ return (e.toLowerCase().indexOf(srv) !== -1);
+ });
+
+ } else {
+ ps = lines.filter(function (e) {
+ return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1);
+ });
+ }
+ const pids = [];
+ for (const p of ps) {
+ const pid = p.trim().split(' ')[2];
+ if (pid) {
+ pids.push(parseInt(pid, 10));
+ }
+ }
+ result.push({
+ name: srv,
+ running: ps.length > 0,
+ startmode: '',
+ pids: pids,
+ cpu: parseFloat((ps.reduce(function (pv, cv) {
+ return pv + parseFloat(cv.trim().split(' ')[0]);
+ }, 0)).toFixed(2)),
+ mem: parseFloat((ps.reduce(function (pv, cv) {
+ return pv + parseFloat(cv.trim().split(' ')[1]);
+ }, 0)).toFixed(2))
+ });
+ });
+ if (_linux) {
+ // calc process_cpu - ps is not accurate in linux!
+ let cmd = 'cat /proc/stat | grep "cpu "';
+ for (let i in result) {
+ for (let j in result[i].pids) {
+ cmd += (';cat /proc/' + result[i].pids[j] + '/stat');
+ }
+ }
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ let curr_processes = stdout.toString().split('\n');
+
+ // first line (all - /proc/stat)
+ let all = parseProcStat(curr_processes.shift());
+
+ // process
+ let list_new = {};
+ let resultProcess = {};
+ curr_processes.forEach((element) => {
+ resultProcess = calcProcStatLinux(element, all, _services_cpu);
+
+ if (resultProcess.pid) {
+ let listPos = -1;
+ for (let i in result) {
+ for (let j in result[i].pids) {
+ if (parseInt(result[i].pids[j]) === parseInt(resultProcess.pid)) {
+ listPos = i;
+ }
+ }
+ }
+ if (listPos >= 0) {
+ result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus;
+ }
+
+ // save new values
+ list_new[resultProcess.pid] = {
+ cpuu: resultProcess.cpuu,
+ cpus: resultProcess.cpus,
+ utime: resultProcess.utime,
+ stime: resultProcess.stime,
+ cutime: resultProcess.cutime,
+ cstime: resultProcess.cstime
+ };
+ }
+ });
+
+ // store old values
+ _services_cpu.all = all;
+ _services_cpu.list = Object.assign({}, list_new);
+ _services_cpu.ms = Date.now() - _services_cpu.ms;
+ _services_cpu.result = Object.assign({}, result);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ args = ['-o', 'comm'];
+ util.execSafe('ps', args).then((stdout) => {
+ if (stdout) {
+ let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n');
+ srvs.forEach(function (srv) {
+ let ps = lines.filter(function (e) {
+ return e.indexOf(srv) !== -1;
+ });
+ result.push({
+ name: srv,
+ running: ps.length > 0,
+ startmode: '',
+ cpu: 0,
+ mem: 0
+ });
+ });
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ srvs.forEach(function (srv) {
+ result.push({
+ name: srv,
+ running: false,
+ startmode: '',
+ cpu: 0,
+ mem: 0
+ });
+ });
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ }
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ if (_windows) {
+ try {
+ let wincommand = 'Get-CimInstance Win32_Service';
+ if (srvs[0] !== '*') {
+ wincommand += ' -Filter "';
+ srvs.forEach((srv) => {
+ wincommand += `Name='${srv}' or `;
+ });
+ wincommand = `${wincommand.slice(0, -4)}"`;
+ }
+ wincommand += ' | select Name,Caption,Started,StartMode,ProcessId | fl';
+ util.powerShell(wincommand).then((stdout, error) => {
+ if (!error) {
+ let serviceSections = stdout.split(/\n\s*\n/);
+ serviceSections.forEach((element) => {
+ if (element.trim() !== '') {
+ let lines = element.trim().split('\r\n');
+ let srvName = util.getValue(lines, 'Name', ':', true).toLowerCase();
+ let srvCaption = util.getValue(lines, 'Caption', ':', true).toLowerCase();
+ let started = util.getValue(lines, 'Started', ':', true);
+ let startMode = util.getValue(lines, 'StartMode', ':', true);
+ let pid = util.getValue(lines, 'ProcessId', ':', true);
+ if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) {
+ result.push({
+ name: srvName,
+ running: (started.toLowerCase() === 'true'),
+ startmode: startMode,
+ pids: [pid],
+ cpu: 0,
+ mem: 0
+ });
+ dataSrv.push(srvName);
+ dataSrv.push(srvCaption);
+ }
+ }
+
+ });
+
+ if (srvString !== '*') {
+ let srvsMissing = srvs.filter(function (e) {
+ return dataSrv.indexOf(e) === -1;
+ });
+ srvsMissing.forEach(function (srvName) {
+ result.push({
+ name: srvName,
+ running: false,
+ startmode: '',
+ pids: [],
+ cpu: 0,
+ mem: 0
+ });
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ srvs.forEach(function (srvName) {
+ result.push({
+ name: srvName,
+ running: false,
+ startmode: '',
+ cpu: 0,
+ mem: 0
+ });
+ });
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ } else {
+ if (callback) { callback([]); }
+ resolve([]);
+ }
+ });
+ });
+}
+
+exports.services = services;
+
+function parseProcStat(line) {
+ let parts = line.replace(/ +/g, ' ').split(' ');
+ let user = (parts.length >= 2 ? parseInt(parts[1]) : 0);
+ let nice = (parts.length >= 3 ? parseInt(parts[2]) : 0);
+ let system = (parts.length >= 4 ? parseInt(parts[3]) : 0);
+ let idle = (parts.length >= 5 ? parseInt(parts[4]) : 0);
+ let iowait = (parts.length >= 6 ? parseInt(parts[5]) : 0);
+ let irq = (parts.length >= 7 ? parseInt(parts[6]) : 0);
+ let softirq = (parts.length >= 8 ? parseInt(parts[7]) : 0);
+ let steal = (parts.length >= 9 ? parseInt(parts[8]) : 0);
+ let guest = (parts.length >= 10 ? parseInt(parts[9]) : 0);
+ let guest_nice = (parts.length >= 11 ? parseInt(parts[10]) : 0);
+ return user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice;
+}
+
+function calcProcStatLinux(line, all, _cpu_old) {
+ let statparts = line.replace(/ +/g, ' ').split(')');
+ if (statparts.length >= 2) {
+ let parts = statparts[1].split(' ');
+ if (parts.length >= 16) {
+ let pid = parseInt(statparts[0].split(' ')[0]);
+ let utime = parseInt(parts[12]);
+ let stime = parseInt(parts[13]);
+ let cutime = parseInt(parts[14]);
+ let cstime = parseInt(parts[15]);
+
+ // calc
+ let cpuu = 0;
+ let cpus = 0;
+ if (_cpu_old.all > 0 && _cpu_old.list[pid]) {
+ cpuu = (utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all) * 100; // user
+ cpus = (stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all) * 100; // system
+ } else {
+ cpuu = (utime + cutime) / (all) * 100; // user
+ cpus = (stime + cstime) / (all) * 100; // system
+ }
+ return {
+ pid: pid,
+ utime: utime,
+ stime: stime,
+ cutime: cutime,
+ cstime: cstime,
+ cpuu: cpuu,
+ cpus: cpus
+ };
+ } else {
+ return {
+ pid: 0,
+ utime: 0,
+ stime: 0,
+ cutime: 0,
+ cstime: 0,
+ cpuu: 0,
+ cpus: 0
+ };
+ }
+ } else {
+ return {
+ pid: 0,
+ utime: 0,
+ stime: 0,
+ cutime: 0,
+ cstime: 0,
+ cpuu: 0,
+ cpus: 0
+ };
+ }
+}
+
+function calcProcStatWin(procStat, all, _cpu_old) {
+ // calc
+ let cpuu = 0;
+ let cpus = 0;
+ if (_cpu_old.all > 0 && _cpu_old.list[procStat.pid]) {
+ cpuu = (procStat.utime - _cpu_old.list[procStat.pid].utime) / (all - _cpu_old.all) * 100; // user
+ cpus = (procStat.stime - _cpu_old.list[procStat.pid].stime) / (all - _cpu_old.all) * 100; // system
+ } else {
+ cpuu = (procStat.utime) / (all) * 100; // user
+ cpus = (procStat.stime) / (all) * 100; // system
+ }
+ return {
+ pid: procStat.pid,
+ utime: procStat.utime,
+ stime: procStat.stime,
+ cpuu: cpuu > 0 ? cpuu : 0,
+ cpus: cpus > 0 ? cpus : 0
+ };
+}
+
+
+
+// --------------------------
+// running processes
+
+function processes(callback) {
+
+ let parsedhead = [];
+
+ function getName(command) {
+ command = command || '';
+ let result = command.split(' ')[0];
+ if (result.substr(-1) === ':') {
+ result = result.substr(0, result.length - 1);
+ }
+ if (result.substr(0, 1) !== '[') {
+ let parts = result.split('/');
+ if (isNaN(parseInt(parts[parts.length - 1]))) {
+ result = parts[parts.length - 1];
+ } else {
+ result = parts[0];
+ }
+ }
+ return result;
+ }
+
+ function parseLine(line) {
+
+ let offset = 0;
+ let offset2 = 0;
+
+ function checkColumn(i) {
+ offset = offset2;
+ if (parsedhead[i]) {
+ offset2 = line.substring(parsedhead[i].to + offset, 10000).indexOf(' ');
+ } else {
+ offset2 = 10000;
+ }
+ }
+
+ checkColumn(0);
+ const pid = parseInt(line.substring(parsedhead[0].from + offset, parsedhead[0].to + offset2));
+ checkColumn(1);
+ const ppid = parseInt(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2));
+ checkColumn(2);
+ const cpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.'));
+ checkColumn(3);
+ const mem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.'));
+ checkColumn(4);
+ const priority = parseInt(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2));
+ checkColumn(5);
+ const vsz = parseInt(line.substring(parsedhead[5].from + offset, parsedhead[5].to + offset2));
+ checkColumn(6);
+ const rss = parseInt(line.substring(parsedhead[6].from + offset, parsedhead[6].to + offset2));
+ checkColumn(7);
+ const nice = parseInt(line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2)) || 0;
+ checkColumn(8);
+ const started = !_sunos ? parseElapsedTime(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()) : parseTimeUnix(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim());
+ checkColumn(9);
+ let state = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim();
+ state = (state[0] === 'R' ? 'running' : (state[0] === 'S' ? 'sleeping' : (state[0] === 'T' ? 'stopped' : (state[0] === 'W' ? 'paging' : (state[0] === 'X' ? 'dead' : (state[0] === 'Z' ? 'zombie' : ((state[0] === 'D' || state[0] === 'U') ? 'blocked' : 'unknown')))))));
+ checkColumn(10);
+ let tty = line.substring(parsedhead[10].from + offset, parsedhead[10].to + offset2).trim();
+ if (tty === '?' || tty === '??') { tty = ''; }
+ checkColumn(11);
+ const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim();
+ checkColumn(12);
+ let cmdPath = '';
+ let command = '';
+ let params = '';
+ let fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim();
+ if (fullcommand.substr(fullcommand.length - 1) === ']') { fullcommand = fullcommand.slice(0, -1); }
+ if (fullcommand.substr(0, 1) === '[') { command = fullcommand.substring(1); }
+ else {
+ const p1 = fullcommand.indexOf('(');
+ const p2 = fullcommand.indexOf(')');
+ const p3 = fullcommand.indexOf('/');
+ const p4 = fullcommand.indexOf(':');
+ if (p1 < p2 && p1 < p3 && p3 < p2) {
+ command = fullcommand.split(' ')[0];
+ command = command.replace(/:/g, '');
+ } else {
+ if (p4 > 0 && (p3 === -1 || p3 > 3)) {
+ command = fullcommand.split(' ')[0];
+ command = command.replace(/:/g, '');
+ } else {
+ // try to figure out where parameter starts
+ let firstParamPos = fullcommand.indexOf(' -');
+ let firstParamPathPos = fullcommand.indexOf(' /');
+ firstParamPos = (firstParamPos >= 0 ? firstParamPos : 10000);
+ firstParamPathPos = (firstParamPathPos >= 0 ? firstParamPathPos : 10000);
+ const firstPos = Math.min(firstParamPos, firstParamPathPos);
+ let tmpCommand = fullcommand.substr(0, firstPos);
+ const tmpParams = fullcommand.substr(firstPos);
+ const lastSlashPos = tmpCommand.lastIndexOf('/');
+ if (lastSlashPos >= 0) {
+ cmdPath = tmpCommand.substr(0, lastSlashPos);
+ tmpCommand = tmpCommand.substr(lastSlashPos + 1);
+ }
+
+ if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) {
+ const parts = tmpCommand.split(' ');
+ if (fs.existsSync(path.join(cmdPath, parts[0]))) {
+ command = parts.shift();
+ params = (parts.join(' ') + ' ' + tmpParams).trim();
+ } else {
+ command = tmpCommand.trim();
+ params = tmpParams.trim();
+ }
+ } else {
+ command = tmpCommand.trim();
+ params = tmpParams.trim();
+ }
+ }
+ }
+
+ }
+
+ return ({
+ pid: pid,
+ parentPid: ppid,
+ name: _linux ? getName(command) : command,
+ cpu: cpu,
+ cpuu: 0,
+ cpus: 0,
+ mem: mem,
+ priority: priority,
+ memVsz: vsz,
+ memRss: rss,
+ nice: nice,
+ started: started,
+ state: state,
+ tty: tty,
+ user: user,
+ command: command,
+ params: params,
+ path: cmdPath
+ });
+ }
+
+ function parseProcesses(lines) {
+ let result = [];
+ if (lines.length > 1) {
+ let head = lines[0];
+ parsedhead = util.parseHead(head, 8);
+ lines.shift();
+ lines.forEach(function (line) {
+ if (line.trim() !== '') {
+ result.push(parseLine(line));
+ }
+ });
+ }
+ return result;
+ }
+ function parseProcesses2(lines) {
+
+ function formatDateTime(time) {
+ const month = ('0' + (time.getMonth() + 1).toString()).slice(-2);
+ const year = time.getFullYear().toString();
+ const day = ('0' + time.getDate().toString()).slice(-2);
+ const hours = ('0' + time.getHours().toString()).slice(-2);
+ const mins = ('0' + time.getMinutes().toString()).slice(-2);
+ const secs = ('0' + time.getSeconds().toString()).slice(-2);
+
+ return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs);
+ }
+
+ function parseElapsed(etime) {
+ let started = '';
+ if (etime.indexOf('d') >= 0) {
+ const elapsed_parts = etime.split('d');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 24 + elapsed_parts[1] * 1) * 60 * 60 * 1000));
+ } else if (etime.indexOf('h') >= 0) {
+ const elapsed_parts = etime.split('h');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 60 + elapsed_parts[1] * 1) * 60 * 1000));
+ } else if (etime.indexOf(':') >= 0) {
+ const elapsed_parts = etime.split(':');
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000)));
+ }
+ return started;
+ }
+
+ let result = [];
+ lines.forEach(function (line) {
+ if (line.trim() !== '') {
+ line = line.trim().replace(/ +/g, ' ').replace(/,+/g, '.');
+ const parts = line.split(' ');
+ const command = parts.slice(9).join(' ');
+ const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1));
+ const started = parseElapsed(parts[5]);
+
+ result.push({
+ pid: parseInt(parts[0]),
+ parentPid: parseInt(parts[1]),
+ name: getName(command),
+ cpu: 0,
+ cpuu: 0,
+ cpus: 0,
+ mem: pmem,
+ priority: 0,
+ memVsz: parseInt(parts[2]),
+ memRss: parseInt(parts[3]),
+ nice: parseInt(parts[4]),
+ started: started,
+ state: (parts[6] === 'R' ? 'running' : (parts[6] === 'S' ? 'sleeping' : (parts[6] === 'T' ? 'stopped' : (parts[6] === 'W' ? 'paging' : (parts[6] === 'X' ? 'dead' : (parts[6] === 'Z' ? 'zombie' : ((parts[6] === 'D' || parts[6] === 'U') ? 'blocked' : 'unknown'))))))),
+ tty: parts[7],
+ user: parts[8],
+ command: command
+ });
+ }
+ });
+ return result;
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = {
+ all: 0,
+ running: 0,
+ blocked: 0,
+ sleeping: 0,
+ unknown: 0,
+ list: []
+ };
+
+ let cmd = '';
+
+ if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) {
+ if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
+ if (_linux) { cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL'; }
+ if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL'; }
+ if (_darwin) { cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r'; }
+ if (_sunos) { cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm'; }
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ if (!error && stdout.toString().trim()) {
+ result.list = (parseProcesses(stdout.toString().split('\n'))).slice();
+ result.all = result.list.length;
+ result.running = result.list.filter(function (e) {
+ return e.state === 'running';
+ }).length;
+ result.blocked = result.list.filter(function (e) {
+ return e.state === 'blocked';
+ }).length;
+ result.sleeping = result.list.filter(function (e) {
+ return e.state === 'sleeping';
+ }).length;
+
+ if (_linux) {
+ // calc process_cpu - ps is not accurate in linux!
+ cmd = 'cat /proc/stat | grep "cpu "';
+ result.list.forEach((element) => {
+ cmd += (';cat /proc/' + element.pid + '/stat');
+ });
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ let curr_processes = stdout.toString().split('\n');
+
+ // first line (all - /proc/stat)
+ let all = parseProcStat(curr_processes.shift());
+
+ // process
+ let list_new = {};
+ let resultProcess = {};
+ curr_processes.forEach((element) => {
+ resultProcess = calcProcStatLinux(element, all, _processes_cpu);
+
+ if (resultProcess.pid) {
+
+ // store pcpu in outer array
+ let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid);
+ if (listPos >= 0) {
+ result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus;
+ result.list[listPos].cpuu = resultProcess.cpuu;
+ result.list[listPos].cpus = resultProcess.cpus;
+ }
+
+ // save new values
+ list_new[resultProcess.pid] = {
+ cpuu: resultProcess.cpuu,
+ cpus: resultProcess.cpus,
+ utime: resultProcess.utime,
+ stime: resultProcess.stime,
+ cutime: resultProcess.cutime,
+ cstime: resultProcess.cstime
+ };
+ }
+ });
+
+ // store old values
+ _processes_cpu.all = all;
+ _processes_cpu.list = Object.assign({}, list_new);
+ _processes_cpu.ms = Date.now() - _processes_cpu.ms;
+ _processes_cpu.result = Object.assign({}, result);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm';
+ if (_sunos) {
+ cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm';
+ }
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ lines.shift();
+
+ result.list = parseProcesses2(lines).slice();
+ result.all = result.list.length;
+ result.running = result.list.filter(function (e) {
+ return e.state === 'running';
+ }).length;
+ result.blocked = result.list.filter(function (e) {
+ return e.state === 'blocked';
+ }).length;
+ result.sleeping = result.list.filter(function (e) {
+ return e.state === 'sleeping';
+ }).length;
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ }
+ });
+ } else if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_Process | select-Object ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage, @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}} | fl').then((stdout, error) => {
+ if (!error) {
+ let processSections = stdout.split(/\n\s*\n/);
+ let procs = [];
+ let procStats = [];
+ let list_new = {};
+ let allcpuu = 0;
+ let allcpus = 0;
+ processSections.forEach((element) => {
+ if (element.trim() !== '') {
+ let lines = element.trim().split('\r\n');
+ let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10);
+ let parentPid = parseInt(util.getValue(lines, 'ParentProcessId', ':', true), 10);
+ let statusValue = util.getValue(lines, 'ExecutionState', ':');
+ let name = util.getValue(lines, 'Caption', ':', true);
+ let commandLine = util.getValue(lines, 'CommandLine', ':', true);
+ // get additional command line data
+ let additionalCommand = false;
+ lines.forEach((line) => {
+ if (additionalCommand && line.toLowerCase().startsWith(' ')) {
+ commandLine += ' ' + line.trim();
+ } else {
+ additionalCommand = false;
+ }
+ if (line.toLowerCase().startsWith('commandline')) {
+ additionalCommand = true;
+ }
+ });
+ let commandPath = util.getValue(lines, 'ExecutablePath', ':', true);
+ let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
+ let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
+ let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
+ allcpuu = allcpuu + utime;
+ allcpus = allcpus + stime;
+ result.all++;
+ if (!statusValue) { result.unknown++; }
+ if (statusValue === '3') { result.running++; }
+ if (statusValue === '4' || statusValue === '5') { result.blocked++; }
+
+ procStats.push({
+ pid: pid,
+ utime: utime,
+ stime: stime,
+ cpu: 0,
+ cpuu: 0,
+ cpus: 0,
+ });
+ procs.push({
+ pid: pid,
+ parentPid: parentPid,
+ name: name,
+ cpu: 0,
+ cpuu: 0,
+ cpus: 0,
+ mem: memw / os.totalmem() * 100,
+ priority: parseInt(util.getValue(lines, 'Priority', ':', true), 10),
+ memVsz: parseInt(util.getValue(lines, 'PageFileUsage', ':', true), 10),
+ memRss: Math.floor(parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10) / 1024),
+ nice: 0,
+ started: util.getValue(lines, 'CreationDate', ':', true),
+ state: (!statusValue ? _winStatusValues[0] : _winStatusValues[statusValue]),
+ tty: '',
+ user: '',
+ command: commandLine || name,
+ path: commandPath,
+ params: ''
+ });
+ }
+ });
+
+ result.sleeping = result.all - result.running - result.blocked - result.unknown;
+ result.list = procs;
+ procStats.forEach((element) => {
+ let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _processes_cpu);
+
+ // store pcpu in outer array
+ let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid);
+ if (listPos >= 0) {
+ result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus;
+ result.list[listPos].cpuu = resultProcess.cpuu;
+ result.list[listPos].cpus = resultProcess.cpus;
+ }
+
+ // save new values
+ list_new[resultProcess.pid] = {
+ cpuu: resultProcess.cpuu,
+ cpus: resultProcess.cpus,
+ utime: resultProcess.utime,
+ stime: resultProcess.stime
+ };
+ });
+
+ // store old values
+ _processes_cpu.all = allcpuu + allcpus;
+ _processes_cpu.all_utime = allcpuu;
+ _processes_cpu.all_stime = allcpus;
+ _processes_cpu.list = Object.assign({}, list_new);
+ _processes_cpu.ms = Date.now() - _processes_cpu.ms;
+ _processes_cpu.result = Object.assign({}, result);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(_processes_cpu.result); }
+ resolve(_processes_cpu.result);
+ }
+ });
+ });
+}
+
+exports.processes = processes;
+
+// --------------------------
+// PS - process load
+// get detailed information about a certain process
+// (PID, CPU-Usage %, Mem-Usage %)
+
+function processLoad(proc, callback) {
+
+ // fallback - if only callback is given
+ if (util.isFunction(proc) && !callback) {
+ callback = proc;
+ proc = '';
+ }
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ proc = proc || '';
+
+ if (typeof proc !== 'string') {
+ if (callback) { callback([]); }
+ return resolve([]);
+ }
+
+ let processesString = '';
+ processesString.__proto__.toLowerCase = util.stringToLower;
+ processesString.__proto__.replace = util.stringReplace;
+ processesString.__proto__.trim = util.stringTrim;
+
+ const s = util.sanitizeShellString(proc);
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
+ if (s[i] !== undefined) {
+ processesString = processesString + s[i];
+ }
+ }
+
+ processesString = processesString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|');
+ if (processesString === '') {
+ processesString = '*';
+ }
+ if (util.isPrototypePolluted() && processesString !== '*') {
+ processesString = '------';
+ }
+ let processes = processesString.split('|');
+ let result = [];
+
+ const procSanitized = util.isPrototypePolluted() ? '' : util.sanitizeShellString(proc);
+
+ // from here new
+ // let result = {
+ // 'proc': procSanitized,
+ // 'pid': null,
+ // 'cpu': 0,
+ // 'mem': 0
+ // };
+ if (procSanitized && processes.length && processes[0] !== '------') {
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl').then((stdout, error) => {
+ if (!error) {
+ let processSections = stdout.split(/\n\s*\n/);
+ let procStats = [];
+ let list_new = {};
+ let allcpuu = 0;
+ let allcpus = 0;
+
+ // go through all processes
+ processSections.forEach((element) => {
+ if (element.trim() !== '') {
+ let lines = element.trim().split('\r\n');
+ let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10);
+ let name = util.getValue(lines, 'Caption', ':', true);
+ let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
+ let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
+ let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
+ allcpuu = allcpuu + utime;
+ allcpus = allcpus + stime;
+
+ procStats.push({
+ pid: pid,
+ name,
+ utime: utime,
+ stime: stime,
+ cpu: 0,
+ cpuu: 0,
+ cpus: 0,
+ mem
+ });
+ let pname = '';
+ let inList = false;
+ processes.forEach(function (proc) {
+ if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
+ inList = true;
+ pname = proc;
+ }
+ });
+
+ if (processesString === '*' || inList) {
+ let processFound = false;
+ result.forEach(function (item) {
+ if (item.proc.toLowerCase() === pname.toLowerCase()) {
+ item.pids.push(pid);
+ item.mem += mem / os.totalmem() * 100;
+ processFound = true;
+ }
+ });
+ if (!processFound) {
+ result.push({
+ proc: pname,
+ pid: pid,
+ pids: [pid],
+ cpu: 0,
+ mem: mem / os.totalmem() * 100
+ });
+ }
+ }
+ }
+ });
+
+ // add missing processes
+ if (processesString !== '*') {
+ let processesMissing = processes.filter(function (name) {
+ return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0;
+
+ });
+ processesMissing.forEach(function (procName) {
+ result.push({
+ proc: procName,
+ pid: null,
+ pids: [],
+ cpu: 0,
+ mem: 0
+ });
+ });
+ }
+
+ // calculate proc stats for each proc
+ procStats.forEach((element) => {
+ let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _process_cpu);
+
+ let listPos = -1;
+ for (let j = 0; j < result.length; j++) {
+ if (result[j].pid === resultProcess.pid || result[j].pids.indexOf(resultProcess.pid) >= 0) { listPos = j; }
+ }
+ if (listPos >= 0) {
+ result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus;
+ }
+
+ // save new values
+ list_new[resultProcess.pid] = {
+ cpuu: resultProcess.cpuu,
+ cpus: resultProcess.cpus,
+ utime: resultProcess.utime,
+ stime: resultProcess.stime
+ };
+ });
+
+ // store old values
+ _process_cpu.all = allcpuu + allcpus;
+ _process_cpu.all_utime = allcpuu;
+ _process_cpu.all_stime = allcpus;
+ _process_cpu.list = Object.assign({}, list_new);
+ _process_cpu.ms = Date.now() - _process_cpu.ms;
+ _process_cpu.result = JSON.parse(JSON.stringify(result));
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+
+ if (_darwin || _linux || _freebsd || _openbsd || _netbsd) {
+ const params = ['-axo', 'pid,ppid,pcpu,pmem,comm'];
+ util.execSafe('ps', params).then((stdout) => {
+ if (stdout) {
+ let procStats = [];
+ let lines = stdout.toString().split('\n').filter(function (line) {
+ if (processesString === '*') { return true; }
+ if (line.toLowerCase().indexOf('grep') !== -1) { return false; } // remove this??
+ let found = false;
+ processes.forEach(function (item) {
+ found = found || (line.toLowerCase().indexOf(item.toLowerCase()) >= 0);
+ });
+ return found;
+ });
+
+ lines.forEach(function (line) {
+ let data = line.trim().replace(/ +/g, ' ').split(' ');
+ if (data.length > 4) {
+ procStats.push({
+ name: data[4].substring(data[4].lastIndexOf('/') + 1),
+ pid: parseInt(data[0]) || 0,
+ ppid: parseInt(data[1]) || 0,
+ cpu: parseFloat(data[2].replace(',', '.')),
+ mem: parseFloat(data[3].replace(',', '.'))
+ });
+ }
+ });
+
+ procStats.forEach(function (item) {
+ let listPos = -1;
+ let inList = false;
+ let name = '';
+ for (let j = 0; j < result.length; j++) {
+ if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
+ listPos = j;
+ }
+ }
+ processes.forEach(function (proc) {
+
+ if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
+ inList = true;
+ name = proc;
+ }
+ });
+ if ((processesString === '*') || inList) {
+ if (listPos < 0) {
+ result.push({
+ proc: name,
+ pid: item.pid,
+ pids: [item.pid],
+ cpu: item.cpu,
+ mem: item.mem
+ });
+ } else {
+ if (item.ppid < 10) {
+ result[listPos].pid = item.pid;
+ }
+ result[listPos].pids.push(item.pid);
+ result[listPos].cpu += item.cpu;
+ result[listPos].mem += item.mem;
+ }
+ }
+ });
+
+ if (processesString !== '*') {
+ // add missing processes
+ let processesMissing = processes.filter(function (name) {
+ return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0;
+ });
+ processesMissing.forEach(function (procName) {
+ result.push({
+ proc: procName,
+ pid: null,
+ pids: [],
+ cpu: 0,
+ mem: 0
+ });
+ });
+ }
+ if (_linux) {
+ // calc process_cpu - ps is not accurate in linux!
+ result.forEach(function (item) {
+ item.cpu = 0;
+ });
+ let cmd = 'cat /proc/stat | grep "cpu "';
+ for (let i in result) {
+ for (let j in result[i].pids) {
+ cmd += (';cat /proc/' + result[i].pids[j] + '/stat');
+ }
+ }
+ exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
+ let curr_processes = stdout.toString().split('\n');
+
+ // first line (all - /proc/stat)
+ let all = parseProcStat(curr_processes.shift());
+
+ // process
+ let list_new = {};
+ let resultProcess = {};
+ curr_processes.forEach((element) => {
+ resultProcess = calcProcStatLinux(element, all, _process_cpu);
+
+ if (resultProcess.pid) {
+
+ // find result item
+ let resultItemId = -1;
+ for (let i in result) {
+ if (result[i].pids.indexOf(resultProcess.pid) >= 0) {
+ resultItemId = i;
+ }
+ }
+ // store pcpu in outer result
+ if (resultItemId >= 0) {
+ result[resultItemId].cpu += resultProcess.cpuu + resultProcess.cpus;
+ }
+
+ // save new values
+ list_new[resultProcess.pid] = {
+ cpuu: resultProcess.cpuu,
+ cpus: resultProcess.cpus,
+ utime: resultProcess.utime,
+ stime: resultProcess.stime,
+ cutime: resultProcess.cutime,
+ cstime: resultProcess.cstime
+ };
+ }
+ });
+
+ result.forEach(function (item) {
+ item.cpu = Math.round(item.cpu * 100) / 100;
+ });
+
+ _process_cpu.all = all;
+ _process_cpu.list = Object.assign({}, list_new);
+ _process_cpu.ms = Date.now() - _process_cpu.ms;
+ _process_cpu.result = Object.assign({}, result);
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ }
+ }
+ });
+ });
+}
+
+exports.processLoad = processLoad;
diff --git a/node_modules/systeminformation/lib/system.js b/node_modules/systeminformation/lib/system.js
new file mode 100644
index 0000000..b546548
--- /dev/null
+++ b/node_modules/systeminformation/lib/system.js
@@ -0,0 +1,720 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// system.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 2. System (Hardware, BIOS, Base Board)
+// ----------------------------------------------------------------------------------
+
+const fs = require('fs');
+const os = require('os');
+const util = require('./util');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const execPromise = util.promisify(require('child_process').exec);
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function system(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ manufacturer: '',
+ model: 'Computer',
+ version: '',
+ serial: '-',
+ uuid: '-',
+ sku: '-',
+ virtual: false
+ };
+
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ result.manufacturer = util.getValue(lines, 'manufacturer');
+ result.model = util.getValue(lines, 'product name');
+ result.version = util.getValue(lines, 'version');
+ result.serial = util.getValue(lines, 'serial number');
+ result.uuid = util.getValue(lines, 'uuid').toLowerCase();
+ result.sku = util.getValue(lines, 'sku number');
+ // Non-Root values
+ const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo;
+ echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo;
+ echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo;
+ echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo;
+ echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`;
+ try {
+ lines = execSync(cmd).toString().split('\n');
+ result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer;
+ result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model;
+ result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version;
+ result.serial = result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial;
+ result.uuid = result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid;
+ } catch (e) {
+ util.noop();
+ }
+ if (!result.serial || result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; }
+ if (!result.manufacturer || result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = ''; }
+ if (!result.model || result.model.toLowerCase().indexOf('o.e.m.') !== -1) { result.model = 'Computer'; }
+ if (!result.version || result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = ''; }
+ if (!result.sku || result.sku.toLowerCase().indexOf('o.e.m.') !== -1) { result.sku = '-'; }
+
+ // detect virtual (1)
+ if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) {
+ result.virtual = true;
+ switch (result.model.toLowerCase()) {
+ case 'virtualbox':
+ result.virtualHost = 'VirtualBox';
+ break;
+ case 'vmware':
+ result.virtualHost = 'VMware';
+ break;
+ case 'kvm':
+ result.virtualHost = 'KVM';
+ break;
+ case 'bochs':
+ result.virtualHost = 'bochs';
+ break;
+ }
+ }
+ if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
+ result.virtual = true;
+ switch (result.manufacturer.toLowerCase()) {
+ case 'vmware':
+ result.virtualHost = 'VMware';
+ break;
+ case 'xen':
+ result.virtualHost = 'Xen';
+ break;
+ }
+ }
+ if (!result.virtual) {
+ try {
+ const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null').toString();
+ if (disksById.indexOf('_QEMU_') >= 0) {
+ result.virtual = true;
+ result.virtualHost = 'QEMU';
+ }
+ if (disksById.indexOf('_VBOX_') >= 0) {
+ result.virtual = true;
+ result.virtualHost = 'VirtualBox';
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ if (!result.virtual && (os.release().toLowerCase().indexOf('microsoft') >= 0 || os.release().toLowerCase().endsWith('wsl2'))) {
+ const kernelVersion = parseFloat(os.release().toLowerCase());
+ result.virtual = true;
+ result.manufacturer = 'Microsoft';
+ result.model = 'WSL';
+ result.version = kernelVersion < 4.19 ? '1' : '2';
+ }
+ if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) {
+ try {
+ const procInfo = execSync('dmidecode -t 4');
+ const procLines = procInfo.toString().split('\n');
+ const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true);
+ switch (procManufacturer.toLowerCase()) {
+ case 'virtualbox':
+ result.virtualHost = 'VirtualBox';
+ break;
+ case 'vmware':
+ result.virtualHost = 'VMware';
+ break;
+ case 'kvm':
+ result.virtualHost = 'KVM';
+ break;
+ case 'bochs':
+ result.virtualHost = 'bochs';
+ break;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ }
+ // detect docker
+ if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) {
+ result.model = 'Docker Container';
+ }
+ try {
+ const stdout = execSync('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -viE "Nested Virtualization|/virtual/"');
+ // detect virtual machines
+ let lines = stdout.toString().split('\n');
+ if (lines.length > 0) {
+ if (result.model === 'Computer') { result.model = 'Virtual machine'; }
+ result.virtual = true;
+ if (stdout.toString().toLowerCase().indexOf('vmware') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'VMware';
+ }
+ if (stdout.toString().toLowerCase().indexOf('qemu') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'QEMU';
+ }
+ if (stdout.toString().toLowerCase().indexOf('xen') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'Xen';
+ }
+ if (stdout.toString().toLowerCase().indexOf('kvm') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'KVM';
+ }
+ }
+ } catch (e) {
+ util.noop();
+ }
+
+ if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') {
+ // Check Raspberry Pi
+ fs.readFile('/proc/cpuinfo', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().split('\n');
+ result.model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
+ result.version = util.getValue(lines, 'revision', ':', true).toLowerCase();
+ result.serial = util.getValue(lines, 'serial', ':', true);
+ const model = util.getValue(lines, 'model:', ':', true);
+ // reference values: https://elinux.org/RPi_HardwareHistory
+ // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
+ if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2710' || result.model === 'BCM2711' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) {
+ const rPIRevision = util.decodePiCpuinfo(lines);
+ result.model = rPIRevision.model;
+ result.version = rPIRevision.revisionCode;
+ result.manufacturer = 'Raspberry Pi Foundation';
+ result.raspberry = {
+ manufacturer: rPIRevision.manufacturer,
+ processor: rPIRevision.processor,
+ type: rPIRevision.type,
+ revision: rPIRevision.revision
+ };
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ }
+ if (_darwin) {
+ exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
+ result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
+ result.model = util.getValue(lines, 'model', '=', true, true);
+ result.version = util.getValue(lines, 'version', '=', true);
+ result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
+ result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
+ result.sku = util.getValue(lines, 'board-id', '=', true);
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.split('\r\n');
+ result.manufacturer = util.getValue(lines, 'vendor', ':');
+ result.model = util.getValue(lines, 'name', ':');
+ result.version = util.getValue(lines, 'version', ':');
+ result.serial = util.getValue(lines, 'identifyingnumber', ':');
+ result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase();
+ // detect virtual (1)
+ const model = result.model.toLowerCase();
+ if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu') || model.startsWith('parallels')) {
+ result.virtual = true;
+ if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; }
+ if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; }
+ if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; }
+ if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; }
+ if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; }
+ if (model.startsWith('parallels')) { result.virtualHost = 'Parallels'; }
+ }
+ const manufacturer = result.manufacturer.toLowerCase();
+ if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen' || manufacturer.startsWith('parallels')) {
+ result.virtual = true;
+ if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; }
+ if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; }
+ if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; }
+ if (manufacturer.startsWith('parallels')) { result.virtualHost = 'Parallels'; }
+ }
+ util.powerShell('Get-CimInstance MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.split('\r\n');
+ result.sku = util.getValue(lines, 'systemsku', ':');
+ }
+ if (!result.virtual) {
+ util.powerShell('Get-CimInstance Win32_bios | select Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.toString();
+ if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0 || lines.indexOf('Parallels') >= 0) {
+ result.virtual = true;
+ if (lines.indexOf('VirtualBox') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'VirtualBox';
+ }
+ if (lines.indexOf('VMware') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'VMware';
+ }
+ if (lines.indexOf('Xen') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'Xen';
+ }
+ if (lines.indexOf('VRTUAL') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'Hyper-V';
+ }
+ if (lines.indexOf('A M I') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'Virtual PC';
+ }
+ if (lines.indexOf('Parallels') >= 0 && !result.virtualHost) {
+ result.virtualHost = 'Parallels';
+ }
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.system = system;
+
+function bios(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ vendor: '',
+ version: '',
+ releaseDate: '',
+ revision: '',
+ };
+ let cmd = '';
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ if (process.arch === 'arm') {
+ cmd = 'cat /proc/cpuinfo | grep Serial';
+ } else {
+ cmd = 'export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL';
+ }
+ exec(cmd, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ result.vendor = util.getValue(lines, 'Vendor');
+ result.version = util.getValue(lines, 'Version');
+ let datetime = util.getValue(lines, 'Release Date');
+ result.releaseDate = util.parseDateTime(datetime).date;
+ result.revision = util.getValue(lines, 'BIOS Revision');
+ result.serial = util.getValue(lines, 'SerialNumber');
+ let language = util.getValue(lines, 'Currently Installed Language').split('|')[0];
+ if (language) {
+ result.language = language;
+ }
+ if (lines.length && stdout.toString().indexOf('Characteristics:') >= 0) {
+ const features = [];
+ lines.forEach(line => {
+ if (line.indexOf(' is supported') >= 0) {
+ const feature = line.split(' is supported')[0].trim();
+ features.push(feature);
+ }
+ });
+ result.features = features;
+ }
+ // Non-Root values
+ const cmd = `echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo;
+ echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;
+ echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`;
+ try {
+ lines = execSync(cmd).toString().split('\n');
+ result.vendor = !result.vendor ? util.getValue(lines, 'bios_vendor') : result.vendor;
+ result.version = !result.version ? util.getValue(lines, 'bios_version') : result.version;
+ datetime = util.getValue(lines, 'bios_date');
+ result.releaseDate = !result.releaseDate ? util.parseDateTime(datetime).date : result.releaseDate;
+ } catch (e) {
+ util.noop();
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ result.vendor = 'Apple Inc.';
+ exec(
+ 'system_profiler SPHardwareDataType -json', function (error, stdout) {
+ try {
+ const hardwareData = JSON.parse(stdout.toString());
+ if (hardwareData && hardwareData.SPHardwareDataType && hardwareData.SPHardwareDataType.length) {
+ let bootRomVersion = hardwareData.SPHardwareDataType[0].boot_rom_version;
+ bootRomVersion = bootRomVersion ? bootRomVersion.split('(')[0].trim() : null;
+ result.version = bootRomVersion;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ result.vendor = 'Sun Microsystems';
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber | fl').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.toString().split('\r\n');
+ const description = util.getValue(lines, 'description', ':');
+ if (description.indexOf(' Version ') !== -1) {
+ // ... Phoenix ROM BIOS PLUS Version 1.10 A04
+ result.vendor = description.split(' Version ')[0].trim();
+ result.version = description.split(' Version ')[1].trim();
+ } else if (description.indexOf(' Ver: ') !== -1) {
+ // ... BIOS Date: 06/27/16 17:50:16 Ver: 1.4.5
+ result.vendor = util.getValue(lines, 'manufacturer', ':');
+ result.version = description.split(' Ver: ')[1].trim();
+ } else {
+ result.vendor = util.getValue(lines, 'manufacturer', ':');
+ result.version = util.getValue(lines, 'version', ':');
+ }
+ result.releaseDate = util.getValue(lines, 'releasedate', ':');
+ result.revision = util.getValue(lines, 'buildnumber', ':');
+ result.serial = util.getValue(lines, 'serialnumber', ':');
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.bios = bios;
+
+function baseboard(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ manufacturer: '',
+ model: '',
+ version: '',
+ serial: '-',
+ assetTag: '-',
+ memMax: null,
+ memSlots: null
+ };
+ let cmd = '';
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ if (process.arch === 'arm') {
+ cmd = 'cat /proc/cpuinfo | grep Serial';
+ // 'BCM2709', 'BCM2835', 'BCM2708' -->
+ } else {
+ cmd = 'export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL';
+ }
+ const workload = [];
+ workload.push(execPromise(cmd));
+ workload.push(execPromise('export LC_ALL=C; dmidecode -t memory 2>/dev/null'));
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ let lines = data.results[0] ? data.results[0].toString().split('\n') : [''];
+ result.manufacturer = util.getValue(lines, 'Manufacturer');
+ result.model = util.getValue(lines, 'Product Name');
+ result.version = util.getValue(lines, 'Version');
+ result.serial = util.getValue(lines, 'Serial Number');
+ result.assetTag = util.getValue(lines, 'Asset Tag');
+ // Non-Root values
+ const cmd = `echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo;
+ echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo;
+ echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo;
+ echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;
+ echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`;
+ try {
+ lines = execSync(cmd).toString().split('\n');
+ result.manufacturer = !result.manufacturer ? util.getValue(lines, 'board_vendor') : result.manufacturer;
+ result.model = !result.model ? util.getValue(lines, 'board_name') : result.model;
+ result.version = !result.version ? util.getValue(lines, 'board_version') : result.version;
+ result.serial = !result.serial ? util.getValue(lines, 'board_serial') : result.serial;
+ result.assetTag = !result.assetTag ? util.getValue(lines, 'board_asset_tag') : result.assetTag;
+ } catch (e) {
+ util.noop();
+ }
+ if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; }
+ if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; }
+
+ // mem
+ lines = data.results[1] ? data.results[1].toString().split('\n') : [''];
+ result.memMax = util.toInt(util.getValue(lines, 'Maximum Capacity')) * 1024 * 1024 * 1024 || null;
+ result.memSlots = util.toInt(util.getValue(lines, 'Number Of Devices')) || null;
+
+ // raspberry
+ let linesRpi = '';
+ try {
+ linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
+ } catch (e) {
+ util.noop();
+ }
+ const hardware = util.getValue(linesRpi, 'hardware');
+ if (hardware.startsWith('BCM')) {
+ const rpi = util.decodePiCpuinfo(linesRpi);
+ result.manufacturer = rpi.manufacturer;
+ result.model = 'Raspberry Pi';
+ result.serial = rpi.serial;
+ result.version = rpi.type + ' - ' + rpi.revision;
+ result.memMax = os.totalmem();
+ result.memSlots = 0;
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ const workload = [];
+ workload.push(execPromise('ioreg -c IOPlatformExpertDevice -d 2'));
+ workload.push(execPromise('system_profiler SPMemoryDataType'));
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ let lines = data.results[0] ? data.results[0].toString().replace(/[<>"]/g, '').split('\n') : [''];
+ result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
+ result.model = util.getValue(lines, 'model', '=', true);
+ result.version = util.getValue(lines, 'version', '=', true);
+ result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
+ result.assetTag = util.getValue(lines, 'board-id', '=', true);
+
+ // mem
+ let devices = data.results[1] ? data.results[1].toString().split(' BANK ') : [''];
+ if (devices.length === 1) {
+ devices = data.results[1] ? data.results[1].toString().split(' DIMM') : [''];
+ }
+ devices.shift();
+ result.memSlots = devices.length;
+
+ if (os.arch() === 'arm64') {
+ result.memSlots = 0;
+ result.memMax = os.totalmem();
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ const workload = [];
+ const win10plus = parseInt(os.release()) >= 10;
+ const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity';
+ workload.push(util.powerShell('Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
+ workload.push(util.powerShell(`Get-CimInstance Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`));
+ util.promiseAll(
+ workload
+ ).then((data) => {
+ let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
+
+ result.manufacturer = util.getValue(lines, 'manufacturer', ':');
+ result.model = util.getValue(lines, 'model', ':');
+ if (!result.model) {
+ result.model = util.getValue(lines, 'product', ':');
+ }
+ result.version = util.getValue(lines, 'version', ':');
+ result.serial = util.getValue(lines, 'serialnumber', ':');
+ result.assetTag = util.getValue(lines, 'partnumber', ':');
+ if (!result.assetTag) {
+ result.assetTag = util.getValue(lines, 'sku', ':');
+ }
+
+ // memphysical
+ lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];
+ result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null;
+ result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null;
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.baseboard = baseboard;
+
+function chassis(callback) {
+ const chassisTypes = ['Other',
+ 'Unknown',
+ 'Desktop',
+ 'Low Profile Desktop',
+ 'Pizza Box',
+ 'Mini Tower',
+ 'Tower',
+ 'Portable',
+ 'Laptop',
+ 'Notebook',
+ 'Hand Held',
+ 'Docking Station',
+ 'All in One',
+ 'Sub Notebook',
+ 'Space-Saving',
+ 'Lunch Box',
+ 'Main System Chassis',
+ 'Expansion Chassis',
+ 'SubChassis',
+ 'Bus Expansion Chassis',
+ 'Peripheral Chassis',
+ 'Storage Chassis',
+ 'Rack Mount Chassis',
+ 'Sealed-Case PC',
+ 'Multi-System Chassis',
+ 'Compact PCI',
+ 'Advanced TCA',
+ 'Blade',
+ 'Blade Enclosure',
+ 'Tablet',
+ 'Convertible',
+ 'Detachable',
+ 'IoT Gateway ',
+ 'Embedded PC',
+ 'Mini PC',
+ 'Stick PC',
+ ];
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+
+ let result = {
+ manufacturer: '',
+ model: '',
+ type: '',
+ version: '',
+ serial: '-',
+ assetTag: '-',
+ sku: '',
+ };
+ if (_linux || _freebsd || _openbsd || _netbsd) {
+ const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;
+ echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;
+ echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;
+ echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo;
+ echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;`;
+ exec(cmd, function (error, stdout) {
+ let lines = stdout.toString().split('\n');
+ result.manufacturer = util.getValue(lines, 'chassis_vendor');
+ const ctype = parseInt(util.getValue(lines, 'chassis_type').replace(/\D/g, ''));
+ result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : '';
+ result.version = util.getValue(lines, 'chassis_version');
+ result.serial = util.getValue(lines, 'chassis_serial');
+ result.assetTag = util.getValue(lines, 'chassis_asset_tag');
+ if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = '-'; }
+ if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = '-'; }
+ if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; }
+ if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
+ if (!error) {
+ let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
+ result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
+ result.model = util.getValue(lines, 'model', '=', true);
+ result.version = util.getValue(lines, 'version', '=', true);
+ result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
+ result.assetTag = util.getValue(lines, 'board-id', '=', true);
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ if (_windows) {
+ try {
+ util.powerShell('Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU | fl').then((stdout, error) => {
+ if (!error) {
+ let lines = stdout.toString().split('\r\n');
+
+ result.manufacturer = util.getValue(lines, 'manufacturer', ':');
+ result.model = util.getValue(lines, 'model', ':');
+ const ctype = parseInt(util.getValue(lines, 'ChassisTypes', ':').replace(/\D/g, ''));
+ result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : '';
+ result.version = util.getValue(lines, 'version', ':');
+ result.serial = util.getValue(lines, 'serialnumber', ':');
+ result.assetTag = util.getValue(lines, 'partnumber', ':');
+ result.sku = util.getValue(lines, 'sku', ':');
+ if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = '-'; }
+ if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = '-'; }
+ if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; }
+ if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; }
+ }
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+exports.chassis = chassis;
diff --git a/node_modules/systeminformation/lib/usb.js b/node_modules/systeminformation/lib/usb.js
new file mode 100644
index 0000000..b882520
--- /dev/null
+++ b/node_modules/systeminformation/lib/usb.js
@@ -0,0 +1,274 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// usb.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 16. usb
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function getLinuxUsbType(type, name) {
+ let result = type;
+ const str = (name + ' ' + type).toLowerCase();
+ if (str.indexOf('camera') >= 0) { result = 'Camera'; }
+ else if (str.indexOf('hub') >= 0) { result = 'Hub'; }
+ else if (str.indexOf('keybrd') >= 0) { result = 'Keyboard'; }
+ else if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
+ else if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
+ else if (str.indexOf('stora') >= 0) { result = 'Storage'; }
+ else if (str.indexOf('mic') >= 0) { result = 'Microphone'; }
+ else if (str.indexOf('headset') >= 0) { result = 'Audio'; }
+ else if (str.indexOf('audio') >= 0) { result = 'Audio'; }
+
+ return result;
+}
+
+function parseLinuxUsb(usb) {
+ const result = {};
+ const lines = usb.split('\n');
+ if (lines && lines.length && lines[0].indexOf('Device') >= 0) {
+ const parts = lines[0].split(' ');
+ result.bus = parseInt(parts[0], 10);
+ if (parts[2]) {
+ result.deviceId = parseInt(parts[2], 10);
+ } else {
+ result.deviceId = null;
+ }
+ } else {
+ result.bus = null;
+ result.deviceId = null;
+ }
+ const idVendor = util.getValue(lines, 'idVendor', ' ', true).trim();
+ let vendorParts = idVendor.split(' ');
+ vendorParts.shift();
+ const vendor = vendorParts.join(' ');
+
+ const idProduct = util.getValue(lines, 'idProduct', ' ', true).trim();
+ let productParts = idProduct.split(' ');
+ productParts.shift();
+ const product = productParts.join(' ');
+
+ const interfaceClass = util.getValue(lines, 'bInterfaceClass', ' ', true).trim();
+ let interfaceClassParts = interfaceClass.split(' ');
+ interfaceClassParts.shift();
+ const usbType = interfaceClassParts.join(' ');
+
+ const iManufacturer = util.getValue(lines, 'iManufacturer', ' ', true).trim();
+ let iManufacturerParts = iManufacturer.split(' ');
+ iManufacturerParts.shift();
+ const manufacturer = iManufacturerParts.join(' ');
+
+ result.id = (idVendor.startsWith('0x') ? idVendor.split(' ')[0].substr(2, 10) : '') + ':' + (idProduct.startsWith('0x') ? idProduct.split(' ')[0].substr(2, 10) : '');
+ result.name = product;
+ result.type = getLinuxUsbType(usbType, product);
+ result.removable = null;
+ result.vendor = vendor;
+ result.manufacturer = manufacturer;
+ result.maxPower = util.getValue(lines, 'MaxPower', ' ', true);
+ result.serialNumber = null;
+
+ return result;
+}
+
+function getDarwinUsbType(name) {
+ let result = '';
+ if (name.indexOf('camera') >= 0) { result = 'Camera'; }
+ else if (name.indexOf('touch bar') >= 0) { result = 'Touch Bar'; }
+ else if (name.indexOf('controller') >= 0) { result = 'Controller'; }
+ else if (name.indexOf('headset') >= 0) { result = 'Audio'; }
+ else if (name.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
+ else if (name.indexOf('trackpad') >= 0) { result = 'Trackpad'; }
+ else if (name.indexOf('sensor') >= 0) { result = 'Sensor'; }
+ else if (name.indexOf('bthusb') >= 0) { result = 'Bluetooth'; }
+ else if (name.indexOf('bth') >= 0) { result = 'Bluetooth'; }
+ else if (name.indexOf('rfcomm') >= 0) { result = 'Bluetooth'; }
+ else if (name.indexOf('usbhub') >= 0) { result = 'Hub'; }
+ else if (name.indexOf(' hub') >= 0) { result = 'Hub'; }
+ else if (name.indexOf('mouse') >= 0) { result = 'Mouse'; }
+ else if (name.indexOf('mic') >= 0) { result = 'Microphone'; }
+ else if (name.indexOf('removable') >= 0) { result = 'Storage'; }
+ return result;
+}
+
+
+function parseDarwinUsb(usb, id) {
+ const result = {};
+ result.id = id;
+
+ usb = usb.replace(/ \|/g, '');
+ usb = usb.trim();
+ let lines = usb.split('\n');
+ lines.shift();
+ try {
+ for (let i = 0; i < lines.length; i++) {
+ lines[i] = lines[i].trim();
+ lines[i] = lines[i].replace(/=/g, ':');
+ if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') {
+ lines[i] = lines[i] + ',';
+ }
+
+ lines[i] = lines[i].replace(':Yes,', ':"Yes",');
+ lines[i] = lines[i].replace(': Yes,', ': "Yes",');
+ lines[i] = lines[i].replace(': Yes', ': "Yes"');
+ lines[i] = lines[i].replace(':No,', ':"No",');
+ lines[i] = lines[i].replace(': No,', ': "No",');
+ lines[i] = lines[i].replace(': No', ': "No"');
+
+ // In this case (("com.apple.developer.driverkit.transport.usb"))
+ lines[i] = lines[i].replace('((', '').replace('))', '');
+
+ // In case we have <923c11> we need make it "<923c11>" for correct JSON parse
+ const match = /<(\w+)>/.exec(lines[i]);
+ if (match) {
+ const number = match[0];
+ lines[i] = lines[i].replace(number, `"${number}"`);
+ }
+ }
+ const usbObj = JSON.parse(lines.join('\n'));
+ const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true);
+
+ result.bus = null;
+ result.deviceId = null;
+ result.id = usbObj['USB Address'] || null;
+ result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null;
+ result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : ''));
+ result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true;
+ result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
+ result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
+
+ result.maxPower = null;
+ result.serialNumber = usbObj['kUSBSerialNumberString'] || null;
+
+ if (result.name) {
+ return result;
+ } else {
+ return null;
+ }
+ } catch (e) {
+ return null;
+ }
+}
+
+function getWindowsUsbTypeCreation(creationclass, name) {
+ let result = '';
+ if (name.indexOf('storage') >= 0) { result = 'Storage'; }
+ else if (name.indexOf('speicher') >= 0) { result = 'Storage'; }
+ else if (creationclass.indexOf('usbhub') >= 0) { result = 'Hub'; }
+ else if (creationclass.indexOf('storage') >= 0) { result = 'Storage'; }
+ else if (creationclass.indexOf('usbcontroller') >= 0) { result = 'Controller'; }
+ else if (creationclass.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
+ else if (creationclass.indexOf('pointing') >= 0) { result = 'Mouse'; }
+ else if (creationclass.indexOf('disk') >= 0) { result = 'Storage'; }
+ return result;
+}
+
+function parseWindowsUsb(lines, id) {
+ const usbType = getWindowsUsbTypeCreation(util.getValue(lines, 'CreationClassName', ':').toLowerCase(), util.getValue(lines, 'name', ':').toLowerCase());
+
+ if (usbType) {
+ const result = {};
+ result.bus = null;
+ result.deviceId = util.getValue(lines, 'deviceid', ':');
+ result.id = id;
+ result.name = util.getValue(lines, 'name', ':');
+ result.type = usbType;
+ result.removable = null;
+ result.vendor = null;
+ result.manufacturer = util.getValue(lines, 'Manufacturer', ':');
+ result.maxPower = null;
+ result.serialNumber = null;
+
+ return result;
+ } else {
+ return null;
+ }
+}
+
+function usb(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux) {
+ const cmd = 'export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL';
+ exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) {
+ if (!error) {
+ const parts = ('\n\n' + stdout.toString()).split('\n\nBus ');
+ for (let i = 1; i < parts.length; i++) {
+ const usb = parseLinuxUsb(parts[i]);
+ result.push(usb);
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_darwin) {
+ let cmd = 'ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l';
+ exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) {
+ if (!error) {
+ const parts = (stdout.toString()).split(' +-o ');
+ for (let i = 1; i < parts.length; i++) {
+ const usb = parseDarwinUsb(parts[i]);
+ if (usb) {
+ result.push(usb);
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ util.powerShell('Get-CimInstance CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((stdout, error) => {
+ if (!error) {
+ const parts = stdout.toString().split(/\n\s*\n/);
+ for (let i = 0; i < parts.length; i++) {
+ const usb = parseWindowsUsb(parts[i].split('\n'), i);
+ if (usb) {
+ result.push(usb);
+ }
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ if (_sunos || _freebsd || _openbsd || _netbsd) {
+ resolve(null);
+ }
+ });
+ });
+}
+
+exports.usb = usb;
+
diff --git a/node_modules/systeminformation/lib/users.js b/node_modules/systeminformation/lib/users.js
new file mode 100644
index 0000000..871822d
--- /dev/null
+++ b/node_modules/systeminformation/lib/users.js
@@ -0,0 +1,363 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// users.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 11. Users/Sessions
+// ----------------------------------------------------------------------------------
+
+const exec = require('child_process').exec;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+const _sunos = (_platform === 'sunos');
+
+function parseUsersLinux(lines, phase) {
+ let result = [];
+ let result_who = [];
+ let result_w = {};
+ let w_first = true;
+ let w_header = [];
+ let w_pos = [];
+ let who_line = {};
+
+ let is_whopart = true;
+ lines.forEach(function (line) {
+ if (line === '---') {
+ is_whopart = false;
+ } else {
+ let l = line.replace(/ +/g, ' ').split(' ');
+
+ // who part
+ if (is_whopart) {
+ result_who.push({
+ user: l[0],
+ tty: l[1],
+ date: l[2],
+ time: l[3],
+ ip: (l && l.length > 4) ? l[4].replace(/\(/g, '').replace(/\)/g, '') : ''
+ });
+ } else {
+ // w part
+ if (w_first) { // header
+ w_header = l;
+ w_header.forEach(function (item) {
+ w_pos.push(line.indexOf(item));
+ });
+ w_first = false;
+ } else {
+ // split by w_pos
+ result_w.user = line.substring(w_pos[0], w_pos[1] - 1).trim();
+ result_w.tty = line.substring(w_pos[1], w_pos[2] - 1).trim();
+ result_w.ip = line.substring(w_pos[2], w_pos[3] - 1).replace(/\(/g, '').replace(/\)/g, '').trim();
+ result_w.command = line.substring(w_pos[7], 1000).trim();
+ // find corresponding 'who' line
+ who_line = result_who.filter(function (obj) {
+ return (obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty);
+ });
+ if (who_line.length === 1) {
+ result.push({
+ user: who_line[0].user,
+ tty: who_line[0].tty,
+ date: who_line[0].date,
+ time: who_line[0].time,
+ ip: who_line[0].ip,
+ command: result_w.command
+ });
+ }
+ }
+ }
+ }
+ });
+ if (result.length === 0 && phase === 2) {
+ return result_who;
+ } else {
+ return result;
+ }
+}
+
+function parseUsersDarwin(lines) {
+ let result = [];
+ let result_who = [];
+ let result_w = {};
+ let who_line = {};
+
+ let is_whopart = true;
+ lines.forEach(function (line) {
+ if (line === '---') {
+ is_whopart = false;
+ } else {
+ let l = line.replace(/ +/g, ' ').split(' ');
+
+ // who part
+ if (is_whopart) {
+ result_who.push({
+ user: l[0],
+ tty: l[1],
+ date: ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2),
+ time: l[4],
+ });
+ } else {
+ // w part
+ // split by w_pos
+ result_w.user = l[0];
+ result_w.tty = l[1];
+ result_w.ip = (l[2] !== '-') ? l[2] : '';
+ result_w.command = l.slice(5, 1000).join(' ');
+ // find corresponding 'who' line
+ who_line = result_who.filter(function (obj) {
+ return (obj.user === result_w.user && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty));
+ });
+ if (who_line.length === 1) {
+ result.push({
+ user: who_line[0].user,
+ tty: who_line[0].tty,
+ date: who_line[0].date,
+ time: who_line[0].time,
+ ip: result_w.ip,
+ command: result_w.command
+ });
+ }
+ }
+ }
+ });
+ return result;
+}
+
+function users(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+
+ // linux
+ if (_linux) {
+ exec('who --ips; echo "---"; w | tail -n +2', function (error, stdout) {
+ if (!error) {
+ // lines / split
+ let lines = stdout.toString().split('\n');
+ result = parseUsersLinux(lines, 1);
+ if (result.length === 0) {
+ exec('who; echo "---"; w | tail -n +2', function (error, stdout) {
+ if (!error) {
+ // lines / split
+ lines = stdout.toString().split('\n');
+ result = parseUsersLinux(lines, 2);
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ } else {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ }
+ if (_freebsd || _openbsd || _netbsd) {
+ exec('who; echo "---"; w -ih', function (error, stdout) {
+ if (!error) {
+ // lines / split
+ let lines = stdout.toString().split('\n');
+ result = parseUsersDarwin(lines);
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_sunos) {
+ exec('who; echo "---"; w -h', function (error, stdout) {
+ if (!error) {
+ // lines / split
+ let lines = stdout.toString().split('\n');
+ result = parseUsersDarwin(lines);
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+
+ if (_darwin) {
+ exec('who; echo "---"; w -ih', function (error, stdout) {
+ if (!error) {
+ // lines / split
+ let lines = stdout.toString().split('\n');
+ result = parseUsersDarwin(lines);
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ }
+ if (_windows) {
+ try {
+ let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + '; echo \'#-#-#-#\';';
+ cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';';
+ cmd += '$process = (Get-CimInstance Win32_Process -Filter "name = \'explorer.exe\'"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo \'#-#-#-#\';';
+ cmd += 'query user';
+ util.powerShell(cmd).then((data) => {
+ if (data) {
+ data = data.split('#-#-#-#');
+ let sessions = parseWinSessions((data[0] || '').split(/\n\s*\n/));
+ let loggedons = parseWinLoggedOn((data[1] || '').split(/\n\s*\n/));
+ let queryUser = parseWinUsersQuery((data[3] || '').split('\r\n'));
+ let users = parseWinUsers((data[2] || '').split(/\n\s*\n/), queryUser);
+ for (let id in loggedons) {
+ if ({}.hasOwnProperty.call(loggedons, id)) {
+ loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
+ }
+ }
+ users.forEach(user => {
+ let dateTime = '';
+ for (let id in loggedons) {
+ if ({}.hasOwnProperty.call(loggedons, id)) {
+ if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) {
+ dateTime = loggedons[id].dateTime;
+ }
+ }
+ }
+
+ result.push({
+ user: user.user,
+ tty: user.tty,
+ date: `${dateTime.substring(0, 10)}`,
+ time: `${dateTime.substring(11, 19)}`,
+ ip: '',
+ command: ''
+ });
+ });
+ }
+ if (callback) { callback(result); }
+ resolve(result);
+
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ }
+ });
+ });
+}
+
+function parseWinSessions(sessionParts) {
+ const sessions = {};
+ sessionParts.forEach(session => {
+ const lines = session.split('\r\n');
+ const id = util.getValue(lines, 'LogonId');
+ const starttime = util.getValue(lines, 'starttime');
+ if (id) {
+ sessions[id] = starttime;
+ }
+ });
+ return sessions;
+}
+
+function fuzzyMatch(name1, name2) {
+ name1 = name1.toLowerCase();
+ name2 = name2.toLowerCase();
+ let eq = 0;
+ let len = name1.length;
+ if (name2.length > len) { len = name2.length; }
+
+ for (let i = 0; i < len; i++) {
+ const c1 = name1[i] || '';
+ const c2 = name2[i] || '';
+ if (c1 === c2) { eq++; }
+ }
+ return (len > 10 ? eq / len > 0.9 : (len > 0 ? eq / len > 0.8 : false));
+}
+
+function parseWinUsers(userParts, userQuery) {
+ const users = [];
+ userParts.forEach(user => {
+ const lines = user.split('\r\n');
+
+ const domain = util.getValue(lines, 'domain', ':', true);
+ const username = util.getValue(lines, 'user', ':', true);
+ const sessionid = util.getValue(lines, 'sessionid', ':', true);
+
+ if (username) {
+ const quser = userQuery.filter(item => fuzzyMatch(item.user, username));
+ users.push({
+ domain,
+ user: username,
+ tty: quser && quser[0] && quser[0].tty ? quser[0].tty : sessionid
+ });
+ }
+ });
+ return users;
+}
+
+function parseWinLoggedOn(loggedonParts) {
+ const loggedons = {};
+ loggedonParts.forEach(loggedon => {
+ const lines = loggedon.split('\r\n');
+
+ const antecendent = util.getValue(lines, 'antecedent', ':', true);
+ let parts = antecendent.split('=');
+ const name = parts.length > 2 ? parts[1].split(',')[0].replace(/"/g, '').trim() : '';
+ const domain = parts.length > 2 ? parts[2].replace(/"/g, '').replace(/\)/g, '').trim() : '';
+ const dependent = util.getValue(lines, 'dependent', ':', true);
+ parts = dependent.split('=');
+ const id = parts.length > 1 ? parts[1].replace(/"/g, '').replace(/\)/g, '').trim() : '';
+ if (id) {
+ loggedons[id] = {
+ domain,
+ user: name
+ };
+ }
+ });
+ return loggedons;
+}
+
+function parseWinUsersQuery(lines) {
+ lines = lines.filter(item => item);
+ let result = [];
+ const header = lines[0];
+ const headerDelimiter = [];
+ if (header) {
+ const start = (header[0] === ' ') ? 1 : 0;
+ headerDelimiter.push(start - 1);
+ let nextSpace = 0;
+ for (let i = start + 1; i < header.length; i++) {
+ if (header[i] === ' ' && ((header[i - 1] === ' ') || (header[i - 1] === '.'))) {
+ nextSpace = i;
+ } else {
+ if (nextSpace) {
+ headerDelimiter.push(nextSpace);
+ nextSpace = 0;
+ }
+ }
+ }
+ for (let i = 1; i < lines.length; i++) {
+ if (lines[i].trim()) {
+ const user = lines[i].substring(headerDelimiter[0] + 1, headerDelimiter[1]).trim() || '';
+ const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || '';
+ result.push({
+ user: user,
+ tty: tty,
+ });
+ }
+ }
+ }
+ return result;
+}
+
+exports.users = users;
diff --git a/node_modules/systeminformation/lib/util.js b/node_modules/systeminformation/lib/util.js
new file mode 100644
index 0000000..df27342
--- /dev/null
+++ b/node_modules/systeminformation/lib/util.js
@@ -0,0 +1,1303 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// utils.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 0. helper functions
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const fs = require('fs');
+const path = require('path');
+const spawn = require('child_process').spawn;
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const util = require('util');
+
+let _platform = process.platform;
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+const _freebsd = (_platform === 'freebsd');
+const _openbsd = (_platform === 'openbsd');
+const _netbsd = (_platform === 'netbsd');
+
+let _cores = 0;
+let wmicPath = '';
+let codepage = '';
+let _smartMonToolsInstalled = null;
+
+const WINDIR = process.env.WINDIR || 'C:\\Windows';
+
+// powerShell
+let _psChild;
+let _psResult = '';
+let _psCmds = [];
+let _psPersistent = false;
+const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
+const _psCmdStart = '--###START###--';
+const _psError = '--ERROR--';
+const _psCmdSeperator = '--###ENDCMD###--';
+const _psIdSeperator = '--##ID##--';
+
+const execOptsWin = {
+ windowsHide: true,
+ maxBuffer: 1024 * 20000,
+ encoding: 'UTF-8',
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
+};
+
+function toInt(value) {
+ let result = parseInt(value, 10);
+ if (isNaN(result)) {
+ result = 0;
+ }
+ return result;
+}
+
+
+const stringReplace = new String().replace;
+const stringToLower = new String().toLowerCase;
+const stringToString = new String().toString;
+const stringSubstr = new String().substr;
+const stringTrim = new String().trim;
+const stringStartWith = new String().startsWith;
+const mathMin = Math.min;
+
+function isFunction(functionToCheck) {
+ let getType = {};
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
+}
+
+function unique(obj) {
+ let uniques = [];
+ let stringify = {};
+ for (let i = 0; i < obj.length; i++) {
+ let keys = Object.keys(obj[i]);
+ keys.sort(function (a, b) { return a - b; });
+ let str = '';
+ for (let j = 0; j < keys.length; j++) {
+ str += JSON.stringify(keys[j]);
+ str += JSON.stringify(obj[i][keys[j]]);
+ }
+ if (!{}.hasOwnProperty.call(stringify, str)) {
+ uniques.push(obj[i]);
+ stringify[str] = true;
+ }
+ }
+ return uniques;
+}
+
+function sortByKey(array, keys) {
+ return array.sort(function (a, b) {
+ let x = '';
+ let y = '';
+ keys.forEach(function (key) {
+ x = x + a[key]; y = y + b[key];
+ });
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ });
+}
+
+function cores() {
+ if (_cores === 0) {
+ _cores = os.cpus().length;
+ }
+ return _cores;
+}
+
+function getValue(lines, property, separator, trimmed, lineMatch) {
+ separator = separator || ':';
+ property = property.toLowerCase();
+ trimmed = trimmed || false;
+ lineMatch = lineMatch || false;
+ let result = '';
+ lines.some((line) => {
+ let lineLower = line.toLowerCase().replace(/\t/g, '');
+ if (trimmed) {
+ lineLower = lineLower.trim();
+ }
+ if (lineLower.startsWith(property) && (lineMatch ? (lineLower.match(property + separator)) || (lineLower.match(property + ' ' + separator)) : true)) {
+ const parts = trimmed ? line.trim().split(separator) : line.split(separator);
+ if (parts.length >= 2) {
+ parts.shift();
+ result = parts.join(separator).trim();
+ return true;
+ }
+ }
+ });
+ return result;
+}
+
+function decodeEscapeSequence(str, base) {
+ base = base || 16;
+ return str.replace(/\\x([0-9A-Fa-f]{2})/g, function () {
+ return String.fromCharCode(parseInt(arguments[1], base));
+ });
+}
+
+function detectSplit(str) {
+ let seperator = '';
+ let part = 0;
+ str.split('').forEach(element => {
+ if (element >= '0' && element <= '9') {
+ if (part === 1) { part++; }
+ } else {
+ if (part === 0) { part++; }
+ if (part === 1) {
+ seperator += element;
+ }
+ }
+ });
+ return seperator;
+}
+
+function parseTime(t, pmDesignator) {
+ pmDesignator = pmDesignator || '';
+ t = t.toUpperCase();
+ let hour = 0;
+ let min = 0;
+ let splitter = detectSplit(t);
+ let parts = t.split(splitter);
+ if (parts.length >= 2) {
+ if (parts[2]) {
+ parts[1] += parts[2];
+ }
+ let isPM = (parts[1] && (parts[1].toLowerCase().indexOf('pm') > -1) || (parts[1].toLowerCase().indexOf('p.m.') > -1) || (parts[1].toLowerCase().indexOf('p. m.') > -1) || (parts[1].toLowerCase().indexOf('n') > -1) || (parts[1].toLowerCase().indexOf('ch') > -1) || (parts[1].toLowerCase().indexOf('ös') > -1) || (pmDesignator && parts[1].toLowerCase().indexOf(pmDesignator) > -1));
+ hour = parseInt(parts[0], 10);
+ min = parseInt(parts[1], 10);
+ hour = isPM && hour < 12 ? hour + 12 : hour;
+ return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2);
+ }
+}
+
+function parseDateTime(dt, culture) {
+ const result = {
+ date: '',
+ time: ''
+ };
+ culture = culture || {};
+ let dateFormat = (culture.dateFormat || '').toLowerCase();
+ let pmDesignator = (culture.pmDesignator || '');
+
+ const parts = dt.split(' ');
+ if (parts[0]) {
+ if (parts[0].indexOf('/') >= 0) {
+ // Dateformat: mm/dd/yyyy or dd/mm/yyyy or dd/mm/yy or yyyy/mm/dd
+ const dtparts = parts[0].split('/');
+ if (dtparts.length === 3) {
+ if (dtparts[0].length === 4) {
+ // Dateformat: yyyy/mm/dd
+ result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
+ } else if (dtparts[2].length === 2) {
+ if ((dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1)) {
+ // Dateformat: mm/dd/yy
+ result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
+ } else {
+ // Dateformat: dd/mm/yy
+ result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
+ }
+ } else {
+ // Dateformat: mm/dd/yyyy or dd/mm/yyyy
+ const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (dt.toLowerCase().indexOf('p.m.') > -1) || (dt.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (dt.toLowerCase().indexOf('a.m.') > -1) || (dt.toLowerCase().indexOf('a. m.') > -1));
+ if ((isEN || dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) && dateFormat.indexOf('dd/') !== 0) {
+ // Dateformat: mm/dd/yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
+ } else {
+ // Dateformat: dd/mm/yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
+ }
+ }
+ }
+ }
+ if (parts[0].indexOf('.') >= 0) {
+ const dtparts = parts[0].split('.');
+ if (dtparts.length === 3) {
+ if (dateFormat.indexOf('.d.') > -1 || dateFormat.indexOf('.dd.') > -1) {
+ // Dateformat: mm.dd.yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
+ } else {
+ // Dateformat: dd.mm.yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
+ }
+ }
+ }
+ if (parts[0].indexOf('-') >= 0) {
+ // Dateformat: yyyy-mm-dd
+ const dtparts = parts[0].split('-');
+ if (dtparts.length === 3) {
+ result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);
+ }
+ }
+ }
+ if (parts[1]) {
+ parts.shift();
+ let time = parts.join(' ');
+ result.time = parseTime(time, pmDesignator);
+ }
+ return result;
+}
+
+function parseHead(head, rights) {
+ let space = (rights > 0);
+ let count = 1;
+ let from = 0;
+ let to = 0;
+ let result = [];
+ for (let i = 0; i < head.length; i++) {
+ if (count <= rights) {
+ if (/\s/.test(head[i]) && !space) {
+ to = i - 1;
+ result.push({
+ from: from,
+ to: to + 1,
+ cap: head.substring(from, to + 1)
+ });
+ from = to + 2;
+ count++;
+ }
+ space = head[i] === ' ';
+ } else {
+ if (!/\s/.test(head[i]) && space) {
+ to = i - 1;
+ if (from < to) {
+ result.push({
+ from: from,
+ to: to,
+ cap: head.substring(from, to)
+ });
+ }
+ from = to + 1;
+ count++;
+ }
+ space = head[i] === ' ';
+ }
+ }
+ to = 5000;
+ result.push({
+ from: from,
+ to: to,
+ cap: head.substring(from, to)
+ });
+ let len = result.length;
+ for (let i = 0; i < len; i++) {
+ if (result[i].cap.replace(/\s/g, '').length === 0) {
+ if (i + 1 < len) {
+ result[i].to = result[i + 1].to;
+ result[i].cap = result[i].cap + result[i + 1].cap;
+ result.splice(i + 1, 1);
+ len = len - 1;
+ }
+ }
+ }
+ return result;
+}
+
+function findObjectByKey(array, key, value) {
+ for (let i = 0; i < array.length; i++) {
+ if (array[i][key] === value) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+function getWmic() {
+ if (os.type() === 'Windows_NT' && !wmicPath) {
+ wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
+ if (!fs.existsSync(wmicPath)) {
+ try {
+ const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
+ if (wmicPathArray && wmicPathArray.length) {
+ wmicPath = wmicPathArray[0];
+ } else {
+ wmicPath = 'wmic';
+ }
+ } catch (e) {
+ wmicPath = 'wmic';
+ }
+ }
+ }
+ return wmicPath;
+}
+
+function wmic(command) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ try {
+ powerShell(getWmic() + ' ' + command).then(stdout => {
+ resolve(stdout, '');
+ });
+ } catch (e) {
+ resolve('', e);
+ }
+ });
+ });
+}
+
+function getVboxmanage() {
+ return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage';
+}
+
+function powerShellProceedResults(data) {
+ let id = '';
+ let parts;
+ let res = '';
+ // startID
+ if (data.indexOf(_psCmdStart) >= 0) {
+ parts = data.split(_psCmdStart);
+ const parts2 = parts[1].split(_psIdSeperator);
+ id = parts2[0];
+ if (parts2.length > 1) {
+ data = parts2.slice(1).join(_psIdSeperator);
+ }
+ }
+ // result;
+ if (data.indexOf(_psCmdSeperator) >= 0) {
+ parts = data.split(_psCmdSeperator);
+ res = parts[0];
+ }
+ let remove = -1;
+ for (let i = 0; i < _psCmds.length; i++) {
+ if (_psCmds[i].id === id) {
+ remove = i;
+ _psCmds[i].callback(res);
+ }
+ }
+ if (remove >= 0) {
+ _psCmds.splice(remove, 1);
+ }
+}
+
+function powerShellStart() {
+ if (!_psChild) {
+ _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
+ stdio: 'pipe',
+ windowsHide: true,
+ maxBuffer: 1024 * 20000,
+ encoding: 'UTF-8',
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
+ });
+ if (_psChild && _psChild.pid) {
+ _psPersistent = true;
+ _psChild.stdout.on('data', function (data) {
+ _psResult = _psResult + data.toString('utf8');
+ if (data.indexOf(_psCmdSeperator) >= 0) {
+ powerShellProceedResults(_psResult);
+ _psResult = '';
+ }
+ });
+ _psChild.stderr.on('data', function () {
+ powerShellProceedResults(_psResult + _psError);
+ });
+ _psChild.on('error', function () {
+ powerShellProceedResults(_psResult + _psError);
+ });
+ _psChild.on('close', function () {
+ _psChild.kill();
+ });
+ }
+ }
+}
+
+function powerShellRelease() {
+ try {
+ if (_psChild) {
+ _psChild.stdin.write('exit' + os.EOL);
+ _psChild.stdin.end();
+ _psPersistent = false;
+ }
+ } catch (e) {
+ if (_psChild) { _psChild.kill(); }
+ }
+ _psChild = null;
+}
+
+function powerShell(cmd) {
+
+ if (_psPersistent) {
+ const id = Math.random().toString(36).substring(2, 12);
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ function callback(data) {
+ resolve(data);
+ }
+ _psCmds.push({
+ id,
+ cmd,
+ callback,
+ start: new Date()
+ });
+ try {
+ if (_psChild && _psChild.pid) {
+ _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
+ }
+ } catch (e) {
+ resolve('');
+ }
+ });
+ });
+
+ } else {
+ let result = '';
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ try {
+ const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
+ stdio: 'pipe',
+ windowsHide: true,
+ maxBuffer: 1024 * 20000,
+ encoding: 'UTF-8',
+ env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
+ });
+
+ if (child && !child.pid) {
+ child.on('error', function () {
+ resolve(result);
+ });
+ }
+ if (child && child.pid) {
+ child.stdout.on('data', function (data) {
+ result = result + data.toString('utf8');
+ });
+ child.stderr.on('data', function () {
+ child.kill();
+ resolve(result);
+ });
+ child.on('close', function () {
+ child.kill();
+
+ resolve(result);
+ });
+ child.on('error', function () {
+ child.kill();
+ resolve(result);
+ });
+ try {
+ child.stdin.write(_psToUTF8 + cmd + os.EOL);
+ child.stdin.write('exit' + os.EOL);
+ child.stdin.end();
+ } catch (e) {
+ child.kill();
+ resolve(result);
+ }
+ } else {
+ resolve(result);
+ }
+ } catch (e) {
+ resolve(result);
+ }
+ });
+ });
+ }
+}
+
+function execSafe(cmd, args, options) {
+ let result = '';
+ options = options || {};
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ try {
+ const child = spawn(cmd, args, options);
+
+ if (child && !child.pid) {
+ child.on('error', function () {
+ resolve(result);
+ });
+ }
+ if (child && child.pid) {
+ child.stdout.on('data', function (data) {
+ result += data.toString();
+ });
+ child.on('close', function () {
+ child.kill();
+ resolve(result);
+ });
+ child.on('error', function () {
+ child.kill();
+ resolve(result);
+ });
+ } else {
+ resolve(result);
+ }
+ } catch (e) {
+ resolve(result);
+ }
+ });
+ });
+}
+
+function getCodepage() {
+ if (_windows) {
+ if (!codepage) {
+ try {
+ const stdout = execSync('chcp', execOptsWin);
+ const lines = stdout.toString().split('\r\n');
+ const parts = lines[0].split(':');
+ codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : '';
+ } catch (err) {
+ codepage = '437';
+ }
+ }
+ return codepage;
+ }
+ if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
+ if (!codepage) {
+ try {
+ const stdout = execSync('echo $LANG');
+ const lines = stdout.toString().split('\r\n');
+ const parts = lines[0].split('.');
+ codepage = parts.length > 1 ? parts[1].trim() : '';
+ if (!codepage) {
+ codepage = 'UTF-8';
+ }
+ } catch (err) {
+ codepage = 'UTF-8';
+ }
+ }
+ return codepage;
+ }
+}
+
+function smartMonToolsInstalled() {
+ if (_smartMonToolsInstalled !== null) {
+ return _smartMonToolsInstalled;
+ }
+ _smartMonToolsInstalled = false;
+ if (_windows) {
+ try {
+ const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
+ if (pathArray && pathArray.length) {
+ _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
+ } else {
+ _smartMonToolsInstalled = false;
+ }
+ } catch (e) {
+ _smartMonToolsInstalled = false;
+ }
+ }
+ if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
+ const pathArray = execSync('which smartctl 2>/dev/null', execOptsWin).toString().split('\r\n');
+ _smartMonToolsInstalled = pathArray.length > 0;
+ }
+ return _smartMonToolsInstalled;
+}
+
+function isRaspberry() {
+ const PI_MODEL_NO = [
+ 'BCM2708',
+ 'BCM2709',
+ 'BCM2710',
+ 'BCM2711',
+ 'BCM2835',
+ 'BCM2836',
+ 'BCM2837',
+ 'BCM2837B0'
+ ];
+ let cpuinfo = [];
+ try {
+ cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
+ } catch (e) {
+ return false;
+ }
+ const hardware = getValue(cpuinfo, 'hardware');
+ return (hardware && PI_MODEL_NO.indexOf(hardware) > -1);
+}
+
+function isRaspbian() {
+ let osrelease = [];
+ try {
+ osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n');
+ } catch (e) {
+ return false;
+ }
+ const id = getValue(osrelease, 'id', '=');
+ return (id && id.indexOf('raspbian') > -1);
+}
+
+function execWin(cmd, opts, callback) {
+ if (!callback) {
+ callback = opts;
+ opts = execOptsWin;
+ }
+ let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul';
+ exec(newCmd, opts, function (error, stdout) {
+ callback(error, stdout);
+ });
+}
+
+function darwinXcodeExists() {
+ const cmdLineToolsExists = fs.existsSync('/Library/Developer/CommandLineTools/usr/bin/');
+ const xcodeAppExists = fs.existsSync('/Applications/Xcode.app/Contents/Developer/Tools');
+ const xcodeExists = fs.existsSync('/Library/Developer/Xcode/');
+ return (cmdLineToolsExists || xcodeExists || xcodeAppExists);
+}
+
+function nanoSeconds() {
+ const time = process.hrtime();
+ if (!Array.isArray(time) || time.length !== 2) {
+ return 0;
+ }
+ return +time[0] * 1e9 + +time[1];
+}
+
+function countUniqueLines(lines, startingWith) {
+ startingWith = startingWith || '';
+ const uniqueLines = [];
+ lines.forEach(line => {
+ if (line.startsWith(startingWith)) {
+ if (uniqueLines.indexOf(line) === -1) {
+ uniqueLines.push(line);
+ }
+ }
+ });
+ return uniqueLines.length;
+}
+
+function countLines(lines, startingWith) {
+ startingWith = startingWith || '';
+ const uniqueLines = [];
+ lines.forEach(line => {
+ if (line.startsWith(startingWith)) {
+ uniqueLines.push(line);
+ }
+ });
+ return uniqueLines.length;
+}
+
+function sanitizeShellString(str, strict) {
+ if (typeof strict === 'undefined') { strict = false; }
+ const s = str || '';
+ let result = '';
+ for (let i = 0; i <= mathMin(s.length, 2000); i++) {
+ if (!(s[i] === undefined ||
+ s[i] === '>' ||
+ s[i] === '<' ||
+ s[i] === '*' ||
+ s[i] === '?' ||
+ s[i] === '[' ||
+ s[i] === ']' ||
+ s[i] === '|' ||
+ s[i] === '˚' ||
+ s[i] === '$' ||
+ s[i] === ';' ||
+ s[i] === '&' ||
+ s[i] === '(' ||
+ s[i] === ')' ||
+ s[i] === ']' ||
+ s[i] === '#' ||
+ s[i] === '\\' ||
+ s[i] === '\t' ||
+ s[i] === '\n' ||
+ s[i] === '\'' ||
+ s[i] === '`' ||
+ s[i] === '"' ||
+ s[i].length > 1 ||
+ (strict && s[i] === '@') ||
+ (strict && s[i] === ' ') ||
+ (strict && s[i] == '{') ||
+ (strict && s[i] == ')'))) {
+ result = result + s[i];
+ }
+ }
+ return result;
+}
+
+function isPrototypePolluted() {
+ const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ let notPolluted = true;
+ let st = '';
+
+ st.__proto__.replace = stringReplace;
+ st.__proto__.toLowerCase = stringToLower;
+ st.__proto__.toString = stringToString;
+ st.__proto__.substr = stringSubstr;
+
+ notPolluted = notPolluted || (s.length !== 62);
+ const ms = Date.now();
+ if (typeof ms === 'number' && ms > 1600000000000) {
+ const l = ms % 100 + 15;
+ for (let i = 0; i < l; i++) {
+ const r = Math.random() * 61.99999999 + 1;
+ const rs = parseInt(Math.floor(r).toString(), 10);
+ const rs2 = parseInt(r.toString().split('.')[0], 10);
+ const q = Math.random() * 61.99999999 + 1;
+ const qs = parseInt(Math.floor(q).toString(), 10);
+ const qs2 = parseInt(q.toString().split('.')[0], 10);
+ notPolluted = notPolluted && (r !== q);
+ notPolluted = notPolluted && rs === rs2 && qs === qs2;
+ st += s[rs - 1];
+ }
+ notPolluted = notPolluted && st.length === l;
+ // string manipulation
+ let p = Math.random() * l * 0.9999999999;
+ let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
+ stm.__proto__.replace = stringReplace;
+ let sto = stm.replace(/ /g, '');
+ notPolluted = notPolluted && st === sto;
+ p = Math.random() * l * 0.9999999999;
+ stm = st.substr(0, p) + '{' + st.substr(p, 2000);
+ sto = stm.replace(/{/g, '');
+ notPolluted = notPolluted && st === sto;
+ p = Math.random() * l * 0.9999999999;
+ stm = st.substr(0, p) + '*' + st.substr(p, 2000);
+ sto = stm.replace(/\*/g, '');
+ notPolluted = notPolluted && st === sto;
+ p = Math.random() * l * 0.9999999999;
+ stm = st.substr(0, p) + '$' + st.substr(p, 2000);
+ sto = stm.replace(/\$/g, '');
+ notPolluted = notPolluted && st === sto;
+
+ // lower
+ const stl = st.toLowerCase();
+ notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]);
+ for (let i = 0; i < l; i++) {
+ const s1 = st[i];
+ s1.__proto__.toLowerCase = stringToLower;
+ const s2 = stl ? stl[i] : '';
+ const s1l = s1.toLowerCase();
+ notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]);
+ }
+ }
+ return !notPolluted;
+}
+
+function hex2bin(hex) {
+ return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8);
+}
+
+function getFilesInPath(source) {
+ const lstatSync = fs.lstatSync;
+ const readdirSync = fs.readdirSync;
+ const join = path.join;
+
+ function isDirectory(source) {
+ return lstatSync(source).isDirectory();
+ }
+ function isFile(source) { return lstatSync(source).isFile(); }
+
+ function getDirectories(source) {
+ return readdirSync(source).map(function (name) { return join(source, name); }).filter(isDirectory);
+ }
+ function getFiles(source) {
+ return readdirSync(source).map(function (name) { return join(source, name); }).filter(isFile);
+ }
+
+ function getFilesRecursively(source) {
+ try {
+ let dirs = getDirectories(source);
+ let files = dirs
+ .map(function (dir) { return getFilesRecursively(dir); })
+ .reduce(function (a, b) { return a.concat(b); }, []);
+ return files.concat(getFiles(source));
+ } catch (e) {
+ return [];
+ }
+ }
+
+ if (fs.existsSync(source)) {
+ return getFilesRecursively(source);
+ } else {
+ return [];
+ }
+}
+
+function decodePiCpuinfo(lines) {
+
+ // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
+
+ const oldRevisionCodes = {
+ '0002': {
+ type: 'B',
+ revision: '1.0',
+ memory: 256,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '0003': {
+ type: 'B',
+ revision: '1.0',
+ memory: 256,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '0004': {
+ type: 'B',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '0005': {
+ type: 'B',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Qisda',
+ processor: 'BCM2835'
+ },
+ '0006': {
+ type: 'B',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '0007': {
+ type: 'A',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '0008': {
+ type: 'A',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '0009': {
+ type: 'A',
+ revision: '2.0',
+ memory: 256,
+ manufacturer: 'Qisda',
+ processor: 'BCM2835'
+ },
+ '000d': {
+ type: 'B',
+ revision: '2.0',
+ memory: 512,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '000e': {
+ type: 'B',
+ revision: '2.0',
+ memory: 512,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '000f': {
+ type: 'B',
+ revision: '2.0',
+ memory: 512,
+ manufacturer: 'Egoman',
+ processor: 'BCM2835'
+ },
+ '0010': {
+ type: 'B+',
+ revision: '1.2',
+ memory: 512,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '0011': {
+ type: 'CM1',
+ revision: '1.0',
+ memory: 512,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '0012': {
+ type: 'A+',
+ revision: '1.1',
+ memory: 256,
+ manufacturer: 'Sony UK',
+ processor: 'BCM2835'
+ },
+ '0013': {
+ type: 'B+',
+ revision: '1.2',
+ memory: 512,
+ manufacturer: 'Embest',
+ processor: 'BCM2835'
+ },
+ '0014': {
+ type: 'CM1',
+ revision: '1.0',
+ memory: 512,
+ manufacturer: 'Embest',
+ processor: 'BCM2835'
+ },
+ '0015': {
+ type: 'A+',
+ revision: '1.1',
+ memory: 256,
+ manufacturer: '512MB Embest',
+ processor: 'BCM2835'
+ }
+ };
+
+ const processorList = [
+ 'BCM2835',
+ 'BCM2836',
+ 'BCM2837',
+ 'BCM2711',
+ ];
+ const manufacturerList = [
+ 'Sony UK',
+ 'Egoman',
+ 'Embest',
+ 'Sony Japan',
+ 'Embest',
+ 'Stadium'
+ ];
+ const typeList = {
+ '00': 'A',
+ '01': 'B',
+ '02': 'A+',
+ '03': 'B+',
+ '04': '2B',
+ '05': 'Alpha (early prototype)',
+ '06': 'CM1',
+ '08': '3B',
+ '09': 'Zero',
+ '0a': 'CM3',
+ '0c': 'Zero W',
+ '0d': '3B+',
+ '0e': '3A+',
+ '0f': 'Internal use only',
+ '10': 'CM3+',
+ '11': '4B',
+ '12': 'Zero 2 W',
+ '13': '400',
+ '14': 'CM4'
+ };
+
+ const revisionCode = getValue(lines, 'revision', ':', true);
+ const model = getValue(lines, 'model:', ':', true);
+ const serial = getValue(lines, 'serial', ':', true);
+
+ let result = {};
+ if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
+ // old revision codes
+ result = {
+ model,
+ serial,
+ revisionCode,
+ memory: oldRevisionCodes[revisionCode].memory,
+ manufacturer: oldRevisionCodes[revisionCode].manufacturer,
+ processor: oldRevisionCodes[revisionCode].processor,
+ type: oldRevisionCodes[revisionCode].type,
+ revision: oldRevisionCodes[revisionCode].revision,
+ };
+
+ } else {
+ // new revision code
+ const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8);
+ const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0;
+ const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)];
+ const processor = processorList[parseInt(revision.substr(4, 1), 10)];
+ const typeCode = revision.substr(5, 2);
+
+
+ result = {
+ model,
+ serial,
+ revisionCode,
+ memory: 256 * Math.pow(2, memSizeCode),
+ manufacturer,
+ processor,
+ type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '',
+ revision: '1.' + revision.substr(7, 1),
+ };
+ }
+ return result;
+}
+
+function promiseAll(promises) {
+ const resolvingPromises = promises.map(function (promise) {
+ return new Promise(function (resolve) {
+ let payload = new Array(2);
+ promise.then(function (result) {
+ payload[0] = result;
+ })
+ .catch(function (error) {
+ payload[1] = error;
+ })
+ .then(function () {
+ // The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all
+ resolve(payload);
+ });
+ });
+ });
+ const errors = [];
+ const results = [];
+
+ // Execute all wrapped Promises
+ return Promise.all(resolvingPromises)
+ .then(function (items) {
+ items.forEach(function (payload) {
+ if (payload[1]) {
+ errors.push(payload[1]);
+ results.push(null);
+ } else {
+ errors.push(null);
+ results.push(payload[0]);
+ }
+ });
+
+ return {
+ errors: errors,
+ results: results
+ };
+ });
+}
+
+function promisify(nodeStyleFunction) {
+ return function () {
+ const args = Array.prototype.slice.call(arguments);
+ return new Promise(function (resolve, reject) {
+ args.push(function (err, data) {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(data);
+ }
+ });
+ nodeStyleFunction.apply(null, args);
+ });
+ };
+}
+
+function promisifySave(nodeStyleFunction) {
+ return function () {
+ const args = Array.prototype.slice.call(arguments);
+ return new Promise(function (resolve) {
+ args.push(function (err, data) {
+ resolve(data);
+ });
+ nodeStyleFunction.apply(null, args);
+ });
+ };
+}
+
+function linuxVersion() {
+ let result = '';
+ if (_linux) {
+ try {
+ result = execSync('uname -v').toString();
+ } catch (e) {
+ result = '';
+ }
+ }
+ return result;
+}
+
+function plistParser(xmlStr) {
+ const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
+ const startStr = '<plist version';
+
+ let pos = xmlStr.indexOf(startStr);
+ let len = xmlStr.length;
+ while (xmlStr[pos] !== '>' && pos < len) {
+ pos++;
+ }
+
+ let depth = 0;
+ let inTagStart = false;
+ let inTagContent = false;
+ let inTagEnd = false;
+ let metaData = [{ tagStart: '', tagEnd: '', tagContent: '', key: '', data: null }];
+ let c = '';
+ let cn = xmlStr[pos];
+
+ while (pos < len) {
+ c = cn;
+ if (pos + 1 < len) { cn = xmlStr[pos + 1]; }
+ if (c === '<') {
+ inTagContent = false;
+ if (cn === '/') { inTagEnd = true; }
+ else if (metaData[depth].tagStart) {
+ metaData[depth].tagContent = '';
+ if (!metaData[depth].data) { metaData[depth].data = metaData[depth].tagStart === 'array' ? [] : {}; }
+ depth++;
+ metaData.push({ tagStart: '', tagEnd: '', tagContent: '', key: null, data: null });
+ inTagStart = true;
+ inTagContent = false;
+ }
+ else if (!inTagStart) { inTagStart = true; }
+ } else if (c === '>') {
+ if (metaData[depth].tagStart === 'true/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = true; }
+ if (metaData[depth].tagStart === 'false/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = false; }
+ if (metaData[depth].tagStart === 'array/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/arrayEmpty'; metaData[depth].data = []; }
+ if (inTagContent) { inTagContent = false; }
+ if (inTagStart) {
+ inTagStart = false;
+ inTagContent = true;
+ if (metaData[depth].tagStart === 'array') {
+ metaData[depth].data = [];
+ }
+ if (metaData[depth].tagStart === 'dict') {
+ metaData[depth].data = {};
+ }
+ }
+ if (inTagEnd) {
+ inTagEnd = false;
+ if (metaData[depth].tagEnd && tags.indexOf(metaData[depth].tagEnd.substr(1)) >= 0) {
+ if (metaData[depth].tagEnd === '/dict' || metaData[depth].tagEnd === '/array') {
+ if (depth > 1 && metaData[depth - 2].tagStart === 'array') {
+ metaData[depth - 2].data.push(metaData[depth - 1].data);
+ }
+ if (depth > 1 && metaData[depth - 2].tagStart === 'dict') {
+ metaData[depth - 2].data[metaData[depth - 1].key] = metaData[depth - 1].data;
+ }
+ depth--;
+ metaData.pop();
+ metaData[depth].tagContent = '';
+ metaData[depth].tagStart = '';
+ metaData[depth].tagEnd = '';
+ }
+ else {
+ if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) {
+ metaData[depth].key = metaData[depth].tagContent;
+ } else {
+ if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) { metaData[depth].data = parseFloat(metaData[depth].tagContent) || 0; }
+ if (metaData[depth].tagEnd === '/integer' && metaData[depth].tagContent) { metaData[depth].data = parseInt(metaData[depth].tagContent) || 0; }
+ if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) { metaData[depth].data = metaData[depth].tagContent || ''; }
+ if (metaData[depth].tagEnd === '/boolean') { metaData[depth].data = metaData[depth].tagContent || false; }
+ if (metaData[depth].tagEnd === '/arrayEmpty') { metaData[depth].data = metaData[depth].tagContent || []; }
+ if (depth > 0 && metaData[depth - 1].tagStart === 'array') { metaData[depth - 1].data.push(metaData[depth].data); }
+ if (depth > 0 && metaData[depth - 1].tagStart === 'dict') { metaData[depth - 1].data[metaData[depth].key] = metaData[depth].data; }
+ }
+ metaData[depth].tagContent = '';
+ metaData[depth].tagStart = '';
+ metaData[depth].tagEnd = '';
+ }
+ }
+ metaData[depth].tagEnd = '';
+ inTagStart = false;
+ inTagContent = false;
+ }
+ } else {
+ if (inTagStart) { metaData[depth].tagStart += c; }
+ if (inTagEnd) { metaData[depth].tagEnd += c; }
+ if (inTagContent) { metaData[depth].tagContent += c; }
+ }
+ pos++;
+ }
+ return metaData[0].data;
+}
+
+function strIsNumeric(str) {
+ return typeof str === 'string' && !isNaN(str) && !isNaN(parseFloat(str));
+}
+
+function plistReader(output) {
+ const lines = output.split('\n');
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i].indexOf(' = ') >= 0) {
+ const lineParts = lines[i].split(' = ');
+ lineParts[0] = lineParts[0].trim();
+ if (!lineParts[0].startsWith('"')) {
+ lineParts[0] = '"' + lineParts[0] + '"';
+ }
+ lineParts[1] = lineParts[1].trim();
+ if (lineParts[1].indexOf('"') === -1 && lineParts[1].endsWith(';')) {
+ const valueString = lineParts[1].substring(0, lineParts[1].length - 1);
+ if (!strIsNumeric(valueString)) {
+ lineParts[1] = `"${valueString}";`;
+ }
+ }
+ if (lineParts[1].indexOf('"') >= 0 && lineParts[1].endsWith(';')) {
+ const valueString = lineParts[1].substring(0, lineParts[1].length - 1).replace(/"/g, '');
+ if (strIsNumeric(valueString)) {
+ lineParts[1] = `${valueString};`;
+ }
+ }
+ lines[i] = lineParts.join(' : ');
+ }
+ lines[i] = lines[i].replace(/\(/g, '[').replace(/\)/g, ']').replace(/;/g, ',').trim();
+ if (lines[i].startsWith('}') && lines[i - 1] && lines[i - 1].endsWith(',')) {
+ lines[i - 1] = lines[i - 1].substring(0, lines[i - 1].length - 1);
+ }
+ }
+ output = lines.join('');
+ let obj = {};
+ try {
+ obj = JSON.parse(output);
+ } catch (e) {
+ noop();
+ }
+ return obj;
+}
+
+function semverCompare(v1, v2) {
+ let res = 0;
+ const parts1 = v1.split('.');
+ const parts2 = v2.split('.');
+ if (parts1[0] < parts2[0]) { res = 1; }
+ else if (parts1[0] > parts2[0]) { res = -1; }
+ else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) {
+ if (parts1[1] < parts2[1]) { res = 1; }
+ else if (parts1[1] > parts2[1]) { res = -1; }
+ else if (parts1[1] === parts2[1]) {
+ if (parts1.length >= 3 && parts2.length >= 3) {
+ if (parts1[2] < parts2[2]) { res = 1; }
+ else if (parts1[2] > parts2[2]) { res = -1; }
+ } else if (parts2.length >= 3) {
+ res = 1;
+ }
+ }
+ }
+ return res;
+}
+
+function noop() { }
+
+exports.toInt = toInt;
+exports.execOptsWin = execOptsWin;
+exports.getCodepage = getCodepage;
+exports.execWin = execWin;
+exports.isFunction = isFunction;
+exports.unique = unique;
+exports.sortByKey = sortByKey;
+exports.cores = cores;
+exports.getValue = getValue;
+exports.decodeEscapeSequence = decodeEscapeSequence;
+exports.parseDateTime = parseDateTime;
+exports.parseHead = parseHead;
+exports.findObjectByKey = findObjectByKey;
+exports.getWmic = getWmic;
+exports.wmic = wmic;
+exports.darwinXcodeExists = darwinXcodeExists;
+exports.getVboxmanage = getVboxmanage;
+exports.powerShell = powerShell;
+exports.powerShellStart = powerShellStart;
+exports.powerShellRelease = powerShellRelease;
+exports.execSafe = execSafe;
+exports.nanoSeconds = nanoSeconds;
+exports.countUniqueLines = countUniqueLines;
+exports.countLines = countLines;
+exports.noop = noop;
+exports.isRaspberry = isRaspberry;
+exports.isRaspbian = isRaspbian;
+exports.sanitizeShellString = sanitizeShellString;
+exports.isPrototypePolluted = isPrototypePolluted;
+exports.decodePiCpuinfo = decodePiCpuinfo;
+exports.promiseAll = promiseAll;
+exports.promisify = promisify;
+exports.promisifySave = promisifySave;
+exports.smartMonToolsInstalled = smartMonToolsInstalled;
+exports.linuxVersion = linuxVersion;
+exports.plistParser = plistParser;
+exports.plistReader = plistReader;
+exports.stringReplace = stringReplace;
+exports.stringToLower = stringToLower;
+exports.stringToString = stringToString;
+exports.stringSubstr = stringSubstr;
+exports.stringTrim = stringTrim;
+exports.stringStartWith = stringStartWith;
+exports.mathMin = mathMin;
+exports.WINDIR = WINDIR;
+exports.getFilesInPath = getFilesInPath;
+exports.semverCompare = semverCompare;
diff --git a/node_modules/systeminformation/lib/virtualbox.js b/node_modules/systeminformation/lib/virtualbox.js
new file mode 100644
index 0000000..2da7f9c
--- /dev/null
+++ b/node_modules/systeminformation/lib/virtualbox.js
@@ -0,0 +1,107 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// virtualbox.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 14. Docker
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const exec = require('child_process').exec;
+const util = require('./util');
+
+function vboxInfo(callback) {
+
+ // fallback - if only callback is given
+ let result = [];
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ try {
+ exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) {
+ let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
+ parts.shift();
+ parts.forEach(part => {
+ const lines = ('Name:' + part).split(os.EOL);
+ const state = util.getValue(lines, 'State');
+ const running = state.startsWith('running');
+ const runningSinceString = running ? state.replace('running (since ', '').replace(')', '').trim() : '';
+ let runningSince = 0;
+ try {
+ if (running) {
+ const sinceDateObj = new Date(runningSinceString);
+ const offset = sinceDateObj.getTimezoneOffset();
+ runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : '';
+ let stoppedSince = 0;
+ try {
+ if (!running) {
+ const sinceDateObj = new Date(stoppedSinceString);
+ const offset = sinceDateObj.getTimezoneOffset();
+ stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
+ }
+ } catch (e) {
+ util.noop();
+ }
+ result.push({
+ id: util.getValue(lines, 'UUID'),
+ name: util.getValue(lines, 'Name'),
+ running,
+ started: runningSinceString,
+ runningSince,
+ stopped: stoppedSinceString,
+ stoppedSince,
+ guestOS: util.getValue(lines, 'Guest OS'),
+ hardwareUUID: util.getValue(lines, 'Hardware UUID'),
+ memory: parseInt(util.getValue(lines, 'Memory size', ' '), 10),
+ vram: parseInt(util.getValue(lines, 'VRAM size'), 10),
+ cpus: parseInt(util.getValue(lines, 'Number of CPUs'), 10),
+ cpuExepCap: util.getValue(lines, 'CPU exec cap'),
+ cpuProfile: util.getValue(lines, 'CPUProfile'),
+ chipset: util.getValue(lines, 'Chipset'),
+ firmware: util.getValue(lines, 'Firmware'),
+ pageFusion: util.getValue(lines, 'Page Fusion') === 'enabled',
+ configFile: util.getValue(lines, 'Config file'),
+ snapshotFolder: util.getValue(lines, 'Snapshot folder'),
+ logFolder: util.getValue(lines, 'Log folder'),
+ hpet: util.getValue(lines, 'HPET') === 'enabled',
+ pae: util.getValue(lines, 'PAE') === 'enabled',
+ longMode: util.getValue(lines, 'Long Mode') === 'enabled',
+ tripleFaultReset: util.getValue(lines, 'Triple Fault Reset') === 'enabled',
+ apic: util.getValue(lines, 'APIC') === 'enabled',
+ x2Apic: util.getValue(lines, 'X2APIC') === 'enabled',
+ acpi: util.getValue(lines, 'ACPI') === 'enabled',
+ ioApic: util.getValue(lines, 'IOAPIC') === 'enabled',
+ biosApicMode: util.getValue(lines, 'BIOS APIC mode'),
+ bootMenuMode: util.getValue(lines, 'Boot menu mode'),
+ bootDevice1: util.getValue(lines, 'Boot Device 1'),
+ bootDevice2: util.getValue(lines, 'Boot Device 2'),
+ bootDevice3: util.getValue(lines, 'Boot Device 3'),
+ bootDevice4: util.getValue(lines, 'Boot Device 4'),
+ timeOffset: util.getValue(lines, 'Time offset'),
+ rtc: util.getValue(lines, 'RTC'),
+ });
+ });
+
+ if (callback) { callback(result); }
+ resolve(result);
+ });
+ } catch (e) {
+ if (callback) { callback(result); }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.vboxInfo = vboxInfo;
diff --git a/node_modules/systeminformation/lib/wifi.js b/node_modules/systeminformation/lib/wifi.js
new file mode 100644
index 0000000..dcb18e1
--- /dev/null
+++ b/node_modules/systeminformation/lib/wifi.js
@@ -0,0 +1,744 @@
+'use strict';
+// @ts-check
+// ==================================================================================
+// wifi.js
+// ----------------------------------------------------------------------------------
+// Description: System Information - library
+// for Node.js
+// Copyright: (c) 2014 - 2023
+// Author: Sebastian Hildebrandt
+// ----------------------------------------------------------------------------------
+// License: MIT
+// ==================================================================================
+// 9. wifi
+// ----------------------------------------------------------------------------------
+
+const os = require('os');
+const exec = require('child_process').exec;
+const execSync = require('child_process').execSync;
+const util = require('./util');
+
+let _platform = process.platform;
+
+const _linux = (_platform === 'linux' || _platform === 'android');
+const _darwin = (_platform === 'darwin');
+const _windows = (_platform === 'win32');
+
+function wifiDBFromQuality(quality) {
+ return (parseFloat(quality) / 2 - 100);
+}
+
+function wifiQualityFromDB(db) {
+ const result = 2 * (parseFloat(db) + 100);
+ return result <= 100 ? result : 100;
+}
+
+const _wifi_frequencies = {
+ 1: 2412,
+ 2: 2417,
+ 3: 2422,
+ 4: 2427,
+ 5: 2432,
+ 6: 2437,
+ 7: 2442,
+ 8: 2447,
+ 9: 2452,
+ 10: 2457,
+ 11: 2462,
+ 12: 2467,
+ 13: 2472,
+ 14: 2484,
+ 32: 5160,
+ 34: 5170,
+ 36: 5180,
+ 38: 5190,
+ 40: 5200,
+ 42: 5210,
+ 44: 5220,
+ 46: 5230,
+ 48: 5240,
+ 50: 5250,
+ 52: 5260,
+ 54: 5270,
+ 56: 5280,
+ 58: 5290,
+ 60: 5300,
+ 62: 5310,
+ 64: 5320,
+ 68: 5340,
+ 96: 5480,
+ 100: 5500,
+ 102: 5510,
+ 104: 5520,
+ 106: 5530,
+ 108: 5540,
+ 110: 5550,
+ 112: 5560,
+ 114: 5570,
+ 116: 5580,
+ 118: 5590,
+ 120: 5600,
+ 122: 5610,
+ 124: 5620,
+ 126: 5630,
+ 128: 5640,
+ 132: 5660,
+ 134: 5670,
+ 136: 5680,
+ 138: 5690,
+ 140: 5700,
+ 142: 5710,
+ 144: 5720,
+ 149: 5745,
+ 151: 5755,
+ 153: 5765,
+ 155: 5775,
+ 157: 5785,
+ 159: 5795,
+ 161: 5805,
+ 165: 5825,
+ 169: 5845,
+ 173: 5865,
+ 183: 4915,
+ 184: 4920,
+ 185: 4925,
+ 187: 4935,
+ 188: 4940,
+ 189: 4945,
+ 192: 4960,
+ 196: 4980
+};
+
+function wifiFrequencyFromChannel(channel) {
+ return {}.hasOwnProperty.call(_wifi_frequencies, channel) ? _wifi_frequencies[channel] : null;
+}
+
+function wifiChannelFromFrequencs(frequency) {
+ let channel = 0;
+ for (let key in _wifi_frequencies) {
+ if ({}.hasOwnProperty.call(_wifi_frequencies, key)) {
+ if (_wifi_frequencies[key] === frequency) { channel = util.toInt(key); }
+ }
+ }
+ return channel;
+}
+
+function ifaceListLinux() {
+ const result = [];
+ const cmd = 'iw dev 2>/dev/null';
+ try {
+ const all = execSync(cmd).toString().split('\n').map(line => line.trim()).join('\n');
+ const parts = all.split('\nInterface ');
+ parts.shift();
+ parts.forEach(ifaceDetails => {
+ const lines = ifaceDetails.split('\n');
+ const iface = lines[0];
+ const id = util.toInt(util.getValue(lines, 'ifindex', ' '));
+ const mac = util.getValue(lines, 'addr', ' ');
+ const channel = util.toInt(util.getValue(lines, 'channel', ' '));
+ result.push({
+ id,
+ iface,
+ mac,
+ channel
+ });
+ });
+ return result;
+ } catch (e) {
+ try {
+ const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null').toString();
+ const parts = all.split('\nGENERAL.DEVICE:');
+ let i = 1;
+ parts.forEach(ifaceDetails => {
+ const lines = ifaceDetails.split('\n');
+ const iface = util.getValue(lines, 'GENERAL.DEVICE');
+ const type = util.getValue(lines, 'GENERAL.TYPE');
+ const id = i++; // // util.getValue(lines, 'GENERAL.PATH');
+ const mac = util.getValue(lines, 'GENERAL.HWADDR');
+ const channel = '';
+ if (type.toLowerCase() === 'wifi') {
+ result.push({
+ id,
+ iface,
+ mac,
+ channel
+ });
+ }
+ });
+ return result;
+ } catch (e) {
+ return [];
+ }
+ }
+}
+
+function nmiDeviceLinux(iface) {
+ const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`;
+ try {
+ const lines = execSync(cmd).toString().split('\n');
+ const ssid = util.getValue(lines, 'GENERAL.CONNECTION');
+ return {
+ iface,
+ type: util.getValue(lines, 'GENERAL.TYPE'),
+ vendor: util.getValue(lines, 'GENERAL.VENDOR'),
+ product: util.getValue(lines, 'GENERAL.PRODUCT'),
+ mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(),
+ ssid: ssid !== '--' ? ssid : null
+ };
+ } catch (e) {
+ return {};
+ }
+}
+
+function nmiConnectionLinux(ssid) {
+ const cmd = `nmcli -t --show-secrets connection show ${ssid} 2>/dev/null`;
+ try {
+ const lines = execSync(cmd).toString().split('\n');
+ const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase();
+ return {
+ ssid: ssid !== '--' ? ssid : null,
+ uuid: util.getValue(lines, 'connection.uuid'),
+ type: util.getValue(lines, 'connection.type'),
+ autoconnect: util.getValue(lines, 'connection.autoconnect') === 'yes',
+ security: util.getValue(lines, '802-11-wireless-security.key-mgmt'),
+ bssid: bssid !== '--' ? bssid : null
+ };
+ } catch (e) {
+ return {};
+ }
+}
+
+function wpaConnectionLinux(iface) {
+ const cmd = `wpa_cli -i ${iface} status 2>&1`;
+ try {
+ const lines = execSync(cmd).toString().split('\n');
+ const freq = util.toInt(util.getValue(lines, 'freq', '='));
+ return {
+ ssid: util.getValue(lines, 'ssid', '='),
+ uuid: util.getValue(lines, 'uuid', '='),
+ security: util.getValue(lines, 'key_mgmt', '='),
+ freq,
+ channel: wifiChannelFromFrequencs(freq),
+ bssid: util.getValue(lines, 'bssid', '=').toLowerCase()
+ };
+ } catch (e) {
+ return {};
+ }
+}
+
+function getWifiNetworkListNmi() {
+ const result = [];
+ const cmd = 'nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null';
+ try {
+ const stdout = execSync(cmd, { maxBuffer: 1024 * 20000 });
+ const parts = stdout.toString().split('ACTIVE:');
+ parts.shift();
+ parts.forEach(part => {
+ part = 'ACTIVE:' + part;
+ const lines = part.split(os.EOL);
+ const channel = util.getValue(lines, 'CHAN');
+ const frequency = util.getValue(lines, 'FREQ').toLowerCase().replace('mhz', '').trim();
+ const security = util.getValue(lines, 'SECURITY').replace('(', '').replace(')', '');
+ const wpaFlags = util.getValue(lines, 'WPA-FLAGS').replace('(', '').replace(')', '');
+ const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', '');
+ result.push({
+ ssid: util.getValue(lines, 'SSID'),
+ bssid: util.getValue(lines, 'BSSID').toLowerCase(),
+ mode: util.getValue(lines, 'MODE'),
+ channel: channel ? parseInt(channel, 10) : null,
+ frequency: frequency ? parseInt(frequency, 10) : null,
+ signalLevel: wifiDBFromQuality(util.getValue(lines, 'SIGNAL')),
+ quality: parseFloat(util.getValue(lines, 'SIGNAL')),
+ security: security && security !== 'none' ? security.split(' ') : [],
+ wpaFlags: wpaFlags && wpaFlags !== 'none' ? wpaFlags.split(' ') : [],
+ rsnFlags: rsnFlags && rsnFlags !== 'none' ? rsnFlags.split(' ') : []
+ });
+ });
+ return result;
+ } catch (e) {
+ return [];
+ }
+}
+
+function getWifiNetworkListIw(iface) {
+ const result = [];
+ try {
+ let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`).toString().split(' Cell ');
+ if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; }
+ if (iwlistParts.length > 1) {
+ iwlistParts.shift();
+ iwlistParts.forEach(element => {
+ const lines = element.split('\n');
+ const channel = util.getValue(lines, 'channel', ':', true);
+ const address = (lines && lines.length && lines[0].indexOf('Address:') >= 0 ? lines[0].split('Address:')[1].trim().toLowerCase() : '');
+ const mode = util.getValue(lines, 'mode', ':', true);
+ const frequency = util.getValue(lines, 'frequency', ':', true);
+ const qualityString = util.getValue(lines, 'Quality', '=', true);
+ const dbParts = qualityString.toLowerCase().split('signal level=');
+ const db = dbParts.length > 1 ? util.toInt(dbParts[1]) : 0;
+ const quality = db ? wifiQualityFromDB(db) : 0;
+ const ssid = util.getValue(lines, 'essid', ':', true);
+
+ // security and wpa-flags
+ const isWpa = element.indexOf(' WPA ') >= 0;
+ const isWpa2 = element.indexOf('WPA2 ') >= 0;
+ const security = [];
+ if (isWpa) { security.push('WPA'); }
+ if (isWpa2) { security.push('WPA2'); }
+ const wpaFlags = [];
+ let wpaFlag = '';
+ lines.forEach(function (line) {
+ const l = line.trim().toLowerCase();
+ if (l.indexOf('group cipher') >= 0) {
+ if (wpaFlag) {
+ wpaFlags.push(wpaFlag);
+ }
+ const parts = l.split(':');
+ if (parts.length > 1) {
+ wpaFlag = parts[1].trim().toUpperCase();
+ }
+ }
+ if (l.indexOf('pairwise cipher') >= 0) {
+ const parts = l.split(':');
+ if (parts.length > 1) {
+ if (parts[1].indexOf('tkip')) { wpaFlag = (wpaFlag ? 'TKIP/' + wpaFlag : 'TKIP'); }
+ else if (parts[1].indexOf('ccmp')) { wpaFlag = (wpaFlag ? 'CCMP/' + wpaFlag : 'CCMP'); }
+ else if (parts[1].indexOf('proprietary')) { wpaFlag = (wpaFlag ? 'PROP/' + wpaFlag : 'PROP'); }
+ }
+ }
+ if (l.indexOf('authentication suites') >= 0) {
+ const parts = l.split(':');
+ if (parts.length > 1) {
+ if (parts[1].indexOf('802.1x')) { wpaFlag = (wpaFlag ? '802.1x/' + wpaFlag : '802.1x'); }
+ else if (parts[1].indexOf('psk')) { wpaFlag = (wpaFlag ? 'PSK/' + wpaFlag : 'PSK'); }
+ }
+ }
+ });
+ if (wpaFlag) {
+ wpaFlags.push(wpaFlag);
+ }
+
+ result.push({
+ ssid,
+ bssid: address,
+ mode,
+ channel: channel ? util.toInt(channel) : null,
+ frequency: frequency ? util.toInt(frequency.replace('.', '')) : null,
+ signalLevel: db,
+ quality,
+ security,
+ wpaFlags,
+ rsnFlags: []
+ });
+ });
+ }
+ return result;
+ } catch (e) {
+ return -1;
+ }
+}
+
+function parseWifiDarwin(wifiObj) {
+ const result = [];
+ if (wifiObj) {
+ wifiObj.forEach(function (wifiItem) {
+ const signalLevel = wifiItem.RSSI;
+ let security = [];
+ let wpaFlags = [];
+ if (wifiItem.WPA_IE) {
+ security.push('WPA');
+ if (wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS) {
+ wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS.forEach(function (ciphers) {
+ if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); }
+ if (ciphers === 2 && wpaFlags.indexOf('PSK/TKIP') === -1) { wpaFlags.push('PSK/TKIP'); }
+ if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); }
+ });
+ }
+ }
+ if (wifiItem.RSN_IE) {
+ security.push('WPA2');
+ if (wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS) {
+ wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS.forEach(function (ciphers) {
+ if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); }
+ if (ciphers === 2 && wpaFlags.indexOf('TKIP/TKIP') === -1) { wpaFlags.push('TKIP/TKIP'); }
+ if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); }
+ });
+ }
+ }
+ result.push({
+ ssid: wifiItem.SSID_STR,
+ bssid: wifiItem.BSSID,
+ mode: '',
+ channel: wifiItem.CHANNEL,
+ frequency: wifiFrequencyFromChannel(wifiItem.CHANNEL),
+ signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
+ quality: wifiQualityFromDB(signalLevel),
+ security,
+ wpaFlags,
+ rsnFlags: []
+ });
+ });
+ }
+ return result;
+}
+function wifiNetworks(callback) {
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ let result = [];
+ if (_linux) {
+ result = getWifiNetworkListNmi();
+ if (result.length === 0) {
+ try {
+ const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL').toString().split('\n\n');
+ let iface = '';
+ iwconfigParts.forEach(element => {
+ if (element.indexOf('no wireless') === -1 && element.trim() !== '') {
+ iface = element.split(' ')[0];
+ }
+ });
+ if (iface) {
+ const res = getWifiNetworkListIw(iface);
+ if (res === -1) {
+ // try again after 4 secs
+ setTimeout(function (iface) {
+ const res = getWifiNetworkListIw(iface);
+ if (res != -1) { result = res; }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }, 4000);
+ } else {
+ result = res;
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ } catch (e) {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ } else if (_darwin) {
+ let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x';
+ exec(cmd, { maxBuffer: 1024 * 40000 }, function (error, stdout) {
+ const output = stdout.toString();
+ result = parseWifiDarwin(util.plistParser(output));
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else if (_windows) {
+ let cmd = 'netsh wlan show networks mode=Bssid';
+ util.powerShell(cmd).then((stdout) => {
+ const ssidParts = stdout.toString('utf8').split(os.EOL + os.EOL + 'SSID ');
+ ssidParts.shift();
+
+ ssidParts.forEach(ssidPart => {
+ const ssidLines = ssidPart.split(os.EOL);
+ if (ssidLines && ssidLines.length >= 8 && ssidLines[0].indexOf(':') >= 0) {
+ const bssidsParts = ssidPart.split(' BSSID');
+ bssidsParts.shift();
+
+ bssidsParts.forEach((bssidPart) => {
+ const bssidLines = bssidPart.split(os.EOL);
+ const bssidLine = bssidLines[0].split(':');
+ bssidLine.shift();
+ const bssid = bssidLine.join(':').trim().toLowerCase();
+ const channel = bssidLines[3].split(':').pop().trim();
+ const quality = bssidLines[1].split(':').pop().trim();
+
+ result.push({
+ ssid: ssidLines[0].split(':').pop().trim(),
+ bssid,
+ mode: '',
+ channel: channel ? parseInt(channel, 10) : null,
+ frequency: wifiFrequencyFromChannel(channel),
+ signalLevel: wifiDBFromQuality(quality),
+ quality: quality ? parseInt(quality, 10) : null,
+ security: [ssidLines[2].split(':').pop().trim()],
+ wpaFlags: [ssidLines[3].split(':').pop().trim()],
+ rsnFlags: []
+ });
+ });
+ }
+ });
+
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.wifiNetworks = wifiNetworks;
+
+function getVendor(model) {
+ model = model.toLowerCase();
+ let result = '';
+ if (model.indexOf('intel') >= 0) { result = 'Intel'; }
+ else if (model.indexOf('realtek') >= 0) { result = 'Realtek'; }
+ else if (model.indexOf('qualcom') >= 0) { result = 'Qualcom'; }
+ else if (model.indexOf('broadcom') >= 0) { result = 'Broadcom'; }
+ else if (model.indexOf('cavium') >= 0) { result = 'Cavium'; }
+ else if (model.indexOf('cisco') >= 0) { result = 'Cisco'; }
+ else if (model.indexOf('marvel') >= 0) { result = 'Marvel'; }
+ else if (model.indexOf('zyxel') >= 0) { result = 'Zyxel'; }
+ else if (model.indexOf('melanox') >= 0) { result = 'Melanox'; }
+ else if (model.indexOf('d-link') >= 0) { result = 'D-Link'; }
+ else if (model.indexOf('tp-link') >= 0) { result = 'TP-Link'; }
+ else if (model.indexOf('asus') >= 0) { result = 'Asus'; }
+ else if (model.indexOf('linksys') >= 0) { result = 'Linksys'; }
+ return result;
+}
+
+function wifiConnections(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ const result = [];
+
+ if (_linux) {
+ const ifaces = ifaceListLinux();
+ const networkList = getWifiNetworkListNmi();
+ ifaces.forEach(ifaceDetail => {
+ const nmiDetails = nmiDeviceLinux(ifaceDetail.iface);
+ const wpaDetails = wpaConnectionLinux(ifaceDetail.iface);
+ const ssid = nmiDetails.ssid || wpaDetails.ssid;
+ const network = networkList.filter(nw => nw.ssid === ssid);
+ const nmiConnection = nmiConnectionLinux(ssid);
+ const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null);
+ const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null);
+ if (ssid && bssid) {
+ result.push({
+ id: ifaceDetail.id,
+ iface: ifaceDetail.iface,
+ model: nmiDetails.product,
+ ssid,
+ bssid: network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null),
+ channel,
+ frequency: channel ? wifiFrequencyFromChannel(channel) : null,
+ type: nmiConnection.type ? nmiConnection.type : '802.11',
+ security: nmiConnection.security ? nmiConnection.security : (wpaDetails.security ? wpaDetails.security : null),
+ signalLevel: network && network.length && network[0].signalLevel ? network[0].signalLevel : null,
+ txRate: null
+ });
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else if (_darwin) {
+ let cmd = 'system_profiler SPNetworkDataType';
+ exec(cmd, function (error, stdout) {
+ const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n');
+ if (parts1.length > 1) {
+ const lines = parts1[1].split('\n\n')[0].split('\n');
+ const iface = util.getValue(lines, 'BSD Device Name', ':', true);
+ const model = util.getValue(lines, 'hardware', ':', true);
+ cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I';
+ exec(cmd, function (error, stdout) {
+ const lines2 = stdout.toString().split('\n');
+ if (lines.length > 10) {
+ const ssid = util.getValue(lines2, 'ssid', ':', true);
+ const bssid = util.getValue(lines2, 'bssid', ':', true);
+ const security = util.getValue(lines2, 'link auth', ':', true);
+ const txRate = util.getValue(lines2, 'lastTxRate', ':', true);
+ const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0];
+ const type = '802.11';
+ const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
+ const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
+ const signalLevel = rssi - noise;
+ if (ssid || bssid) {
+ result.push({
+ id: 'Wi-Fi',
+ iface,
+ model,
+ ssid,
+ bssid,
+ channel: util.toInt(channel),
+ frequency: channel ? wifiFrequencyFromChannel(channel) : null,
+ type,
+ security,
+ signalLevel,
+ txRate
+ });
+ }
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ }
+ });
+ } else if (_windows) {
+ let cmd = 'netsh wlan show interfaces';
+ util.powerShell(cmd).then(function (stdout) {
+ const allLines = stdout.toString().split('\r\n');
+ for (let i = 0; i < allLines.length; i++) {
+ allLines[i] = allLines[i].trim();
+ }
+ const parts = allLines.join('\r\n').split(':\r\n\r\n');
+ parts.shift();
+ parts.forEach(part => {
+ const lines = part.split('\r\n');
+ if (lines.length >= 5) {
+ const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : '';
+ const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : '';
+ const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : '';
+ const ssid = util.getValue(lines, 'SSID', ':', true);
+ const bssid = util.getValue(lines, 'BSSID', ':', true);
+ const signalLevel = util.getValue(lines, 'Signal', ':', true);
+ const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null;
+ const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null;
+ const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null;
+ const txRate = util.getValue(lines, 'Transmit rate (mbps)', ':', true) || util.getValue(lines, 'Transmission (mbit/s)', ':', true) || util.getValue(lines, 'Empfangsrate (MBit/s)', ':', true) || null;
+ if (model && id && ssid && bssid) {
+ result.push({
+ id,
+ iface,
+ model,
+ ssid,
+ bssid,
+ channel: util.toInt(channel),
+ frequency: channel ? wifiFrequencyFromChannel(channel) : null,
+ type,
+ security,
+ signalLevel,
+ txRate: util.toInt(txRate) || null
+ });
+ }
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.wifiConnections = wifiConnections;
+
+function wifiInterfaces(callback) {
+
+ return new Promise((resolve) => {
+ process.nextTick(() => {
+ const result = [];
+
+ if (_linux) {
+ const ifaces = ifaceListLinux();
+ ifaces.forEach(ifaceDetail => {
+ const nmiDetails = nmiDeviceLinux(ifaceDetail.iface);
+ result.push({
+ id: ifaceDetail.id,
+ iface: ifaceDetail.iface,
+ model: nmiDetails.product ? nmiDetails.product : null,
+ vendor: nmiDetails.vendor ? nmiDetails.vendor : null,
+ mac: ifaceDetail.mac,
+ });
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ } else if (_darwin) {
+ let cmd = 'system_profiler SPNetworkDataType';
+ exec(cmd, function (error, stdout) {
+ const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n');
+ if (parts1.length > 1) {
+ const lines = parts1[1].split('\n\n')[0].split('\n');
+ const iface = util.getValue(lines, 'BSD Device Name', ':', true);
+ const mac = util.getValue(lines, 'MAC Address', ':', true);
+ const model = util.getValue(lines, 'hardware', ':', true);
+ result.push({
+ id: 'Wi-Fi',
+ iface,
+ model,
+ vendor: '',
+ mac
+ });
+ }
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else if (_windows) {
+ let cmd = 'netsh wlan show interfaces';
+ util.powerShell(cmd).then(function (stdout) {
+ const allLines = stdout.toString().split('\r\n');
+ for (let i = 0; i < allLines.length; i++) {
+ allLines[i] = allLines[i].trim();
+ }
+ const parts = allLines.join('\r\n').split(':\r\n\r\n');
+ parts.shift();
+ parts.forEach(part => {
+ const lines = part.split('\r\n');
+ if (lines.length >= 5) {
+ const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : '';
+ const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : '';
+ const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : '';
+ const macParts = lines[3].indexOf(':') >= 0 ? lines[3].split(':') : [];
+ macParts.shift();
+ const mac = macParts.join(':').trim();
+ const vendor = getVendor(model);
+ if (iface && model && id && mac) {
+ result.push({
+ id,
+ iface,
+ model,
+ vendor,
+ mac,
+ });
+ }
+ }
+ });
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ });
+ } else {
+ if (callback) {
+ callback(result);
+ }
+ resolve(result);
+ }
+ });
+ });
+}
+
+exports.wifiInterfaces = wifiInterfaces;
diff --git a/node_modules/systeminformation/package.json b/node_modules/systeminformation/package.json
new file mode 100644
index 0000000..7d69779
--- /dev/null
+++ b/node_modules/systeminformation/package.json
@@ -0,0 +1,99 @@
+{
+ "name": "systeminformation",
+ "version": "5.18.3",
+ "description": "Advanced, lightweight system and OS information library",
+ "license": "MIT",
+ "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
+ "homepage": "https://systeminformation.io",
+ "main": "./lib/index.js",
+ "bin": {
+ "systeminformation": "lib/cli.js"
+ },
+ "types": "./lib/index.d.ts",
+ "scripts": {
+ "test": "node ./test/test.js"
+ },
+ "files": [
+ "lib/"
+ ],
+ "keywords": [
+ "system information",
+ "sysinfo",
+ "monitor",
+ "monitoring",
+ "os",
+ "linux",
+ "osx",
+ "windows",
+ "freebsd",
+ "openbsd",
+ "netbsd",
+ "cpu",
+ "cpuload",
+ "physical cores",
+ "logical cores",
+ "processor",
+ "cores",
+ "threads",
+ "socket type",
+ "memory",
+ "file system",
+ "fsstats",
+ "diskio",
+ "block devices",
+ "netstats",
+ "network",
+ "network interfaces",
+ "network connections",
+ "network stats",
+ "iface",
+ "printer",
+ "processes",
+ "users",
+ "internet",
+ "battery",
+ "docker",
+ "docker stats",
+ "docker processes",
+ "graphics",
+ "graphic card",
+ "graphic controller",
+ "gpu",
+ "display",
+ "smart",
+ "disk layout",
+ "usb",
+ "audio",
+ "bluetooth",
+ "wifi",
+ "wifinetworks",
+ "virtual box",
+ "virtualbox",
+ "vm",
+ "backend",
+ "hardware",
+ "BIOS",
+ "chassis"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/sebhildebrandt/systeminformation.git"
+ },
+ "funding": {
+ "type": "Buy me a coffee",
+ "url": "https://www.buymeacoffee.com/systeminfo"
+ },
+ "os": [
+ "darwin",
+ "linux",
+ "win32",
+ "freebsd",
+ "openbsd",
+ "netbsd",
+ "sunos",
+ "android"
+ ],
+ "engines": {
+ "node": ">=8.0.0"
+ }
+}
diff --git a/node_modules/table-layout/LICENSE b/node_modules/table-layout/LICENSE
new file mode 100644
index 0000000..9d2d6db
--- /dev/null
+++ b/node_modules/table-layout/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-21 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/table-layout/README.hbs b/node_modules/table-layout/README.hbs
new file mode 100644
index 0000000..022e4ef
--- /dev/null
+++ b/node_modules/table-layout/README.hbs
@@ -0,0 +1,84 @@
+[![view on npm](https://badgen.net/npm/v/table-layout)](https://www.npmjs.org/package/table-layout)
+[![npm module downloads](https://badgen.net/npm/dt/table-layout)](https://www.npmjs.org/package/table-layout)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=PACKAGE)
+[![Build Status](https://travis-ci.org/75lb/table-layout.svg?branch=master)](https://travis-ci.org/75lb/table-layout)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/table-layout/badge.svg)](https://coveralls.io/github/75lb/table-layout)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+# table-layout
+
+Generates plain-text tables from JSON recordset input (array of objects). Useful for presenting text in column layout or data in table layout in text-based user interfaces. Also [available as a command-line tool](https://github.com/75lb/table-layout-cli).
+
+## Synopsis
+
+Where input looks like this:
+
+```json
+[
+ {
+ "number": 15134,
+ "title": "Coveralls has no source available ",
+ "login": "ndelangen",
+ "comments": 0
+ },
+ {
+ "number": 15133,
+ "title": "Fixing --preserve-symlinks. Enhancing node to exploit.",
+ "login": "phestermcs",
+ "comments": 0
+ },
+ {
+ "number": 15131,
+ "title": "Question - Confused about NPM's local installation philosophy",
+ "login": "the1mills",
+ "comments": 0
+ },
+ {
+ "number": 15130,
+ "title": "Question - global npm cache directory if user is root?",
+ "login": "ORESoftware",
+ "comments": 0
+ }
+]
+```
+
+This code...
+
+```js
+const Table = require('table-layout')
+const issues = require('./issues.json')
+const table = new Table(issues, { maxWidth: 60 })
+console.log(table.toString())
+```
+
+...produces this output:
+
+```
+ 15134 Coveralls has no source available ndelangen 0
+ 15133 Fixing --preserve-symlinks. phestermcs 0
+ Enhancing node to exploit.
+ 15131 Question - Confused about NPM's the1mills 0
+ local installation philosophy
+ 15130 Question - global npm cache ORESoftware 0
+ directory if user is root?
+ 15127 how to installa gulp fontfacegen aramgreat 0
+ on Windows 10
+ 15097 Cannot install package from mastertinner 3
+ tarball out of package.json entry
+ generated by npm
+ 15067 npm "SELF_SIGNED_CERT_IN_CHAIN" LegendsLyfe 3
+ error when installing discord.js
+ with .log
+```
+
+## API Reference
+{{#module name="table-layout"}}
+{{>body~}}
+{{>member-index~}}
+{{>members~}}
+{{/module}}
+
+* * *
+
+&copy; 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/README.md b/node_modules/table-layout/README.md
new file mode 100644
index 0000000..71b884d
--- /dev/null
+++ b/node_modules/table-layout/README.md
@@ -0,0 +1,154 @@
+[![view on npm](https://badgen.net/npm/v/table-layout)](https://www.npmjs.org/package/table-layout)
+[![npm module downloads](https://badgen.net/npm/dt/table-layout)](https://www.npmjs.org/package/table-layout)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=PACKAGE)
+[![Build Status](https://travis-ci.org/75lb/table-layout.svg?branch=master)](https://travis-ci.org/75lb/table-layout)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/table-layout/badge.svg)](https://coveralls.io/github/75lb/table-layout)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+# table-layout
+
+Generates plain-text tables from JSON recordset input (array of objects). Useful for presenting text in column layout or data in table layout in text-based user interfaces. Also [available as a command-line tool](https://github.com/75lb/table-layout-cli).
+
+## Synopsis
+
+Where input looks like this:
+
+```json
+[
+ {
+ "number": 15134,
+ "title": "Coveralls has no source available ",
+ "login": "ndelangen",
+ "comments": 0
+ },
+ {
+ "number": 15133,
+ "title": "Fixing --preserve-symlinks. Enhancing node to exploit.",
+ "login": "phestermcs",
+ "comments": 0
+ },
+ {
+ "number": 15131,
+ "title": "Question - Confused about NPM's local installation philosophy",
+ "login": "the1mills",
+ "comments": 0
+ },
+ {
+ "number": 15130,
+ "title": "Question - global npm cache directory if user is root?",
+ "login": "ORESoftware",
+ "comments": 0
+ }
+]
+```
+
+This code...
+
+```js
+const Table = require('table-layout')
+const issues = require('./issues.json')
+const table = new Table(issues, { maxWidth: 60 })
+console.log(table.toString())
+```
+
+...produces this output:
+
+```
+ 15134 Coveralls has no source available ndelangen 0
+ 15133 Fixing --preserve-symlinks. phestermcs 0
+ Enhancing node to exploit.
+ 15131 Question - Confused about NPM's the1mills 0
+ local installation philosophy
+ 15130 Question - global npm cache ORESoftware 0
+ directory if user is root?
+ 15127 how to installa gulp fontfacegen aramgreat 0
+ on Windows 10
+ 15097 Cannot install package from mastertinner 3
+ tarball out of package.json entry
+ generated by npm
+ 15067 npm "SELF_SIGNED_CERT_IN_CHAIN" LegendsLyfe 3
+ error when installing discord.js
+ with .log
+```
+
+## API Reference
+
+* [table-layout](#module_table-layout)
+ * [Table](#exp_module_table-layout--Table) ⏏
+ * [new Table(data, [options])](#new_module_table-layout--Table_new)
+ * [table.renderLines()](#module_table-layout--Table+renderLines) ⇒ <code>Array.&lt;string&gt;</code>
+ * [table.toString()](#module_table-layout--Table+toString) ⇒ <code>string</code>
+ * [Table~columnOption](#module_table-layout--Table..columnOption)
+
+<a name="exp_module_table-layout--Table"></a>
+
+### Table ⏏
+Recordset data in (array of objects), text table out.
+
+**Kind**: Exported class
+<a name="new_module_table-layout--Table_new"></a>
+
+#### new Table(data, [options])
+**Params**
+
+- data <code>Array.&lt;object&gt;</code> - input data
+- [options] <code>object</code> - optional settings
+ - [.maxWidth] <code>number</code> - maximum width of layout
+ - [.noWrap] <code>boolean</code> - disable wrapping on all columns
+ - [.noTrim] <code>boolean</code> - disable line-trimming
+ - [.break] <code>boolean</code> - enable word-breaking on all columns
+ - [.columns] [<code>columnOption</code>](#module_table-layout--Table..columnOption) - array of column-specific options
+ - [.ignoreEmptyColumns] <code>boolean</code> - if set, empty columns or columns containing only whitespace are not rendered.
+ - [.padding] <code>object</code> - Padding values to set on each column. Per-column overrides can be set in the `options.columns` array.
+ - [.left] <code>string</code> - Defaults to a single space.
+ - [.right] <code>string</code> - Defaults to a single space.
+
+**Example**
+```js
+> Table = require('table-layout')
+> jsonData = [{
+ col1: 'Some text you wish to read in table layout',
+ col2: 'And some more text in column two. '
+}]
+> table = new Table(jsonData, { maxWidth: 30 })
+> console.log(table.toString())
+ Some text you And some more
+ wish to read text in
+ in table column two.
+ layout
+```
+<a name="module_table-layout--Table+renderLines"></a>
+
+#### table.renderLines() ⇒ <code>Array.&lt;string&gt;</code>
+Identical to `.toString()` with the exception that the result will be an array of lines, rather than a single, multi-line string.
+
+**Kind**: instance method of [<code>Table</code>](#exp_module_table-layout--Table)
+<a name="module_table-layout--Table+toString"></a>
+
+#### table.toString() ⇒ <code>string</code>
+Returns the input data as a text table.
+
+**Kind**: instance method of [<code>Table</code>](#exp_module_table-layout--Table)
+<a name="module_table-layout--Table..columnOption"></a>
+
+#### Table~columnOption
+**Kind**: inner typedef of [<code>Table</code>](#exp_module_table-layout--Table)
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| name | <code>string</code> | column name, must match a property name in the input |
+| [width] | <code>number</code> | A specific column width. Supply either this or a min and/or max width. |
+| [minWidth] | <code>number</code> | column min width |
+| [maxWidth] | <code>number</code> | column max width |
+| [nowrap] | <code>boolean</code> | disable wrapping for this column |
+| [break] | <code>boolean</code> | enable word-breaking for this columns |
+| [padding] | <code>object</code> | padding options |
+| [padding.left] | <code>string</code> | a string to pad the left of each cell (default: `' '`) |
+| [padding.right] | <code>string</code> | a string to pad the right of each cell (default: `' '`) |
+
+
+* * *
+
+&copy; 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/index.js b/node_modules/table-layout/index.js
new file mode 100644
index 0000000..7a94692
--- /dev/null
+++ b/node_modules/table-layout/index.js
@@ -0,0 +1,197 @@
+const os = require('os')
+
+/**
+ * @module table-layout
+ */
+
+/**
+ * Recordset data in (array of objects), text table out.
+ * @alias module:table-layout
+ * @example
+ * > Table = require('table-layout')
+ * > jsonData = [{
+ * col1: 'Some text you wish to read in table layout',
+ * col2: 'And some more text in column two. '
+ * }]
+ * > table = new Table(jsonData, { maxWidth: 30 })
+ * > console.log(table.toString())
+ * Some text you And some more
+ * wish to read text in
+ * in table column two.
+ * layout
+ */
+class Table {
+ /**
+ * @param {object[]} - input data
+ * @param [options] {object} - optional settings
+ * @param [options.maxWidth] {number} - maximum width of layout
+ * @param [options.noWrap] {boolean} - disable wrapping on all columns
+ * @param [options.noTrim] {boolean} - disable line-trimming
+ * @param [options.break] {boolean} - enable word-breaking on all columns
+ * @param [options.columns] {module:table-layout~columnOption} - array of column-specific options
+ * @param [options.ignoreEmptyColumns] {boolean} - if set, empty columns or columns containing only whitespace are not rendered.
+ * @param [options.padding] {object} - Padding values to set on each column. Per-column overrides can be set in the `options.columns` array.
+ * @param [options.padding.left] {string} - Defaults to a single space.
+ * @param [options.padding.right] {string} - Defaults to a single space.
+ * @alias module:table-layout
+ */
+ constructor (data, options) {
+ let ttyWidth = (process && (process.stdout.columns || process.stderr.columns)) || 0
+
+ /* Windows quirk workaround */
+ if (ttyWidth && os.platform() === 'win32') ttyWidth--
+
+ let defaults = {
+ padding: {
+ left: ' ',
+ right: ' '
+ },
+ maxWidth: ttyWidth || 80,
+ columns: []
+ }
+
+ const extend = require('deep-extend')
+ this.options = extend(defaults, options)
+ this.load(data)
+ }
+
+ load (data) {
+ const Rows = require('./lib/rows')
+ const Columns = require('./lib/columns')
+
+ let options = this.options
+
+ /* remove empty columns */
+ if (options.ignoreEmptyColumns) {
+ data = Rows.removeEmptyColumns(data)
+ }
+
+ this.columns = Columns.getColumns(data)
+ this.rows = new Rows(data, this.columns)
+
+ /* load default column properties from options */
+ this.columns.maxWidth = options.maxWidth
+ this.columns.list.forEach(column => {
+ if (options.padding) column.padding = options.padding
+ if (options.noWrap) column.noWrap = options.noWrap
+ if (options.break) {
+ column.break = options.break
+ column.contentWrappable = true
+ }
+ })
+
+ /* load column properties from options.columns */
+ options.columns.forEach(optionColumn => {
+ let column = this.columns.get(optionColumn.name)
+ if (column) {
+ if (optionColumn.padding) {
+ column.padding.left = optionColumn.padding.left
+ column.padding.right = optionColumn.padding.right
+ }
+ if (optionColumn.width) column.width = optionColumn.width
+ if (optionColumn.maxWidth) column.maxWidth = optionColumn.maxWidth
+ if (optionColumn.minWidth) column.minWidth = optionColumn.minWidth
+ if (optionColumn.noWrap) column.noWrap = optionColumn.noWrap
+ if (optionColumn.break) {
+ column.break = optionColumn.break
+ column.contentWrappable = true
+ }
+ }
+ })
+
+ this.columns.autoSize()
+ return this
+ }
+
+ getWrapped () {
+ const wrap = require('wordwrapjs')
+
+ this.columns.autoSize()
+ return this.rows.list.map(row => {
+ let line = []
+ row.forEach((cell, column) => {
+ if (column.noWrap) {
+ line.push(cell.value.split(/\r\n?|\n/))
+ } else {
+ line.push(wrap.lines(cell.value, {
+ width: column.wrappedContentWidth,
+ break: column.break,
+ noTrim: this.options.noTrim
+ }))
+ }
+ })
+ return line
+ })
+ }
+
+ getLines () {
+ var wrappedLines = this.getWrapped()
+ var lines = []
+ wrappedLines.forEach(wrapped => {
+ let mostLines = getLongestArray(wrapped)
+ for (let i = 0; i < mostLines; i++) {
+ let line = []
+ wrapped.forEach(cell => {
+ line.push(cell[i] || '')
+ })
+ lines.push(line)
+ }
+ })
+ return lines
+ }
+
+ /**
+ * Identical to `.toString()` with the exception that the result will be an array of lines, rather than a single, multi-line string.
+ * @returns {string[]}
+ */
+ renderLines () {
+ var lines = this.getLines()
+ return lines.map(line => {
+ return line.reduce((prev, cell, index) => {
+ let column = this.columns.list[index]
+ return prev + padCell(cell, column.padding, column.generatedWidth)
+ }, '')
+ })
+ }
+
+ /**
+ * Returns the input data as a text table.
+ * @returns {string}
+ */
+ toString () {
+ return this.renderLines().join(os.EOL) + os.EOL
+ }
+}
+
+/**
+ * Array of arrays in.. Returns the length of the longest one
+ * @returns {number}
+ * @private
+ */
+function getLongestArray (arrays) {
+ var lengths = arrays.map(array => array.length)
+ return Math.max.apply(null, lengths)
+}
+
+function padCell (cellValue, padding, width) {
+ const ansi = require('./lib/ansi')
+ var ansiLength = cellValue.length - ansi.remove(cellValue).length
+ cellValue = cellValue || ''
+ return (padding.left || '') +
+ cellValue.padEnd(width - padding.length() + ansiLength) + (padding.right || '')
+}
+
+/**
+ * @typedef module:table-layout~columnOption
+ * @property name {string} - column name, must match a property name in the input
+ * @property [width] {number} - A specific column width. Supply either this or a min and/or max width.
+ * @property [minWidth] {number} - column min width
+ * @property [maxWidth] {number} - column max width
+ * @property [nowrap] {boolean} - disable wrapping for this column
+ * @property [break] {boolean} - enable word-breaking for this columns
+ * @property [padding] {object} - padding options
+ * @property [padding.left] {string} - a string to pad the left of each cell (default: `' '`)
+ * @property [padding.right] {string} - a string to pad the right of each cell (default: `' '`)
+ */
+
+module.exports = Table
diff --git a/node_modules/table-layout/lib/ansi.js b/node_modules/table-layout/lib/ansi.js
new file mode 100644
index 0000000..e98aa6d
--- /dev/null
+++ b/node_modules/table-layout/lib/ansi.js
@@ -0,0 +1,15 @@
+const ansiEscapeSequence = /\u001b.*?m/g
+
+/**
+ * @module ansi
+ */
+exports.remove = remove
+exports.has = has
+
+function remove (input) {
+ return input.replace(ansiEscapeSequence, '')
+}
+
+function has (input) {
+ return ansiEscapeSequence.test(input)
+}
diff --git a/node_modules/table-layout/lib/cell.js b/node_modules/table-layout/lib/cell.js
new file mode 100644
index 0000000..4351e8d
--- /dev/null
+++ b/node_modules/table-layout/lib/cell.js
@@ -0,0 +1,28 @@
+const t = require('typical')
+
+const _value = new WeakMap()
+const _column = new WeakMap()
+
+class Cell {
+ constructor (value, column) {
+ this.value = value
+ _column.set(this, column)
+ }
+
+ set value (val) {
+ _value.set(this, val)
+ }
+
+ get value () {
+ let cellValue = _value.get(this)
+ if (typeof cellValue === 'function') cellValue = cellValue.call(_column.get(this))
+ if (cellValue === undefined) {
+ cellValue = ''
+ } else {
+ cellValue = String(cellValue)
+ }
+ return cellValue
+ }
+}
+
+module.exports = Cell
diff --git a/node_modules/table-layout/lib/column.js b/node_modules/table-layout/lib/column.js
new file mode 100644
index 0000000..8defc88
--- /dev/null
+++ b/node_modules/table-layout/lib/column.js
@@ -0,0 +1,67 @@
+const t = require('typical')
+const Padding = require('./padding')
+
+/**
+ * @module column
+ */
+
+const _padding = new WeakMap()
+
+// setting any column property which is a factor of the width should trigger autoSize()
+
+/**
+ * Represents a table column
+ */
+class Column {
+ constructor (column) {
+ /**
+ * @type {string}
+ */
+ if (t.isDefined(column.name)) this.name = column.name
+ /**
+ * @type {number}
+ */
+ if (t.isDefined(column.width)) this.width = column.width
+ if (t.isDefined(column.maxWidth)) this.maxWidth = column.maxWidth
+ if (t.isDefined(column.minWidth)) this.minWidth = column.minWidth
+ if (t.isDefined(column.noWrap)) this.noWrap = column.noWrap
+ if (t.isDefined(column.break)) this.break = column.break
+ if (t.isDefined(column.contentWrappable)) this.contentWrappable = column.contentWrappable
+ if (t.isDefined(column.contentWidth)) this.contentWidth = column.contentWidth
+ if (t.isDefined(column.minContentWidth)) this.minContentWidth = column.minContentWidth
+ this.padding = column.padding || { left: ' ', right: ' ' }
+ this.generatedWidth = null
+ }
+
+ set padding (padding) {
+ _padding.set(this, new Padding(padding))
+ }
+ get padding () {
+ return _padding.get(this)
+ }
+
+ /**
+ * the width of the content (excluding padding) after being wrapped
+ */
+ get wrappedContentWidth () {
+ return Math.max(this.generatedWidth - this.padding.length(), 0)
+ }
+
+ isResizable () {
+ return !this.isFixed()
+ }
+
+ isFixed () {
+ return t.isDefined(this.width) || this.noWrap || !this.contentWrappable
+ }
+
+ generateWidth () {
+ this.generatedWidth = this.width || (this.contentWidth + this.padding.length())
+ }
+
+ generateMinWidth () {
+ this.minWidth = this.minContentWidth + this.padding.length()
+ }
+}
+
+module.exports = Column
diff --git a/node_modules/table-layout/lib/columns.js b/node_modules/table-layout/lib/columns.js
new file mode 100644
index 0000000..5135ffd
--- /dev/null
+++ b/node_modules/table-layout/lib/columns.js
@@ -0,0 +1,156 @@
+const t = require('typical')
+const arrayify = require('array-back')
+const Column = require('./column')
+const wrap = require('wordwrapjs')
+const Cell = require('./cell')
+const ansi = require('./ansi')
+
+const _maxWidth = new WeakMap()
+
+/**
+ * @module columns
+ */
+
+class Columns {
+ constructor (columns) {
+ this.list = []
+ arrayify(columns).forEach(this.add.bind(this))
+ }
+
+ /**
+ * sum of all generatedWidth fields
+ * @return {number}
+ */
+ totalWidth () {
+ return this.list.length
+ ? this.list.map(col => col.generatedWidth).reduce((a, b) => a + b)
+ : 0
+ }
+
+ totalFixedWidth () {
+ return this.getFixed()
+ .map(col => col.generatedWidth)
+ .reduce((a, b) => a + b, 0)
+ }
+
+ get (columnName) {
+ return this.list.find(column => column.name === columnName)
+ }
+
+ getResizable () {
+ return this.list.filter(column => column.isResizable())
+ }
+
+ getFixed () {
+ return this.list.filter(column => column.isFixed())
+ }
+
+ add (column) {
+ const col = column instanceof Column ? column : new Column(column)
+ this.list.push(col)
+ return col
+ }
+
+ set maxWidth (val) {
+ _maxWidth.set(this, val)
+ }
+
+ /**
+ * sets `generatedWidth` for each column
+ * @chainable
+ */
+ autoSize () {
+ const maxWidth = _maxWidth.get(this)
+
+ /* size */
+ this.list.forEach(column => {
+ column.generateWidth()
+ column.generateMinWidth()
+ })
+
+ /* adjust if user set a min or maxWidth */
+ this.list.forEach(column => {
+ if (t.isDefined(column.maxWidth) && column.generatedWidth > column.maxWidth) {
+ column.generatedWidth = column.maxWidth
+ }
+
+ if (t.isDefined(column.minWidth) && column.generatedWidth < column.minWidth) {
+ column.generatedWidth = column.minWidth
+ }
+ })
+
+ const width = {
+ total: this.totalWidth(),
+ view: maxWidth,
+ diff: this.totalWidth() - maxWidth,
+ totalFixed: this.totalFixedWidth(),
+ totalResizable: Math.max(maxWidth - this.totalFixedWidth(), 0)
+ }
+
+ /* adjust if short of space */
+ if (width.diff > 0) {
+ /* share the available space between resizeable columns */
+ let resizableColumns = this.getResizable()
+ resizableColumns.forEach(column => {
+ column.generatedWidth = Math.floor(width.totalResizable / resizableColumns.length)
+ })
+
+ /* at this point, the generatedWidth should never end up bigger than the contentWidth */
+ const grownColumns = this.list.filter(column => column.generatedWidth > column.contentWidth)
+ const shrunkenColumns = this.list.filter(column => column.generatedWidth < column.contentWidth)
+ let salvagedSpace = 0
+ grownColumns.forEach(column => {
+ const currentGeneratedWidth = column.generatedWidth
+ column.generateWidth()
+ salvagedSpace += currentGeneratedWidth - column.generatedWidth
+ })
+ shrunkenColumns.forEach(column => {
+ column.generatedWidth += Math.floor(salvagedSpace / shrunkenColumns.length)
+ })
+
+ /* if, after autosizing, we still don't fit within maxWidth then give up */
+ }
+
+ return this
+ }
+
+ /**
+ * Factory method returning all distinct columns from input
+ * @param {object[]} - input recordset
+ * @return {module:columns}
+ */
+ static getColumns (rows) {
+ var columns = new Columns()
+ arrayify(rows).forEach(row => {
+ for (let columnName in row) {
+ let column = columns.get(columnName)
+ if (!column) {
+ column = columns.add({ name: columnName, contentWidth: 0, minContentWidth: 0 })
+ }
+ let cell = new Cell(row[columnName], column)
+ let cellValue = cell.value
+ if (ansi.has(cellValue)) {
+ cellValue = ansi.remove(cellValue)
+ }
+
+ if (cellValue.length > column.contentWidth) column.contentWidth = cellValue.length
+
+ let longestWord = getLongestWord(cellValue)
+ if (longestWord > column.minContentWidth) {
+ column.minContentWidth = longestWord
+ }
+ if (!column.contentWrappable) column.contentWrappable = wrap.isWrappable(cellValue)
+ }
+ })
+ return columns
+ }
+}
+
+function getLongestWord (line) {
+ const words = wrap.getChunks(line)
+ return words.reduce((max, word) => {
+ return Math.max(word.length, max)
+ }, 0)
+}
+
+module.exports = Columns
diff --git a/node_modules/table-layout/lib/padding.js b/node_modules/table-layout/lib/padding.js
new file mode 100644
index 0000000..4af7910
--- /dev/null
+++ b/node_modules/table-layout/lib/padding.js
@@ -0,0 +1,14 @@
+class Padding {
+ constructor (padding) {
+ this.left = padding.left
+ this.right = padding.right
+ }
+ length () {
+ return this.left.length + this.right.length
+ }
+}
+
+/**
+@module padding
+*/
+module.exports = Padding
diff --git a/node_modules/table-layout/lib/rows.js b/node_modules/table-layout/lib/rows.js
new file mode 100644
index 0000000..3972f07
--- /dev/null
+++ b/node_modules/table-layout/lib/rows.js
@@ -0,0 +1,52 @@
+const arrayify = require('array-back')
+const Cell = require('./cell')
+const t = require('typical')
+
+/**
+ *
+ */
+class Rows {
+ constructor (rows, columns) {
+ this.list = []
+ this.load(rows, columns)
+ }
+
+ load (rows, columns) {
+ arrayify(rows).forEach(row => {
+ this.list.push(new Map(objectToIterable(row, columns)))
+ })
+ }
+
+ static removeEmptyColumns (data) {
+ const distinctColumnNames = data.reduce((columnNames, row) => {
+ Object.keys(row).forEach(key => {
+ if (columnNames.indexOf(key) === -1) columnNames.push(key)
+ })
+ return columnNames
+ }, [])
+
+ const emptyColumns = distinctColumnNames.filter(columnName => {
+ const hasValue = data.some(row => {
+ const value = row[columnName]
+ return (t.isDefined(value) && typeof value !== 'string') || (typeof value === 'string' && /\S+/.test(value))
+ })
+ return !hasValue
+ })
+
+ return data.map(row => {
+ emptyColumns.forEach(emptyCol => delete row[emptyCol])
+ return row
+ })
+ }
+}
+
+function objectToIterable (row, columns) {
+ return columns.list.map(column => {
+ return [ column, new Cell(row[column.name], column) ]
+ })
+}
+
+/**
+ * @module rows
+ */
+module.exports = Rows
diff --git a/node_modules/table-layout/node_modules/array-back/LICENSE b/node_modules/table-layout/node_modules/array-back/LICENSE
new file mode 100644
index 0000000..203018f
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/table-layout/node_modules/array-back/README.hbs b/node_modules/table-layout/node_modules/array-back/README.hbs
new file mode 100644
index 0000000..7d84bd2
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/node_modules/array-back/README.md b/node_modules/table-layout/node_modules/array-back/README.md
new file mode 100644
index 0000000..431339e
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/README.md
@@ -0,0 +1,81 @@
+[![view on npm](https://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![npm module downloads](https://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
+[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/array-back/badge.svg?branch=master)](https://coveralls.io/github/75lb/array-back?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/array-back)](https://david-dm.org/75lb/array-back)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_array-back"></a>
+
+## array-back
+Takes any input and guarantees an array back.
+
+- Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+- Converts `undefined` to an empty array.
+- Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+- Ignores input which is already an array.
+
+**Example**
+```js
+> const arrayify = require('array-back')
+
+> arrayify(undefined)
+[]
+
+> arrayify(null)
+[ null ]
+
+> arrayify(0)
+[ 0 ]
+
+> arrayify([ 1, 2 ])
+[ 1, 2 ]
+
+> arrayify(new Set([ 1, 2 ]))
+[ 1, 2 ]
+
+> function f(){ return arrayify(arguments); }
+> f(1,2,3)
+[ 1, 2, 3 ]
+```
+<a name="exp_module_array-back--arrayify"></a>
+
+### arrayify(input) ⇒ <code>Array</code> ⏏
+**Kind**: Exported function
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | The input value to convert to an array |
+
+
+### Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const arrayify = require('array-back')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import arrayify from 'array-back'
+```
+
+Within an modern browser ECMAScript Module:
+
+```js
+import arrayify from './node_modules/array-back/index.mjs'
+```
+
+Old browser (adds `window.arrayBack`):
+
+```html
+<script nomodule src="./node_modules/array-back/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/node_modules/array-back/dist/index.js b/node_modules/table-layout/node_modules/array-back/dist/index.js
new file mode 100644
index 0000000..3b97b84
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/dist/index.js
@@ -0,0 +1,70 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.arrayBack = factory());
+}(this, (function () { 'use strict';
+
+ /**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+ function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [input]
+ }
+
+ return arrayify;
+
+})));
diff --git a/node_modules/table-layout/node_modules/array-back/index.mjs b/node_modules/table-layout/node_modules/array-back/index.mjs
new file mode 100644
index 0000000..1090399
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/index.mjs
@@ -0,0 +1,62 @@
+/**
+ * Takes any input and guarantees an array back.
+ *
+ * - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
+ * - Converts `undefined` to an empty array.
+ * - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
+ * - Ignores input which is already an array.
+ *
+ * @module array-back
+ * @example
+ * > const arrayify = require('array-back')
+ *
+ * > arrayify(undefined)
+ * []
+ *
+ * > arrayify(null)
+ * [ null ]
+ *
+ * > arrayify(0)
+ * [ 0 ]
+ *
+ * > arrayify([ 1, 2 ])
+ * [ 1, 2 ]
+ *
+ * > arrayify(new Set([ 1, 2 ]))
+ * [ 1, 2 ]
+ *
+ * > function f(){ return arrayify(arguments); }
+ * > f(1,2,3)
+ * [ 1, 2, 3 ]
+ */
+
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * @param {*} - The input value to convert to an array
+ * @returns {Array}
+ * @alias module:array-back
+ */
+function arrayify (input) {
+ if (Array.isArray(input)) {
+ return input
+ }
+
+ if (input === undefined) {
+ return []
+ }
+
+ if (isArrayLike(input) || input instanceof Set) {
+ return Array.from(input)
+ }
+
+ return [input]
+}
+
+export default arrayify
diff --git a/node_modules/table-layout/node_modules/array-back/package.json b/node_modules/table-layout/node_modules/array-back/package.json
new file mode 100644
index 0000000..a677a10
--- /dev/null
+++ b/node_modules/table-layout/node_modules/array-back/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "array-back",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "4.0.2",
+ "description": "Guarantees an array back",
+ "repository": "https://github.com/75lb/array-back.git",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "to",
+ "convert",
+ "return",
+ "array",
+ "arrayify"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ],
+ "scripts": {
+ "test": "npm run dist && npm run test:esm && npm run test:web",
+ "test:esm": "esm-runner test.mjs",
+ "test:web": "web-runner test.mjs",
+ "docs": "jsdoc2md -t README.hbs index.mjs -c jsdoc.conf > README.md",
+ "dist": "rollup -f umd -n arrayBack -o dist/index.js index.mjs",
+ "cover": "c8 npm run test:esm && c8 report --reporter=text-lcov | coveralls"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "@test-runner/web": "^0.2.1",
+ "c8": "^6.0.1",
+ "coveralls": "^3.0.7",
+ "esm-runner": "^0.2.0",
+ "isomorphic-assert": "^0.1.1",
+ "jsdoc-to-markdown": "^5.0.2",
+ "rollup": "^1.26.5"
+ },
+ "standard": {
+ "ignore": [
+ "dist"
+ ]
+ }
+}
diff --git a/node_modules/table-layout/node_modules/typical/LICENSE b/node_modules/table-layout/node_modules/typical/LICENSE
new file mode 100644
index 0000000..700561a
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/table-layout/node_modules/typical/README.hbs b/node_modules/table-layout/node_modules/typical/README.hbs
new file mode 100644
index 0000000..bb092a1
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/node_modules/typical/README.md b/node_modules/table-layout/node_modules/typical/README.md
new file mode 100644
index 0000000..6e3d513
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/README.md
@@ -0,0 +1,302 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_typical"></a>
+
+## typical
+Isomorphic, functional type-checking for Javascript.
+
+**Example**
+```js
+const t = require('typical')
+const allDefined = array.every(t.isDefined)
+```
+
+* [typical](#module_typical)
+ * [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code>
+ * [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code>
+ * [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code>
+ * [.isObject(input)](#module_typical.isObject) ⇒ <code>boolean</code>
+ * [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code>
+ * [.isUndefined(input)](#module_typical.isUndefined) ⇒ <code>boolean</code>
+ * [.isNull(input)](#module_typical.isNull) ⇒ <code>boolean</code>
+ * [.isDefinedValue(input)](#module_typical.isDefinedValue) ⇒ <code>boolean</code>
+ * [.isClass(input)](#module_typical.isClass) ⇒ <code>boolean</code>
+ * [.isPrimitive(input)](#module_typical.isPrimitive) ⇒ <code>boolean</code>
+ * [.isPromise(input)](#module_typical.isPromise) ⇒ <code>boolean</code>
+ * [.isIterable(input)](#module_typical.isIterable) ⇒ <code>boolean</code>
+ * [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code>
+ * [.isFunction(input)](#module_typical.isFunction) ⇒ <code>boolean</code>
+
+<a name="module_typical.isNumber"></a>
+
+### t.isNumber(n) ⇒ <code>boolean</code>
+Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| n | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isNumber(0)
+true
+> t.isNumber(1)
+true
+> t.isNumber(1.1)
+true
+> t.isNumber(0xff)
+true
+> t.isNumber(0644)
+true
+> t.isNumber(6.2e5)
+true
+> t.isNumber(NaN)
+false
+> t.isNumber(Infinity)
+false
+```
+<a name="module_typical.isPlainObject"></a>
+
+### t.isPlainObject(input) ⇒ <code>boolean</code>
+A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isPlainObject({ something: 'one' })
+true
+> t.isPlainObject(new Date())
+false
+> t.isPlainObject([ 0, 1 ])
+false
+> t.isPlainObject(/test/)
+false
+> t.isPlainObject(1)
+false
+> t.isPlainObject('one')
+false
+> t.isPlainObject(null)
+false
+> t.isPlainObject((function * () {})())
+false
+> t.isPlainObject(function * () {})
+false
+```
+<a name="module_typical.isArrayLike"></a>
+
+### t.isArrayLike(input) ⇒ <code>boolean</code>
+An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+function sum(x, y){
+ console.log(t.isArrayLike(arguments))
+ // prints `true`
+}
+```
+<a name="module_typical.isObject"></a>
+
+### t.isObject(input) ⇒ <code>boolean</code>
+Returns true if the typeof input is `'object'` but not null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefined"></a>
+
+### t.isDefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is defined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isUndefined"></a>
+
+### t.isUndefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is undefined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isNull"></a>
+
+### t.isNull(input) ⇒ <code>boolean</code>
+Returns true if the input value is null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefinedValue"></a>
+
+### t.isDefinedValue(input) ⇒ <code>boolean</code>
+Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isClass"></a>
+
+### t.isClass(input) ⇒ <code>boolean</code>
+Returns true if the input value is an ES2015 `class`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPrimitive"></a>
+
+### t.isPrimitive(input) ⇒ <code>boolean</code>
+Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPromise"></a>
+
+### t.isPromise(input) ⇒ <code>boolean</code>
+Returns true if the input is a Promise.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isIterable"></a>
+
+### t.isIterable(input) ⇒ <code>boolean</code>
+Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isIterable('string')
+true
+> t.isIterable(new Map())
+true
+> t.isIterable([])
+true
+> t.isIterable((function * () {})())
+true
+> t.isIterable(Promise.resolve())
+false
+> t.isIterable(Promise)
+false
+> t.isIterable(true)
+false
+> t.isIterable({})
+false
+> t.isIterable(0)
+false
+> t.isIterable(1.1)
+false
+> t.isIterable(NaN)
+false
+> t.isIterable(Infinity)
+false
+> t.isIterable(function () {})
+false
+> t.isIterable(Date)
+false
+> t.isIterable()
+false
+> t.isIterable({ then: function () {} })
+false
+```
+<a name="module_typical.isString"></a>
+
+### t.isString(input) ⇒ <code>boolean</code>
+Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isFunction"></a>
+
+### t.isFunction(input) ⇒ <code>boolean</code>
+Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/table-layout/node_modules/typical/dist/index.js b/node_modules/table-layout/node_modules/typical/dist/index.js
new file mode 100644
index 0000000..ed8b168
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/dist/index.js
@@ -0,0 +1,295 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (global = global || self, factory(global.typical = {}));
+}(this, function (exports) { 'use strict';
+
+ /**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+ /**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+ function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+ }
+
+ /**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+ function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+ }
+
+ /**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ /**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefined (input) {
+ return typeof input !== 'undefined'
+ }
+
+ /**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isUndefined (input) {
+ return !isDefined(input)
+ }
+
+ /**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isNull (input) {
+ return input === null
+ }
+
+ /**
+ * Returns true if the input value is both defined and not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+ }
+
+ /**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+ function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+ }
+
+ /**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isString (input) {
+ return typeof input === 'string'
+ }
+
+ /**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isFunction (input) {
+ return typeof input === 'function'
+ }
+
+ var index = {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+ };
+
+ exports.default = index;
+ exports.isArrayLike = isArrayLike;
+ exports.isClass = isClass;
+ exports.isDefined = isDefined;
+ exports.isDefinedValue = isDefinedValue;
+ exports.isFunction = isFunction;
+ exports.isIterable = isIterable;
+ exports.isNull = isNull;
+ exports.isNumber = isNumber;
+ exports.isObject = isObject;
+ exports.isPlainObject = isPlainObject;
+ exports.isPrimitive = isPrimitive;
+ exports.isPromise = isPromise;
+ exports.isString = isString;
+ exports.isUndefined = isUndefined;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/node_modules/table-layout/node_modules/typical/index.mjs b/node_modules/table-layout/node_modules/typical/index.mjs
new file mode 100644
index 0000000..d3468a9
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/index.mjs
@@ -0,0 +1,269 @@
+/**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+/**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+export function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+export function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+export function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isUndefined (input) {
+ return !isDefined(input)
+}
+
+/**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isNull (input) {
+ return input === null
+}
+
+/**
+ * Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+}
+
+/**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise
+ const isThenable = input.then && typeof input.then === 'function'
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+export function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+/**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isFunction (input) {
+ return typeof input === 'function'
+}
+
+export default {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+}
diff --git a/node_modules/table-layout/node_modules/typical/package.json b/node_modules/table-layout/node_modules/typical/package.json
new file mode 100644
index 0000000..d664f1b
--- /dev/null
+++ b/node_modules/table-layout/node_modules/typical/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "typical",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "5.2.0",
+ "description": "Isomorphic, functional type-checking for Javascript",
+ "repository": "https://github.com/75lb/typical",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "type",
+ "checking",
+ "check",
+ "value",
+ "valid",
+ "is",
+ "number",
+ "object",
+ "plainobject",
+ "array",
+ "like",
+ "defined",
+ "string",
+ "boolean",
+ "function",
+ "promise",
+ "iterable",
+ "class",
+ "primitive",
+ "isstring",
+ "isclass",
+ "isiterable",
+ "isdefined",
+ "isobject",
+ "isomorphic"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "npm run dist && npm run test:js && npm run test:esm",
+ "test:all": "npm run test:js && npm run test:esm && npm run test:web",
+ "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js",
+ "test:esm": "esm-runner test/*.mjs",
+ "test:web": "web-runner test/test.mjs",
+ "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js",
+ "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named",
+ "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo",
+ "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "devDependencies": {
+ "coveralls": "^3.0.7",
+ "esm-runner": "^0.1.5",
+ "jsdoc-to-markdown": "^5.0.2",
+ "nyc": "^14.1.1",
+ "rollup": "^1.25.1",
+ "test-object-model": "^0.4.4",
+ "test-runner": "^0.6.0"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ]
+}
diff --git a/node_modules/table-layout/package.json b/node_modules/table-layout/package.json
new file mode 100644
index 0000000..efd03e1
--- /dev/null
+++ b/node_modules/table-layout/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "table-layout",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "1.0.2",
+ "description": "Stylable text tables, handling ansi colour. Useful for console output.",
+ "repository": "https://github.com/75lb/table-layout.git",
+ "license": "MIT",
+ "keywords": [
+ "wrap",
+ "terminal",
+ "data",
+ "columns",
+ "format",
+ "json",
+ "command line"
+ ],
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "scripts": {
+ "test": "test-runner test/*.js",
+ "docs": "jsdoc2md -t README.hbs index.js -p list --member-index-format list > README.md; echo",
+ "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "dependencies": {
+ "array-back": "^4.0.1",
+ "deep-extend": "~0.6.0",
+ "typical": "^5.2.0",
+ "wordwrapjs": "^4.0.0"
+ },
+ "devDependencies": {
+ "coveralls": "^3.1.0",
+ "jsdoc-to-markdown": "^7.0.0",
+ "nyc": "^15.1.0",
+ "test-runner": "^0.6.3"
+ },
+ "files": [
+ "index.js",
+ "lib/*.js"
+ ]
+}
diff --git a/node_modules/typical/LICENSE b/node_modules/typical/LICENSE
new file mode 100644
index 0000000..700561a
--- /dev/null
+++ b/node_modules/typical/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/typical/README.hbs b/node_modules/typical/README.hbs
new file mode 100644
index 0000000..bb092a1
--- /dev/null
+++ b/node_modules/typical/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/typical/README.md b/node_modules/typical/README.md
new file mode 100644
index 0000000..cc64654
--- /dev/null
+++ b/node_modules/typical/README.md
@@ -0,0 +1,277 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_typical"></a>
+
+## typical
+For type-checking Javascript values.
+
+**Example**
+```js
+const t = require('typical')
+```
+
+* [typical](#module_typical)
+ * [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code>
+ * [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code>
+ * [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code>
+ * [.isObject(input)](#module_typical.isObject) ⇒ <code>boolean</code>
+ * [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code>
+ * [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code>
+ * [.isBoolean(input)](#module_typical.isBoolean) ⇒ <code>boolean</code>
+ * [.isFunction(input)](#module_typical.isFunction) ⇒ <code>boolean</code>
+ * [.isClass(input)](#module_typical.isClass) ⇒ <code>boolean</code>
+ * [.isPrimitive(input)](#module_typical.isPrimitive) ⇒ <code>boolean</code>
+ * [.isPromise(input)](#module_typical.isPromise) ⇒ <code>boolean</code>
+ * [.isIterable(input)](#module_typical.isIterable) ⇒ <code>boolean</code>
+
+<a name="module_typical.isNumber"></a>
+
+### t.isNumber(n) ⇒ <code>boolean</code>
+Returns true if input is a number
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| n | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isNumber(0)
+true
+> t.isNumber(1)
+true
+> t.isNumber(1.1)
+true
+> t.isNumber(0xff)
+true
+> t.isNumber(0644)
+true
+> t.isNumber(6.2e5)
+true
+> t.isNumber(NaN)
+false
+> t.isNumber(Infinity)
+false
+```
+<a name="module_typical.isPlainObject"></a>
+
+### t.isPlainObject(input) ⇒ <code>boolean</code>
+A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isPlainObject({ something: 'one' })
+true
+> t.isPlainObject(new Date())
+false
+> t.isPlainObject([ 0, 1 ])
+false
+> t.isPlainObject(/test/)
+false
+> t.isPlainObject(1)
+false
+> t.isPlainObject('one')
+false
+> t.isPlainObject(null)
+false
+> t.isPlainObject((function * () {})())
+false
+> t.isPlainObject(function * () {})
+false
+```
+<a name="module_typical.isArrayLike"></a>
+
+### t.isArrayLike(input) ⇒ <code>boolean</code>
+An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+function sum(x, y){
+ console.log(t.isArrayLike(arguments))
+ // prints `true`
+}
+```
+<a name="module_typical.isObject"></a>
+
+### t.isObject(input) ⇒ <code>boolean</code>
+returns true if the typeof input is `'object'`, but not null!
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefined"></a>
+
+### t.isDefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is defined
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isString"></a>
+
+### t.isString(input) ⇒ <code>boolean</code>
+Returns true if the input value is a string
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isBoolean"></a>
+
+### t.isBoolean(input) ⇒ <code>boolean</code>
+Returns true if the input value is a boolean
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isFunction"></a>
+
+### t.isFunction(input) ⇒ <code>boolean</code>
+Returns true if the input value is a function
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isClass"></a>
+
+### t.isClass(input) ⇒ <code>boolean</code>
+Returns true if the input value is an es2015 `class`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPrimitive"></a>
+
+### t.isPrimitive(input) ⇒ <code>boolean</code>
+Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPromise"></a>
+
+### t.isPromise(input) ⇒ <code>boolean</code>
+Returns true if the input is a Promise.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isIterable"></a>
+
+### t.isIterable(input) ⇒ <code>boolean</code>
+Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isIterable('string')
+true
+> t.isIterable(new Map())
+true
+> t.isIterable([])
+true
+> t.isIterable((function * () {})())
+true
+> t.isIterable(Promise.resolve())
+false
+> t.isIterable(Promise)
+false
+> t.isIterable(true)
+false
+> t.isIterable({})
+false
+> t.isIterable(0)
+false
+> t.isIterable(1.1)
+false
+> t.isIterable(NaN)
+false
+> t.isIterable(Infinity)
+false
+> t.isIterable(function () {})
+false
+> t.isIterable(Date)
+false
+> t.isIterable()
+false
+> t.isIterable({ then: function () {} })
+false
+```
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/typical/dist/index.js b/node_modules/typical/dist/index.js
new file mode 100644
index 0000000..8168931
--- /dev/null
+++ b/node_modules/typical/dist/index.js
@@ -0,0 +1,255 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global = global || self, global.typical = factory());
+}(this, function () { 'use strict';
+
+ /**
+ * For type-checking Javascript values.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ */
+
+ /**
+ * Returns true if input is a number
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+ function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+ }
+
+ /**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+ function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+ }
+
+ /**
+ * An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * returns true if the typeof input is `'object'`, but not null!
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ /**
+ * Returns true if the input value is defined
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefined (input) {
+ return typeof input !== 'undefined'
+ }
+
+ /**
+ * Returns true if the input value is a string
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isString (input) {
+ return typeof input === 'string'
+ }
+
+ /**
+ * Returns true if the input value is a boolean
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isBoolean (input) {
+ return typeof input === 'boolean'
+ }
+
+ /**
+ * Returns true if the input value is a function
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isFunction (input) {
+ return typeof input === 'function'
+ }
+
+ /**
+ * Returns true if the input value is an es2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isClass (input) {
+ if (isFunction(input)) {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+ function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+ }
+
+ var index = {
+ isNumber,
+ isString,
+ isBoolean,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isFunction,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable
+ };
+
+ return index;
+
+}));
diff --git a/node_modules/typical/index.mjs b/node_modules/typical/index.mjs
new file mode 100644
index 0000000..e3ef5bb
--- /dev/null
+++ b/node_modules/typical/index.mjs
@@ -0,0 +1,245 @@
+/**
+ * For type-checking Javascript values.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ */
+
+/**
+ * Returns true if input is a number
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * returns true if the typeof input is `'object'`, but not null!
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is a string
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a boolean
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isBoolean (input) {
+ return typeof input === 'boolean'
+}
+
+/**
+ * Returns true if the input value is a function
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isFunction (input) {
+ return typeof input === 'function'
+}
+
+/**
+ * Returns true if the input value is an es2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isClass (input) {
+ if (isFunction(input)) {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise
+ const isThenable = input.then && typeof input.then === 'function'
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+export default {
+ isNumber,
+ isString,
+ isBoolean,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isFunction,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable
+}
diff --git a/node_modules/typical/package.json b/node_modules/typical/package.json
new file mode 100644
index 0000000..9642da0
--- /dev/null
+++ b/node_modules/typical/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "typical",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "4.0.0",
+ "description": "Robust Javascript type-checking",
+ "repository": "https://github.com/75lb/typical",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "type",
+ "checking",
+ "check",
+ "value",
+ "valid",
+ "is",
+ "number",
+ "object",
+ "plainobject",
+ "array",
+ "like",
+ "defined",
+ "string",
+ "boolean",
+ "function",
+ "promise",
+ "iterable",
+ "class",
+ "primitive"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "npm run test:js && npm run test:esm && npm run test:web",
+ "test:js": "rollup test.mjs -f cjs -o dist/test.js && rollup test-v10.mjs -f cjs -o dist/test-v10.js && test-runner dist/test*.js",
+ "test:esm": "esm-runner test*.mjs",
+ "test:web": "web-runner test.mjs",
+ "dist": "rollup index.mjs -f umd -n typical -o dist/index.js",
+ "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo",
+ "cover": "nyc --reporter=text-lcov test-runner test.js | coveralls"
+ },
+ "devDependencies": {
+ "@test-runner/web": "^0.1.4",
+ "coveralls": "^3.0.3",
+ "esm-runner": "^0.1.2",
+ "jsdoc-to-markdown": "^4.0.1",
+ "rollup": "^1.7.0",
+ "test-object-model": "^0.3.8",
+ "test-runner": "^0.6.0-14"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ]
+}
diff --git a/node_modules/wordwrapjs/LICENSE b/node_modules/wordwrapjs/LICENSE
new file mode 100644
index 0000000..9d2d6db
--- /dev/null
+++ b/node_modules/wordwrapjs/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-21 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/wordwrapjs/README.hbs b/node_modules/wordwrapjs/README.hbs
new file mode 100644
index 0000000..29da627
--- /dev/null
+++ b/node_modules/wordwrapjs/README.hbs
@@ -0,0 +1,61 @@
+[![view on npm](https://badgen.net/npm/v/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)
+[![npm module downloads](https://badgen.net/npm/dt/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=PACKAGE)
+[![Build Status](https://travis-ci.org/75lb/wordwrapjs.svg?branch=master)](https://travis-ci.org/75lb/wordwrapjs)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+# wordwrapjs
+
+Word wrapping, with a few features.
+
+- force-break option
+- wraps hypenated words
+- multilingual - wraps any language that uses whitespace for word separation.
+
+## Synopsis
+
+Wrap some text in a 20 character column.
+
+```js
+> wordwrap = require('wordwrapjs')
+
+> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
+
+> result = wordwrap.wrap(text, { width: 20 })
+```
+
+`result` now looks like this:
+```
+Lorem ipsum dolor
+sit amet,
+consectetur
+adipiscing elit, sed
+do eiusmod tempor
+incididunt ut labore
+et dolore magna
+aliqua.
+```
+
+By default, long words will not break. Unless you set the `break` option.
+```js
+> url = 'https://github.com/75lb/wordwrapjs'
+
+> wrap.lines(url, { width: 18 })
+[ 'https://github.com/75lb/wordwrapjs' ]
+
+> wrap.lines(url, { width: 18, break: true })
+[ 'https://github.com', '/75lb/wordwrapjs' ]
+```
+
+## API Reference
+
+{{#module name="wordwrapjs"}}
+{{>body~}}
+{{>member-index~}}
+{{>members~}}
+{{/module}}
+
+* * *
+
+&copy; 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/wordwrapjs/README.md b/node_modules/wordwrapjs/README.md
new file mode 100644
index 0000000..d04692a
--- /dev/null
+++ b/node_modules/wordwrapjs/README.md
@@ -0,0 +1,115 @@
+[![view on npm](https://badgen.net/npm/v/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)
+[![npm module downloads](https://badgen.net/npm/dt/wordwrapjs)](https://www.npmjs.org/package/wordwrapjs)
+[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=REPOSITORY)
+[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/wordwrapjs)](https://github.com/75lb/wordwrapjs/network/dependents?dependent_type=PACKAGE)
+[![Build Status](https://travis-ci.org/75lb/wordwrapjs.svg?branch=master)](https://travis-ci.org/75lb/wordwrapjs)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+# wordwrapjs
+
+Word wrapping, with a few features.
+
+- force-break option
+- wraps hypenated words
+- multilingual - wraps any language that uses whitespace for word separation.
+
+## Synopsis
+
+Wrap some text in a 20 character column.
+
+```js
+> wordwrap = require('wordwrapjs')
+
+> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
+
+> result = wordwrap.wrap(text, { width: 20 })
+```
+
+`result` now looks like this:
+```
+Lorem ipsum dolor
+sit amet,
+consectetur
+adipiscing elit, sed
+do eiusmod tempor
+incididunt ut labore
+et dolore magna
+aliqua.
+```
+
+By default, long words will not break. Unless you set the `break` option.
+```js
+> url = 'https://github.com/75lb/wordwrapjs'
+
+> wrap.lines(url, { width: 18 })
+[ 'https://github.com/75lb/wordwrapjs' ]
+
+> wrap.lines(url, { width: 18, break: true })
+[ 'https://github.com', '/75lb/wordwrapjs' ]
+```
+
+## API Reference
+
+
+* [wordwrapjs](#module_wordwrapjs)
+ * [WordWrap](#exp_module_wordwrapjs--WordWrap) ⏏
+ * [.wrap(text, [options])](#module_wordwrapjs--WordWrap.wrap) ⇒ <code>string</code>
+ * [.lines(text, options)](#module_wordwrapjs--WordWrap.lines)
+ * [.isWrappable(text)](#module_wordwrapjs--WordWrap.isWrappable) ⇒ <code>boolean</code>
+ * [.getChunks(text)](#module_wordwrapjs--WordWrap.getChunks) ⇒ <code>Array.&lt;string&gt;</code>
+
+<a name="exp_module_wordwrapjs--WordWrap"></a>
+
+### WordWrap ⏏
+**Kind**: Exported class
+<a name="module_wordwrapjs--WordWrap.wrap"></a>
+
+#### WordWrap.wrap(text, [options]) ⇒ <code>string</code>
+**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| text | <code>string</code> | the input text to wrap |
+| [options] | <code>object</code> | optional configuration |
+| [options.width] | <code>number</code> | the max column width in characters (defaults to 30). |
+| [options.break] | <code>boolean</code> | if true, words exceeding the specified `width` will be forcefully broken |
+| [options.noTrim] | <code>boolean</code> | By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in. |
+
+<a name="module_wordwrapjs--WordWrap.lines"></a>
+
+#### WordWrap.lines(text, options)
+Wraps the input text, returning an array of strings (lines).
+
+**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| text | <code>string</code> | input text |
+| options | <code>object</code> | Accepts same options as constructor. |
+
+<a name="module_wordwrapjs--WordWrap.isWrappable"></a>
+
+#### WordWrap.isWrappable(text) ⇒ <code>boolean</code>
+Returns true if the input text would be wrapped if passed into `.wrap()`.
+
+**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| text | <code>string</code> | input text |
+
+<a name="module_wordwrapjs--WordWrap.getChunks"></a>
+
+#### WordWrap.getChunks(text) ⇒ <code>Array.&lt;string&gt;</code>
+Splits the input text into an array of words and whitespace.
+
+**Kind**: static method of [<code>WordWrap</code>](#exp_module_wordwrapjs--WordWrap)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| text | <code>string</code> | input text |
+
+
+* * *
+
+&copy; 2015-21 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/wordwrapjs/index.js b/node_modules/wordwrapjs/index.js
new file mode 100644
index 0000000..5ec85db
--- /dev/null
+++ b/node_modules/wordwrapjs/index.js
@@ -0,0 +1,148 @@
+const os = require('os')
+const t = require('typical')
+
+/**
+ * @module wordwrapjs
+ */
+
+const re = {
+ chunk: /[^\s-]+?-\b|\S+|\s+|\r\n?|\n/g,
+ ansiEscapeSequence: /\u001b.*?m/g
+}
+
+/**
+ * @alias module:wordwrapjs
+ * @typicalname wordwrap
+ */
+class WordWrap {
+ constructor (text, options) {
+ options = options || {}
+ if (!t.isDefined(text)) text = ''
+
+ this._lines = String(text).split(/\r\n|\n/g)
+ this.options = options
+ this.options.width = options.width === undefined ? 30 : options.width
+ }
+
+ lines () {
+ const flatten = require('reduce-flatten')
+
+ /* trim each line of the supplied text */
+ return this._lines.map(trimLine.bind(this))
+
+ /* split each line into an array of chunks, else mark it empty */
+ .map(line => line.match(re.chunk) || [ '~~empty~~' ])
+
+ /* optionally, break each word on the line into pieces */
+ .map(lineWords => {
+ if (this.options.break) {
+ return lineWords.map(breakWord.bind(this))
+ } else {
+ return lineWords
+ }
+ })
+ .map(lineWords => lineWords.reduce(flatten, []))
+
+ /* transforming the line of words to one or more new lines wrapped to size */
+ .map(lineWords => {
+ return lineWords
+ .reduce((lines, word) => {
+ let currentLine = lines[lines.length - 1]
+ if (replaceAnsi(word).length + replaceAnsi(currentLine).length > this.options.width) {
+ lines.push(word)
+ } else {
+ lines[lines.length - 1] += word
+ }
+ return lines
+ }, [ '' ])
+ })
+ .reduce(flatten, [])
+
+ /* trim the wrapped lines */
+ .map(trimLine.bind(this))
+
+ /* filter out empty lines */
+ .filter(line => line.trim())
+
+ /* restore the user's original empty lines */
+ .map(line => line.replace('~~empty~~', ''))
+ }
+
+ wrap () {
+ return this.lines().join(os.EOL)
+ }
+
+ toString () {
+ return this.wrap()
+ }
+
+ /**
+ * @param {string} - the input text to wrap
+ * @param [options] {object} - optional configuration
+ * @param [options.width] {number} - the max column width in characters (defaults to 30).
+ * @param [options.break] {boolean} - if true, words exceeding the specified `width` will be forcefully broken
+ * @param [options.noTrim] {boolean} - By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in.
+ * @return {string}
+ */
+ static wrap (text, options) {
+ const block = new this(text, options)
+ return block.wrap()
+ }
+
+ /**
+ * Wraps the input text, returning an array of strings (lines).
+ * @param {string} - input text
+ * @param {object} - Accepts same options as constructor.
+ */
+ static lines (text, options) {
+ const block = new this(text, options)
+ return block.lines()
+ }
+
+ /**
+ * Returns true if the input text would be wrapped if passed into `.wrap()`.
+ * @param {string} - input text
+ * @return {boolean}
+ */
+ static isWrappable (text) {
+ if (t.isDefined(text)) {
+ text = String(text)
+ var matches = text.match(re.chunk)
+ return matches ? matches.length > 1 : false
+ }
+ }
+
+ /**
+ * Splits the input text into an array of words and whitespace.
+ * @param {string} - input text
+ * @returns {string[]}
+ */
+ static getChunks (text) {
+ return text.match(re.chunk) || []
+ }
+}
+
+function trimLine (line) {
+ return this.options.noTrim ? line : line.trim()
+}
+
+function replaceAnsi (string) {
+ return string.replace(re.ansiEscapeSequence, '')
+}
+
+/* break a word into several pieces */
+function breakWord (word) {
+ if (replaceAnsi(word).length > this.options.width) {
+ const letters = word.split('')
+ let piece
+ const pieces = []
+ while ((piece = letters.splice(0, this.options.width)).length) {
+ pieces.push(piece.join(''))
+ }
+ return pieces
+ } else {
+ return word
+ }
+}
+
+module.exports = WordWrap
diff --git a/node_modules/wordwrapjs/node_modules/typical/LICENSE b/node_modules/wordwrapjs/node_modules/typical/LICENSE
new file mode 100644
index 0000000..700561a
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/wordwrapjs/node_modules/typical/README.hbs b/node_modules/wordwrapjs/node_modules/typical/README.hbs
new file mode 100644
index 0000000..bb092a1
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/README.hbs
@@ -0,0 +1,40 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+{{>main}}
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/wordwrapjs/node_modules/typical/README.md b/node_modules/wordwrapjs/node_modules/typical/README.md
new file mode 100644
index 0000000..6e3d513
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/README.md
@@ -0,0 +1,302 @@
+[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
+[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
+[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
+[![Coverage Status](https://coveralls.io/repos/github/75lb/typical/badge.svg?branch=master)](https://coveralls.io/github/75lb/typical?branch=master)
+[![Dependency Status](https://badgen.net/david/dep/75lb/typical)](https://david-dm.org/75lb/typical)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
+
+<a name="module_typical"></a>
+
+## typical
+Isomorphic, functional type-checking for Javascript.
+
+**Example**
+```js
+const t = require('typical')
+const allDefined = array.every(t.isDefined)
+```
+
+* [typical](#module_typical)
+ * [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code>
+ * [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code>
+ * [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code>
+ * [.isObject(input)](#module_typical.isObject) ⇒ <code>boolean</code>
+ * [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code>
+ * [.isUndefined(input)](#module_typical.isUndefined) ⇒ <code>boolean</code>
+ * [.isNull(input)](#module_typical.isNull) ⇒ <code>boolean</code>
+ * [.isDefinedValue(input)](#module_typical.isDefinedValue) ⇒ <code>boolean</code>
+ * [.isClass(input)](#module_typical.isClass) ⇒ <code>boolean</code>
+ * [.isPrimitive(input)](#module_typical.isPrimitive) ⇒ <code>boolean</code>
+ * [.isPromise(input)](#module_typical.isPromise) ⇒ <code>boolean</code>
+ * [.isIterable(input)](#module_typical.isIterable) ⇒ <code>boolean</code>
+ * [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code>
+ * [.isFunction(input)](#module_typical.isFunction) ⇒ <code>boolean</code>
+
+<a name="module_typical.isNumber"></a>
+
+### t.isNumber(n) ⇒ <code>boolean</code>
+Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| n | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isNumber(0)
+true
+> t.isNumber(1)
+true
+> t.isNumber(1.1)
+true
+> t.isNumber(0xff)
+true
+> t.isNumber(0644)
+true
+> t.isNumber(6.2e5)
+true
+> t.isNumber(NaN)
+false
+> t.isNumber(Infinity)
+false
+```
+<a name="module_typical.isPlainObject"></a>
+
+### t.isPlainObject(input) ⇒ <code>boolean</code>
+A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isPlainObject({ something: 'one' })
+true
+> t.isPlainObject(new Date())
+false
+> t.isPlainObject([ 0, 1 ])
+false
+> t.isPlainObject(/test/)
+false
+> t.isPlainObject(1)
+false
+> t.isPlainObject('one')
+false
+> t.isPlainObject(null)
+false
+> t.isPlainObject((function * () {})())
+false
+> t.isPlainObject(function * () {})
+false
+```
+<a name="module_typical.isArrayLike"></a>
+
+### t.isArrayLike(input) ⇒ <code>boolean</code>
+An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+function sum(x, y){
+ console.log(t.isArrayLike(arguments))
+ // prints `true`
+}
+```
+<a name="module_typical.isObject"></a>
+
+### t.isObject(input) ⇒ <code>boolean</code>
+Returns true if the typeof input is `'object'` but not null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefined"></a>
+
+### t.isDefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is defined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isUndefined"></a>
+
+### t.isUndefined(input) ⇒ <code>boolean</code>
+Returns true if the input value is undefined.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isNull"></a>
+
+### t.isNull(input) ⇒ <code>boolean</code>
+Returns true if the input value is null.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isDefinedValue"></a>
+
+### t.isDefinedValue(input) ⇒ <code>boolean</code>
+Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isClass"></a>
+
+### t.isClass(input) ⇒ <code>boolean</code>
+Returns true if the input value is an ES2015 `class`.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPrimitive"></a>
+
+### t.isPrimitive(input) ⇒ <code>boolean</code>
+Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isPromise"></a>
+
+### t.isPromise(input) ⇒ <code>boolean</code>
+Returns true if the input is a Promise.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isIterable"></a>
+
+### t.isIterable(input) ⇒ <code>boolean</code>
+Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+**Example**
+```js
+> t.isIterable('string')
+true
+> t.isIterable(new Map())
+true
+> t.isIterable([])
+true
+> t.isIterable((function * () {})())
+true
+> t.isIterable(Promise.resolve())
+false
+> t.isIterable(Promise)
+false
+> t.isIterable(true)
+false
+> t.isIterable({})
+false
+> t.isIterable(0)
+false
+> t.isIterable(1.1)
+false
+> t.isIterable(NaN)
+false
+> t.isIterable(Infinity)
+false
+> t.isIterable(function () {})
+false
+> t.isIterable(Date)
+false
+> t.isIterable()
+false
+> t.isIterable({ then: function () {} })
+false
+```
+<a name="module_typical.isString"></a>
+
+### t.isString(input) ⇒ <code>boolean</code>
+Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+<a name="module_typical.isFunction"></a>
+
+### t.isFunction(input) ⇒ <code>boolean</code>
+Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+
+**Kind**: static method of [<code>typical</code>](#module_typical)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| input | <code>\*</code> | the input to test |
+
+
+## Load anywhere
+
+This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.
+
+Node.js:
+
+```js
+const typical = require('typical')
+```
+
+Within Node.js with ECMAScript Module support enabled:
+
+```js
+import typical from 'typical'
+```
+
+Within a modern browser ECMAScript Module:
+
+```js
+import typical from './node_modules/typical/index.mjs'
+```
+
+Old browser (adds `window.typical`):
+
+```html
+<script nomodule src="./node_modules/typical/dist/index.js"></script>
+```
+
+* * *
+
+&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
diff --git a/node_modules/wordwrapjs/node_modules/typical/dist/index.js b/node_modules/wordwrapjs/node_modules/typical/dist/index.js
new file mode 100644
index 0000000..ed8b168
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/dist/index.js
@@ -0,0 +1,295 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (global = global || self, factory(global.typical = {}));
+}(this, function (exports) { 'use strict';
+
+ /**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+ /**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+ function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+ }
+
+ /**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+ function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+ }
+
+ /**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+ function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+ }
+
+ /**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isObject (input) {
+ return typeof input === 'object' && input !== null
+ }
+
+ /**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefined (input) {
+ return typeof input !== 'undefined'
+ }
+
+ /**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isUndefined (input) {
+ return !isDefined(input)
+ }
+
+ /**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isNull (input) {
+ return input === null
+ }
+
+ /**
+ * Returns true if the input value is both defined and not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+ }
+
+ /**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise;
+ const isThenable = input.then && typeof input.then === 'function';
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+ function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+ }
+
+ /**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isString (input) {
+ return typeof input === 'string'
+ }
+
+ /**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+ function isFunction (input) {
+ return typeof input === 'function'
+ }
+
+ var index = {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+ };
+
+ exports.default = index;
+ exports.isArrayLike = isArrayLike;
+ exports.isClass = isClass;
+ exports.isDefined = isDefined;
+ exports.isDefinedValue = isDefinedValue;
+ exports.isFunction = isFunction;
+ exports.isIterable = isIterable;
+ exports.isNull = isNull;
+ exports.isNumber = isNumber;
+ exports.isObject = isObject;
+ exports.isPlainObject = isPlainObject;
+ exports.isPrimitive = isPrimitive;
+ exports.isPromise = isPromise;
+ exports.isString = isString;
+ exports.isUndefined = isUndefined;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+}));
diff --git a/node_modules/wordwrapjs/node_modules/typical/index.mjs b/node_modules/wordwrapjs/node_modules/typical/index.mjs
new file mode 100644
index 0000000..d3468a9
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/index.mjs
@@ -0,0 +1,269 @@
+/**
+ * Isomorphic, functional type-checking for Javascript.
+ * @module typical
+ * @typicalname t
+ * @example
+ * const t = require('typical')
+ * const allDefined = array.every(t.isDefined)
+ */
+
+/**
+ * Returns true if input is a number. It is a more reasonable alternative to `typeof n` which returns `number` for `NaN` and `Infinity`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isNumber(0)
+ * true
+ * > t.isNumber(1)
+ * true
+ * > t.isNumber(1.1)
+ * true
+ * > t.isNumber(0xff)
+ * true
+ * > t.isNumber(0644)
+ * true
+ * > t.isNumber(6.2e5)
+ * true
+ * > t.isNumber(NaN)
+ * false
+ * > t.isNumber(Infinity)
+ * false
+ */
+export function isNumber (n) {
+ return !isNaN(parseFloat(n)) && isFinite(n)
+}
+
+/**
+ * A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isPlainObject({ something: 'one' })
+ * true
+ * > t.isPlainObject(new Date())
+ * false
+ * > t.isPlainObject([ 0, 1 ])
+ * false
+ * > t.isPlainObject(/test/)
+ * false
+ * > t.isPlainObject(1)
+ * false
+ * > t.isPlainObject('one')
+ * false
+ * > t.isPlainObject(null)
+ * false
+ * > t.isPlainObject((function * () {})())
+ * false
+ * > t.isPlainObject(function * () {})
+ * false
+ */
+export function isPlainObject (input) {
+ return input !== null && typeof input === 'object' && input.constructor === Object
+}
+
+/**
+ * An array-like value has all the properties of an array yet is not an array instance. An example is the `arguments` object. Returns `true`` if the input value is an object, not `null`` and has a `length` property set with a numeric value.
+ *
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * function sum(x, y){
+ * console.log(t.isArrayLike(arguments))
+ * // prints `true`
+ * }
+ */
+export function isArrayLike (input) {
+ return isObject(input) && typeof input.length === 'number'
+}
+
+/**
+ * Returns true if the typeof input is `'object'` but not null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isObject (input) {
+ return typeof input === 'object' && input !== null
+}
+
+/**
+ * Returns true if the input value is defined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefined (input) {
+ return typeof input !== 'undefined'
+}
+
+/**
+ * Returns true if the input value is undefined.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isUndefined (input) {
+ return !isDefined(input)
+}
+
+/**
+ * Returns true if the input value is null.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isNull (input) {
+ return input === null
+}
+
+/**
+ * Returns true if the input value is not one of `undefined`, `null`, or `NaN`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isDefinedValue (input) {
+ return isDefined(input) && !isNull(input) && !Number.isNaN(input)
+}
+
+/**
+ * Returns true if the input value is an ES2015 `class`.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isClass (input) {
+ if (typeof input === 'function') {
+ return /^class /.test(Function.prototype.toString.call(input))
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a string, number, symbol, boolean, null or undefined value.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPrimitive (input) {
+ if (input === null) return true
+ switch (typeof input) {
+ case 'string':
+ case 'number':
+ case 'symbol':
+ case 'undefined':
+ case 'boolean':
+ return true
+ default:
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is a Promise.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isPromise (input) {
+ if (input) {
+ const isPromise = isDefined(Promise) && input instanceof Promise
+ const isThenable = input.then && typeof input.then === 'function'
+ return !!(isPromise || isThenable)
+ } else {
+ return false
+ }
+}
+
+/**
+ * Returns true if the input is an iterable (`Map`, `Set`, `Array`, Generator etc.).
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ * @example
+ * > t.isIterable('string')
+ * true
+ * > t.isIterable(new Map())
+ * true
+ * > t.isIterable([])
+ * true
+ * > t.isIterable((function * () {})())
+ * true
+ * > t.isIterable(Promise.resolve())
+ * false
+ * > t.isIterable(Promise)
+ * false
+ * > t.isIterable(true)
+ * false
+ * > t.isIterable({})
+ * false
+ * > t.isIterable(0)
+ * false
+ * > t.isIterable(1.1)
+ * false
+ * > t.isIterable(NaN)
+ * false
+ * > t.isIterable(Infinity)
+ * false
+ * > t.isIterable(function () {})
+ * false
+ * > t.isIterable(Date)
+ * false
+ * > t.isIterable()
+ * false
+ * > t.isIterable({ then: function () {} })
+ * false
+ */
+export function isIterable (input) {
+ if (input === null || !isDefined(input)) {
+ return false
+ } else {
+ return (
+ typeof input[Symbol.iterator] === 'function' ||
+ typeof input[Symbol.asyncIterator] === 'function'
+ )
+ }
+}
+
+/**
+ * Returns true if the input value is a string. The equivalent of `typeof input === 'string'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isString (input) {
+ return typeof input === 'string'
+}
+
+/**
+ * Returns true if the input value is a function. The equivalent of `typeof input === 'function'` for use in funcitonal contexts.
+ * @param {*} - the input to test
+ * @returns {boolean}
+ * @static
+ */
+export function isFunction (input) {
+ return typeof input === 'function'
+}
+
+export default {
+ isNumber,
+ isPlainObject,
+ isArrayLike,
+ isObject,
+ isDefined,
+ isUndefined,
+ isNull,
+ isDefinedValue,
+ isClass,
+ isPrimitive,
+ isPromise,
+ isIterable,
+ isString,
+ isFunction
+}
diff --git a/node_modules/wordwrapjs/node_modules/typical/package.json b/node_modules/wordwrapjs/node_modules/typical/package.json
new file mode 100644
index 0000000..d664f1b
--- /dev/null
+++ b/node_modules/wordwrapjs/node_modules/typical/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "typical",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "5.2.0",
+ "description": "Isomorphic, functional type-checking for Javascript",
+ "repository": "https://github.com/75lb/typical",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "keywords": [
+ "type",
+ "checking",
+ "check",
+ "value",
+ "valid",
+ "is",
+ "number",
+ "object",
+ "plainobject",
+ "array",
+ "like",
+ "defined",
+ "string",
+ "boolean",
+ "function",
+ "promise",
+ "iterable",
+ "class",
+ "primitive",
+ "isstring",
+ "isclass",
+ "isiterable",
+ "isdefined",
+ "isobject",
+ "isomorphic"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "npm run dist && npm run test:js && npm run test:esm",
+ "test:all": "npm run test:js && npm run test:esm && npm run test:web",
+ "test:js": "rollup test/*.mjs -f cjs -d tmp/test -e assert && test-runner tmp/test/test*.js",
+ "test:esm": "esm-runner test/*.mjs",
+ "test:web": "web-runner test/test.mjs",
+ "test:v8": "rollup test/test.mjs test/test-default.mjs -f cjs -d tmp/testv8 && test-runner tmp/testv8/test*.js",
+ "dist": "rollup index.mjs -f umd -n typical -o dist/index.js --exports named",
+ "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md; echo",
+ "cover": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "devDependencies": {
+ "coveralls": "^3.0.7",
+ "esm-runner": "^0.1.5",
+ "jsdoc-to-markdown": "^5.0.2",
+ "nyc": "^14.1.1",
+ "rollup": "^1.25.1",
+ "test-object-model": "^0.4.4",
+ "test-runner": "^0.6.0"
+ },
+ "files": [
+ "index.mjs",
+ "dist/index.js"
+ ]
+}
diff --git a/node_modules/wordwrapjs/package.json b/node_modules/wordwrapjs/package.json
new file mode 100644
index 0000000..e44a96d
--- /dev/null
+++ b/node_modules/wordwrapjs/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "wordwrapjs",
+ "author": "Lloyd Brookes <75pound@gmail.com>",
+ "version": "4.0.1",
+ "description": "Word-wrapping for javascript.",
+ "repository": "https://github.com/75lb/wordwrapjs.git",
+ "license": "MIT",
+ "keywords": [
+ "word",
+ "line",
+ "wrap",
+ "text",
+ "columns",
+ "wordwrap"
+ ],
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "scripts": {
+ "test": "test-runner test.js",
+ "docs": "jsdoc2md -t README.hbs index.js > README.md; echo"
+ },
+ "devDependencies": {
+ "jsdoc-to-markdown": "^7.0.0",
+ "test-runner": "~0.6.3"
+ },
+ "dependencies": {
+ "reduce-flatten": "^2.0.0",
+ "typical": "^5.2.0"
+ },
+ "files": [
+ "index.js"
+ ]
+}
diff --git a/package-lock.json b/package-lock.json
index 54d7fce..aff89cb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,7 +5,9 @@
"packages": {
"": {
"dependencies": {
- "electron": "^25.1.1"
+ "electron": "^25.1.1",
+ "node-wifi": "^2.0.16",
+ "systeminformation": "^5.18.3"
}
},
"node_modules/@electron/get": {
@@ -96,6 +98,25 @@
"@types/node": "*"
}
},
+ "node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/array-back": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz",
+ "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/boolean": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
@@ -135,6 +156,27 @@
"node": ">=8"
}
},
+ "node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/chalk/node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
"node_modules/clone-response": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",
@@ -146,6 +188,63 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
+ },
+ "node_modules/command-line-args": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz",
+ "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==",
+ "dependencies": {
+ "array-back": "^3.1.0",
+ "find-replace": "^3.0.0",
+ "lodash.camelcase": "^4.3.0",
+ "typical": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/command-line-usage": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz",
+ "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==",
+ "dependencies": {
+ "array-back": "^4.0.2",
+ "chalk": "^2.4.2",
+ "table-layout": "^1.0.2",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -187,6 +286,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/defer-to-connect": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
@@ -295,6 +402,17 @@
"pend": "~1.2.0"
}
},
+ "node_modules/find-replace": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
+ "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==",
+ "dependencies": {
+ "array-back": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
"node_modules/fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -431,6 +549,14 @@
"node": ">= 0.4.0"
}
},
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/has-property-descriptors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
@@ -511,6 +637,11 @@
"json-buffer": "3.0.1"
}
},
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
+ },
"node_modules/lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
@@ -556,6 +687,21 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
+ "node_modules/node-wifi": {
+ "version": "2.0.16",
+ "resolved": "https://registry.npmjs.org/node-wifi/-/node-wifi-2.0.16.tgz",
+ "integrity": "sha512-WOgs7kqTvijHij1GLMVW/ReIZHEtcvJuZSMDExEDhBhLquQJPUbBOIsQxavnhJJ06MQnGXnW1qJKe9ADibOTIA==",
+ "dependencies": {
+ "command-line-args": "^5.2.0",
+ "command-line-usage": "^6.1.1"
+ },
+ "bin": {
+ "wifi": "bin/wifi.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/normalize-url": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz",
@@ -625,6 +771,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/reduce-flatten": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz",
+ "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/resolve-alpn": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",
@@ -704,6 +858,72 @@
"node": ">= 8.0"
}
},
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/systeminformation": {
+ "version": "5.18.3",
+ "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.18.3.tgz",
+ "integrity": "sha512-k+gk7zSi0hI/m3Mgu1OzR8j9BfXMDYa2HUMBdEQZUVCVAO326kDrzrvtVMljiSoDs6T6ojI0AHneDn8AMa0Y6A==",
+ "os": [
+ "darwin",
+ "linux",
+ "win32",
+ "freebsd",
+ "openbsd",
+ "netbsd",
+ "sunos",
+ "android"
+ ],
+ "bin": {
+ "systeminformation": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "funding": {
+ "type": "Buy me a coffee",
+ "url": "https://www.buymeacoffee.com/systeminfo"
+ }
+ },
+ "node_modules/table-layout": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz",
+ "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==",
+ "dependencies": {
+ "array-back": "^4.0.1",
+ "deep-extend": "~0.6.0",
+ "typical": "^5.2.0",
+ "wordwrapjs": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/table-layout/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/table-layout/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/type-fest": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
@@ -716,6 +936,14 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/typical": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz",
+ "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
@@ -724,6 +952,26 @@
"node": ">= 4.0.0"
}
},
+ "node_modules/wordwrapjs": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz",
+ "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==",
+ "dependencies": {
+ "reduce-flatten": "^2.0.0",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/wordwrapjs/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
diff --git a/package.json b/package.json
index 4fa3491..bc5ca27 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,7 @@
{
"dependencies": {
- "electron": "^25.1.1"
+ "electron": "^25.1.1",
+ "node-wifi": "^2.0.16",
+ "systeminformation": "^5.18.3"
}
}
diff --git a/setup.sh b/setup.sh
index 3d2dfbb..9e0434f 100644
--- a/setup.sh
+++ b/setup.sh
@@ -1,6 +1,6 @@
#!/bin/bash
cd /mango
-apt install -y network-manager xserver-xorg x11-xserver-utils xinit libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgtk-3-0 libasound2 fonts-inter ecryptfs-utils nodejs xxd pulseaudio alsa-utils
+apt install -y network-manager xserver-xorg x11-xserver-utils xinit libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgtk-3-0 libasound2 fonts-inter ecryptfs-utils nodejs xxd pulseaudio alsa-utils openbox fonts-roboto
apt autoremove -y
chmod -R +x *
cp ./setup/modm\@.service /etc/systemd/system/modm\@.service
@@ -25,6 +25,9 @@ systemctl disable NetworkManager.service
systemctl disable wpa_supplicant.service
systemctl disable polkit.service
+mkdir -p /root/.config/openbox
+cp -f ./setup/rc.xml /root/.config/openbox
+
if [ -d "/mango/users/0" ]; then
echo "Users already setup"
else
diff --git a/setup/Xresources b/setup/Xresources
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/Xresources
diff --git a/setup/modm@tty1.service b/setup/modm@tty1.service
new file mode 100644
index 0000000..1b5c916
--- /dev/null
+++ b/setup/modm@tty1.service
@@ -0,0 +1,30 @@
+[Unit]
+Description=mangoOS Display Manager (%I)
+After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
+After=rc-local.service
+Before=getty.target
+IgnoreOnIsolate=yes
+Conflicts=getty@%I.service
+Conflicts=rescue.service
+Before=rescue.service
+ConditionPathExists=/dev/tty0
+
+[Service]
+ExecStart=/mango/x11.sh
+Type=idle
+Restart=always
+RestartSec=0
+UtmpIdentifier=%I
+StandardInput=tty
+StandardOutput=tty
+TTYPath=/dev/%I
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+IgnoreSIGPIPE=no
+SendSIGHUP=yes
+UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
+
+[Install]
+WantedBy=getty.target
+DefaultInstance=tty1 \ No newline at end of file
diff --git a/setup/rc.xml b/setup/rc.xml
new file mode 100644
index 0000000..53987e5
--- /dev/null
+++ b/setup/rc.xml
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<openbox_config xmlns="http://openbox.org/3.4/rc"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <keyboard>
+ <chainQuitKey />
+ <keybind key="A-Tab">
+ <action name="NextWindow">
+ <finalactions>
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </finalactions>
+ </action>
+ </keybind>
+ </keyboard>
+
+ <mouse>
+ <dragThreshold>1</dragThreshold>
+ <doubleClickTime>500</doubleClickTime>
+ <screenEdgeWarpTime>400</screenEdgeWarpTime>
+ <screenEdgeWarpMouse>false</screenEdgeWarpMouse>
+
+ <context name="Titlebar">
+ <mousebind button="Left" action="Drag">
+ <action name="Move"/>
+ </mousebind>
+ <mousebind button="Left" action="DoubleClick">
+ <action name="ToggleMaximize"/>
+ </mousebind>
+
+ <mousebind button="Up" action="Click">
+ <action name="if">
+ <shaded>no</shaded>
+ <then>
+ <action name="Shade"/>
+ <action name="FocusToBottom"/>
+ <action name="Unfocus"/>
+ <action name="Lower"/>
+ </then>
+ </action>
+ </mousebind>
+ <mousebind button="Down" action="Click">
+ <action name="if">
+ <shaded>yes</shaded>
+ <then>
+ <action name="Unshade"/>
+ <action name="Raise"/>
+ </then>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Titlebar Top Right Bottom Left TLCorner TRCorner BRCorner BLCorner">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+
+ <mousebind button="Middle" action="Press">
+ <action name="Lower"/>
+ <action name="FocusToBottom"/>
+ <action name="Unfocus"/>
+ </mousebind>
+
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="ShowMenu">
+ <menu>client-menu</menu>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Top">
+ <mousebind button="Left" action="Drag">
+ <action name="Resize">
+ <edge>top</edge>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Left">
+ <mousebind button="Left" action="Drag">
+ <action name="Resize">
+ <edge>left</edge>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Right">
+ <mousebind button="Left" action="Drag">
+ <action name="Resize">
+ <edge>right</edge>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Bottom">
+ <mousebind button="Left" action="Drag">
+ <action name="Resize">
+ <edge>bottom</edge>
+ </action>
+ </mousebind>
+
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="ShowMenu">
+ <menu>client-menu</menu>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="TRCorner BRCorner TLCorner BLCorner">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Left" action="Drag">
+ <action name="Resize"/>
+ </mousebind>
+ </context>
+
+ <context name="Client">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ <mousebind button="Middle" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ </context>
+
+ <context name="Icon">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ <action name="ShowMenu">
+ <menu>client-menu</menu>
+ </action>
+ </mousebind>
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="ShowMenu">
+ <menu>client-menu</menu>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="AllDesktops">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Left" action="Click">
+ <action name="ToggleOmnipresent"/>
+ </mousebind>
+ </context>
+
+ <context name="Shade">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ <mousebind button="Left" action="Click">
+ <action name="ToggleShade"/>
+ </mousebind>
+ </context>
+
+ <context name="Iconify">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ <mousebind button="Left" action="Click">
+ <action name="Iconify"/>
+ </mousebind>
+ </context>
+
+ <context name="Maximize">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Middle" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Left" action="Click">
+ <action name="ToggleMaximize"/>
+ </mousebind>
+ <mousebind button="Middle" action="Click">
+ <action name="ToggleMaximize">
+ <direction>vertical</direction>
+ </action>
+ </mousebind>
+ <mousebind button="Right" action="Click">
+ <action name="ToggleMaximize">
+ <direction>horizontal</direction>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="Close">
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ <action name="Unshade"/>
+ </mousebind>
+ <mousebind button="Left" action="Click">
+ <action name="Close"/>
+ </mousebind>
+ </context>
+
+ <context name="Desktop">
+ <mousebind button="Up" action="Click">
+ <action name="GoToDesktop">
+ <to>previous</to>
+ </action>
+ </mousebind>
+ <mousebind button="Down" action="Click">
+ <action name="GoToDesktop">
+ <to>next</to>
+ </action>
+ </mousebind>
+
+ <mousebind button="Left" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ <mousebind button="Right" action="Press">
+ <action name="Focus"/>
+ <action name="Raise"/>
+ </mousebind>
+ </context>
+
+ <context name="Root">
+ <!-- Menus -->
+ <mousebind button="Middle" action="Press">
+ <action name="ShowMenu">
+ <menu>client-list-combined-menu</menu>
+ </action>
+ </mousebind>
+ <mousebind button="Right" action="Press">
+ <action name="ShowMenu">
+ <menu>root-menu</menu>
+ </action>
+ </mousebind>
+ </context>
+
+ <context name="MoveResize">
+ <mousebind button="Up" action="Click">
+ <action name="GoToDesktop">
+ <to>previous</to>
+ </action>
+ </mousebind>
+ <mousebind button="Down" action="Click">
+ <action name="GoToDesktop">
+ <to>next</to>
+ </action>
+ </mousebind>
+ </context>
+ </mouse>
+
+</openbox_config>