systeminformation 6.0.0-beta.24 → 6.0.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +57 -6
  2. package/dist/bsd/index.d.ts +3 -0
  3. package/dist/bsd/index.js +7 -1
  4. package/dist/common/darwin.d.ts +1 -0
  5. package/dist/common/darwin.js +15 -3
  6. package/dist/common/defaults.js +15 -4
  7. package/dist/common/disk-speed.d.ts +20 -0
  8. package/dist/common/disk-speed.js +142 -0
  9. package/dist/common/filesys.d.ts +1 -1
  10. package/dist/common/filesys.js +24 -4
  11. package/dist/common/mappings.d.ts +1 -1
  12. package/dist/common/mappings.js +14 -4
  13. package/dist/common/types.d.ts +41 -0
  14. package/dist/common/windows.d.ts +1 -0
  15. package/dist/common/windows.js +19 -5
  16. package/dist/cpu-current-load.js +45 -0
  17. package/dist/cpu-current-speed.js +6 -0
  18. package/dist/darwin/bluetooth.d.ts +1 -1
  19. package/dist/darwin/bluetooth.js +2 -2
  20. package/dist/darwin/cpu-current-speed.d.ts +2 -0
  21. package/dist/darwin/cpu-current-speed.js +30 -0
  22. package/dist/darwin/cpu-temperature.js +7 -13
  23. package/dist/darwin/disk-speed.d.ts +2 -0
  24. package/dist/darwin/disk-speed.js +18 -0
  25. package/dist/darwin/disks-io.js +3 -1
  26. package/dist/darwin/fans.js +11 -13
  27. package/dist/darwin/gpu.d.ts +1 -1
  28. package/dist/darwin/gpu.js +4 -4
  29. package/dist/darwin/index.d.ts +3 -0
  30. package/dist/darwin/index.js +8 -2
  31. package/dist/darwin/network-interfaces.js +14 -4
  32. package/dist/darwin/network-routes.d.ts +3 -0
  33. package/dist/darwin/network-routes.js +74 -0
  34. package/dist/darwin/wifi-connections.js +3 -2
  35. package/dist/disk-speed.d.ts +1 -0
  36. package/dist/disk-speed.js +17 -0
  37. package/dist/get.js +5 -5
  38. package/dist/index.d.ts +12 -8
  39. package/dist/index.js +30 -21
  40. package/dist/inet-speed.d.ts +11 -0
  41. package/dist/inet-speed.js +152 -0
  42. package/dist/linux/block-devices.d.ts +1 -1
  43. package/dist/linux/block-devices.js +21 -5
  44. package/dist/linux/cpu-topology.d.ts +2 -0
  45. package/dist/linux/cpu-topology.js +15 -0
  46. package/dist/linux/disk-speed.d.ts +2 -0
  47. package/dist/linux/disk-speed.js +16 -0
  48. package/dist/linux/disks-io.d.ts +1 -1
  49. package/dist/linux/disks-io.js +18 -7
  50. package/dist/linux/index.d.ts +3 -0
  51. package/dist/linux/index.js +8 -2
  52. package/dist/linux/mem.js +20 -1
  53. package/dist/linux/network-interfaces.js +18 -7
  54. package/dist/linux/network-routes.d.ts +4 -0
  55. package/dist/linux/network-routes.js +69 -0
  56. package/dist/linux/os-info.js +32 -4
  57. package/dist/linux/pci.d.ts +1 -1
  58. package/dist/linux/pci.js +4 -3
  59. package/dist/linux/wifi-connections.d.ts +4 -0
  60. package/dist/linux/wifi-connections.js +20 -2
  61. package/dist/network-routes.d.ts +1 -0
  62. package/dist/network-routes.js +17 -0
  63. package/dist/powershell.d.ts +2 -0
  64. package/dist/powershell.js +15 -0
  65. package/dist/sun/index.d.ts +1 -0
  66. package/dist/sun/index.js +3 -1
  67. package/dist/windows/block-devices.js +6 -1
  68. package/dist/windows/cpu-topology.d.ts +3 -0
  69. package/dist/windows/cpu-topology.js +90 -0
  70. package/dist/windows/disk-speed.d.ts +6 -0
  71. package/dist/windows/disk-speed.js +73 -0
  72. package/dist/windows/disks-io.js +3 -1
  73. package/dist/windows/index.d.ts +3 -0
  74. package/dist/windows/index.js +8 -2
  75. package/dist/windows/network-interfaces.js +6 -3
  76. package/dist/windows/network-routes.d.ts +3 -0
  77. package/dist/windows/network-routes.js +41 -0
  78. package/dist/windows/wifi-connections.d.ts +1 -0
  79. package/dist/windows/wifi-connections.js +10 -3
  80. package/package.json +1 -1
package/README.md CHANGED
@@ -51,6 +51,9 @@ in a browser.
51
51
  - `npm()` - globally installed npm packages
52
52
  - `fans()` - detected fans with rpm and pwm
53
53
  - `serialPorts()` - detected serial / COM ports
54
+ - `networkRoutes()` - network routing table
55
+ - `diskSpeed()` - disk speed test (sequential write / read throughput)
56
+ - `inetSpeed()` - internet speed test (download / upload throughput)
54
57
 
55
58
  ### Extended Windows support
56
59
 
@@ -72,6 +75,10 @@ imported individually - see [Installation](#installation) and [Usage](#usage).
72
75
  - **Minimum Node.js version is now 20.0** (older releases are no longer supported).
73
76
  - **Import paths.** With the new `exports` map only the documented entry points are
74
77
  importable (deep `dist/...` paths are no longer part of the public API).
78
+ - **`osInfo().distro` reports flavors and derivatives** (e.g. `Kubuntu` instead of
79
+ `Ubuntu`, `Raspberry Pi OS` instead of `Debian GNU/Linux`) - adapt checks on the distro name.
80
+ - **macOS (Apple Silicon): `macos-smc` replaces `macos-temperature-sensor`** as optional
81
+ package for temperatures, fans and the current CPU frequency - see [Known Issues](#known-issues).
75
82
 
76
83
  ## Quick Start
77
84
 
@@ -165,7 +172,7 @@ implementations can be tree-shaken away.
165
172
 
166
173
  - complete rewrite in TypeScript with typed declarations for every function
167
174
  - modular imports: load the whole library, a single operating system, or a single function
168
- - new functions: `camera()`, `keyboard()`, `mouse()`, `thunderbolt()`, `pci()`, `npu()`, `software()`, `npm()`, `fans()`, `serialPorts()`
175
+ - new functions: `camera()`, `keyboard()`, `mouse()`, `thunderbolt()`, `pci()`, `npu()`, `software()`, `npm()`, `fans()`, `serialPorts()`, `networkRoutes()`, `diskSpeed()`, `inetSpeed()`
169
176
  - extended Windows support: `disksIO()`, `fsStats()`, `fsOpenFiles()`, `thunderbolt()`
170
177
  - `time()` and `version()` are now asynchronous - all functions are async (async/await preferred, promises as alternative)
171
178
  - callbacks are no longer supported
@@ -206,6 +213,11 @@ Full function reference with examples can be found at [https://systeminformation
206
213
  | | timezone | X | X | X | X | X | e.g. GMT+0200 |
207
214
  | | timezoneName | X | X | X | X | X | e.g. CEST |
208
215
 
216
+ | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
217
+ | ---------------------- | ------------- | ----- | --- | --- | --- | --- | --------------------------------------------- |
218
+ | si.powerShellStart() | : void | | | | X | | start pool of persistent PowerShell processes |
219
+ | si.powerShellRelease() | : void | | | | X | | terminate all pooled PowerShell processes |
220
+
209
221
  #### 2. System (HW)
210
222
 
211
223
  | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
@@ -323,6 +335,8 @@ Full function reference with examples can be found at [https://systeminformation
323
335
  | | swaptotal | X | X | X | X | X | |
324
336
  | | swapused | X | X | X | X | X | |
325
337
  | | swapfree | X | X | X | X | X | |
338
+ | | swapin_sec | X | | | | | pages swapped in per sec. (* see notes) |
339
+ | | swapout_sec | X | | | | | pages swapped out per sec. (* see notes) |
326
340
  | si.memLayout() | [{...}] | X | X | X | X | | Memory Layout (array) |
327
341
  | | [0].size | X | X | X | X | | size in bytes |
328
342
  | | [0].bank | X | X | | X | | memory bank |
@@ -478,6 +492,8 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
478
492
  | | currentLoadIrq | X | | X | X | X | CPU load system in % |
479
493
  | | rawCurrentLoad... | X | | X | X | X | CPU load raw values (ticks) |
480
494
  | | cpus[] | X | | X | X | X | current loads per CPU in % + raw ticks |
495
+ | | cpus[].coreId | X | | X | X | | physical core of this logical CPU (null if unknown, macOS: Apple Silicon only) |
496
+ | | cpus[].socketId | X | | X | X | | socket / package of this logical CPU (null if unknown, macOS: Apple Silicon only) |
481
497
  | si.fullLoad() | : integer | X | | X | X | | CPU full load since bootup in % |
482
498
  | si.processes() | {...} | X | X | X | X | X | # running processes |
483
499
  | | all | X | X | X | X | X | # of all processes |
@@ -565,6 +581,11 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
565
581
  | | [0].protocol | X | | X | | | protocol (SATA, PCI-Express, ...) |
566
582
  | | [0].group | X | | | | | raid / pool member (e.g. md1, ZFS pool,<br>btrfs label) |
567
583
  | | [0].device | X | | X | X | | physical device mapped to (e.g. /dev/sda) |
584
+ | | [0].partUuid | X | | | | | partition UUID (PARTUUID) |
585
+ | | [0].partLabel | X | | | | | partition label (GPT name) |
586
+ | | [0].partType | X | | | | | partition type (MBR id e.g. 0x83, 0x5 = extended, or GPT type GUID) |
587
+ | | [0].partFlags | X | | | | | partition flags (e.g. 0x80 = bootable) |
588
+ | | [0].partStart | X | | | | | start offset of partition in bytes |
568
589
  | si.disksIO() | {...} | X | | X | X | | current transfer stats |
569
590
  | | rIO | X | | X | X | | read IOs on all mounted drives |
570
591
  | | wIO | X | | X | X | | write IOs on all mounted drives |
@@ -578,7 +599,16 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
578
599
  | | rWaitPercent | X | | | | | read IO request time percent (* see notes) |
579
600
  | | wWaitPercent | X | | | | | write IO request time percent (* see notes) |
580
601
  | | tWaitPercent | X | | | | | total IO request time percent (* see notes) |
602
+ | | busyPercent | X | | | | | percent of time disks were busy, avg. over all disks (* see notes) |
603
+ | | idlePercent | X | | | | | percent of time disks were idle, avg. over all disks (* see notes) |
581
604
  | | ms | X | | X | X | | interval length (for per second values) |
605
+ | si.diskSpeed(path, sizeMB) | {...} | X | X | X | X | | disk speed test (writes a temp. file, default 1 GB, max. 10 s per phase) |
606
+ | | path | X | X | X | X | | tested directory (default: temp directory) |
607
+ | | fs | X | X | X | X | | file system / device holding the directory |
608
+ | | sizeMB | X | X | X | X | | tested size in MB (less if the time budget was used up) |
609
+ | | writeSpeed | X | X | X | X | | write throughput in MB/s (incl. fsync) |
610
+ | | readSpeed | X | X | X | X | | read throughput in MB/s past the file cache, null if not possible (*) |
611
+ | | ms | X | X | X | X | | total duration in ms |
582
612
  | si.fsSize(drive) | [{...}] | X | X | X | X | | returns array of mounted file systems<br>drive param is optional |
583
613
  | | [0].fs | X | X | X | X | | name of file system |
584
614
  | | [0].type | X | X | X | X | | type of file system |
@@ -617,6 +647,7 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
617
647
  | | [0].subDeviceId | X | | X | X | | subsystem device id (hex) |
618
648
  | | [0].revision | X | | X | X | | revision |
619
649
  | | [0].driver | X | | | X | | kernel driver / service |
650
+ | | [0].iommuGroup | X | | | | | IOMMU group (if IOMMU enabled) |
620
651
  | si.thunderbolt() | [{...}] | X | | X | X | | Thunderbolt controllers/devices |
621
652
  | | [0].name | X | | X | X | | name |
622
653
  | | [0].uuid | X | | X | | | device UUID |
@@ -719,8 +750,15 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
719
750
  | | [0].ieee8021xAuth | X | | | X | | IEEE 802.1x auth |
720
751
  | | [0].ieee8021xState | X | | | X | | IEEE 802.1x state |
721
752
  | | [0].carrierChanges | X | | | | | # changes up/down |
753
+ | | [0].bridgeMembers | X | | X | | | interfaces enslaved to this bridge (empty if not a bridge) |
722
754
  | si.networkInterfaceDefault() | : string | X | X | X | X | X | get name of default network interface |
723
755
  | si.networkGatewayDefault() | : string | X | X | X | X | X | get default network gateway |
756
+ | si.networkRoutes() | [{...}] | X | X | X | X | | routing table (array of routes) |
757
+ | | [0].destination | X | X | X | X | | destination in CIDR notation (default route: 0.0.0.0/0 or ::/0) |
758
+ | | [0].gateway | X | X | X | X | | next hop (empty if directly connected) |
759
+ | | [0].iface | X | X | X | X | | interface |
760
+ | | [0].metric | X | | | X | | metric (Windows: route + interface metric), null if unknown |
761
+ | | [0].family | X | X | X | X | | IPv4 or IPv6 |
724
762
  | si.networkStats(ifaces) | [{...}] | 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 |
725
763
  | | [0].iface | X | X | X | X | | interface |
726
764
  | | [0].operstate | X | X | X | X | | up / down |
@@ -750,6 +788,13 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
750
788
  | | status | X | X | X | X | X | status code |
751
789
  | | ms | X | X | X | X | X | response time in ms |
752
790
  | si.inetLatency(host) | : number | X | X | X | X | X | response-time (ms) to external resource<br>host parameter is optional (default 8.8.8.8) |
791
+ | si.inetSpeed(dlUrl, ulUrl) | {...} | X | X | X | X | X | internet speed test (download / upload, max. 8 s each)<br>default server: speed.cloudflare.com, URLs optional |
792
+ | | server | X | X | X | X | X | test server (host) |
793
+ | | downloadSpeed | X | X | X | X | X | download throughput in Mbit/s |
794
+ | | uploadSpeed | X | X | X | X | X | upload throughput in Mbit/s |
795
+ | | downloadMB | X | X | X | X | X | transferred download volume in MB (max. 250) |
796
+ | | uploadMB | X | X | X | X | X | transferred upload volume in MB (max. 50) |
797
+ | | ms | X | X | X | X | X | total duration in ms |
753
798
 
754
799
  #### 13. Wifi
755
800
 
@@ -784,7 +829,8 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
784
829
  | | [0].signalLevel | X | | X | X | | signal level in dB |
785
830
  | | [0].quality | X | | X | X | | quality in % |
786
831
  | | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
787
- | | [0].txRate | X | | X | X | | transfer rate MBit/s |
832
+ | | [0].txRate | X | | X | X | | link transmit rate MBit/s |
833
+ | | [0].rxRate | X | | | X | | link receive rate MBit/s |
788
834
 
789
835
  #### 14. Bluetooth
790
836
 
@@ -1038,12 +1084,13 @@ $ npm install osx-temperature-sensor --save
1038
1084
  For Apple Silicon (ARM) based machines install
1039
1085
 
1040
1086
  ```bash
1041
- $ npm install macos-temperature-sensor --save
1087
+ $ npm install macos-smc --save
1042
1088
  ```
1043
1089
 
1044
1090
  `systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`.
1045
- On Apple Silicon machines `macos-temperature-sensor` also enables the GPU temperature (`temperatureGpu`) in `gpu()`
1046
- and - as soon as the package exposes them - the fan speeds in `fans()`.
1091
+ On Apple Silicon machines `macos-smc` also enables the GPU temperature (`temperatureGpu`) in `gpu()`, the fan speeds in `fans()`
1092
+ the real current CPU frequency in `cpuCurrentSpeed()` and the uncached read test in `diskSpeed()` (`os.cpus()` only reports a fixed value there). `macos-smc` replaces
1093
+ the former `macos-temperature-sensor` package, which is no longer used.
1047
1094
 
1048
1095
  #### Windows - Fan Speed
1049
1096
 
@@ -1073,9 +1120,13 @@ To be able to detect S.M.A.R.T. status on Linux you need to install `smartmontoo
1073
1120
 
1074
1121
  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.
1075
1122
 
1123
+ #### Windows - PowerShell Processes
1124
+
1125
+ To speed up Windows functions, a small pool of PowerShell processes is kept running in the background and reused for all calls. If you only gather data from time to time and do not want these processes to stay open, call `await si.powerShellRelease()` after your calls have finished. The pool restarts automatically with the next call that needs PowerShell.
1126
+
1076
1127
  ## *: Additional Notes
1077
1128
 
1078
- In `fsStats()`, `disksIO()` and `networkStats()` the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
1129
+ In `fsStats()`, `disksIO()`, `networkStats()` and `mem()` (swapin_sec, swapout_sec) the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
1079
1130
  with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs
1080
1131
  divided by the time between two calls of the function.
1081
1132
 
@@ -4,13 +4,16 @@ export { fullLoad } from '../cpu-full-load';
4
4
  export { fsOpenFiles } from '../darwin/fs-open-files';
5
5
  export { networkInterfaceDefault } from '../darwin/network-interface-default';
6
6
  export { networkInterfaces } from '../darwin/network-interfaces';
7
+ export { networkRoutes } from '../darwin/network-routes';
7
8
  export { users } from '../darwin/users';
8
9
  export { dockerAll, dockerContainerProcesses, dockerContainers, dockerContainerStats, dockerImages, dockerInfo, dockerVolumes } from '../docker';
9
10
  export { inetChecksite } from '../inet-checksite';
11
+ export { inetSpeed } from '../inet-speed';
10
12
  export { audio } from '../linux/audio';
11
13
  export { baseboard } from '../linux/baseboard';
12
14
  export { bios } from '../linux/bios';
13
15
  export { chassis } from '../linux/chassis';
16
+ export { diskSpeed } from '../linux/disk-speed';
14
17
  export { disksIO } from '../linux/disks-io';
15
18
  export { fsSize } from '../linux/fs-size';
16
19
  export { inetLatency } from '../linux/inet-latency';
package/dist/bsd/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uuid = exports.osInfo = exports.networkStats = exports.mem = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.battery = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.shell = exports.system = exports.services = exports.processes = exports.processLoad = exports.printer = exports.networkGatewayDefault = exports.networkConnections = exports.memLayout = exports.inetLatency = exports.fsSize = exports.disksIO = exports.chassis = exports.bios = exports.baseboard = exports.audio = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.users = exports.networkInterfaces = exports.networkInterfaceDefault = exports.fsOpenFiles = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
3
+ exports.uuid = exports.osInfo = exports.networkStats = exports.mem = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.battery = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.shell = exports.system = exports.services = exports.processes = exports.processLoad = exports.printer = exports.networkGatewayDefault = exports.networkConnections = exports.memLayout = exports.inetLatency = exports.fsSize = exports.disksIO = exports.diskSpeed = exports.chassis = exports.bios = exports.baseboard = exports.audio = exports.inetSpeed = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.users = exports.networkRoutes = exports.networkInterfaces = exports.networkInterfaceDefault = exports.fsOpenFiles = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
4
4
  var cpu_current_load_1 = require("../cpu-current-load");
5
5
  Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
6
6
  var cpu_current_speed_1 = require("../cpu-current-speed");
@@ -13,6 +13,8 @@ var network_interface_default_1 = require("../darwin/network-interface-default")
13
13
  Object.defineProperty(exports, "networkInterfaceDefault", { enumerable: true, get: function () { return network_interface_default_1.networkInterfaceDefault; } });
14
14
  var network_interfaces_1 = require("../darwin/network-interfaces");
15
15
  Object.defineProperty(exports, "networkInterfaces", { enumerable: true, get: function () { return network_interfaces_1.networkInterfaces; } });
16
+ var network_routes_1 = require("../darwin/network-routes");
17
+ Object.defineProperty(exports, "networkRoutes", { enumerable: true, get: function () { return network_routes_1.networkRoutes; } });
16
18
  var users_1 = require("../darwin/users");
17
19
  Object.defineProperty(exports, "users", { enumerable: true, get: function () { return users_1.users; } });
18
20
  var docker_1 = require("../docker");
@@ -25,6 +27,8 @@ Object.defineProperty(exports, "dockerInfo", { enumerable: true, get: function (
25
27
  Object.defineProperty(exports, "dockerVolumes", { enumerable: true, get: function () { return docker_1.dockerVolumes; } });
26
28
  var inet_checksite_1 = require("../inet-checksite");
27
29
  Object.defineProperty(exports, "inetChecksite", { enumerable: true, get: function () { return inet_checksite_1.inetChecksite; } });
30
+ var inet_speed_1 = require("../inet-speed");
31
+ Object.defineProperty(exports, "inetSpeed", { enumerable: true, get: function () { return inet_speed_1.inetSpeed; } });
28
32
  var audio_1 = require("../linux/audio");
29
33
  Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
30
34
  var baseboard_1 = require("../linux/baseboard");
@@ -33,6 +37,8 @@ var bios_1 = require("../linux/bios");
33
37
  Object.defineProperty(exports, "bios", { enumerable: true, get: function () { return bios_1.bios; } });
34
38
  var chassis_1 = require("../linux/chassis");
35
39
  Object.defineProperty(exports, "chassis", { enumerable: true, get: function () { return chassis_1.chassis; } });
40
+ var disk_speed_1 = require("../linux/disk-speed");
41
+ Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
36
42
  var disks_io_1 = require("../linux/disks-io");
37
43
  Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
38
44
  var fs_size_1 = require("../linux/fs-size");
@@ -2,6 +2,7 @@ import type { UserData } from './types';
2
2
  export declare const darwinXcodeExists: () => Promise<boolean>;
3
3
  export declare const USB_DATA_TYPES: string[];
4
4
  export declare const spItems: (data: any, dataTypes: string | string[]) => any[];
5
+ export declare const decodeXmlEntities: (value: string) => string;
5
6
  export declare const plistParser: (xmlStr: string, items?: boolean) => any;
6
7
  export declare const formatBssid: (s: string) => string;
7
8
  export declare const plistReader: (output: string) => {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.spItems = exports.USB_DATA_TYPES = exports.darwinXcodeExists = void 0;
3
+ exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.decodeXmlEntities = exports.spItems = exports.USB_DATA_TYPES = exports.darwinXcodeExists = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const promises_1 = require("fs/promises");
6
6
  const datetime_1 = require("./datetime");
@@ -30,6 +30,18 @@ const spItems = (data, dataTypes) => {
30
30
  return result;
31
31
  };
32
32
  exports.spItems = spItems;
33
+ const XML_ENTITIES = { lt: '<', gt: '>', amp: '&', quot: '"', apos: "'" };
34
+ const decodeXmlEntities = (value) => value.replace(/&(#x[0-9a-f]+|#\d+|lt|gt|amp|quot|apos);/gi, (match, entity) => {
35
+ const lower = entity.toLowerCase();
36
+ if (lower.startsWith('#x')) {
37
+ return String.fromCodePoint(parseInt(lower.slice(2), 16));
38
+ }
39
+ if (lower.startsWith('#')) {
40
+ return String.fromCodePoint(parseInt(lower.slice(1), 10));
41
+ }
42
+ return XML_ENTITIES[lower] ?? match;
43
+ });
44
+ exports.decodeXmlEntities = decodeXmlEntities;
33
45
  const plistParser = (xmlStr, items = true) => {
34
46
  const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
35
47
  const startStr = '<plist version';
@@ -129,7 +141,7 @@ const plistParser = (xmlStr, items = true) => {
129
141
  }
130
142
  else {
131
143
  if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) {
132
- metaData[depth].key = metaData[depth].tagContent;
144
+ metaData[depth].key = (0, exports.decodeXmlEntities)(metaData[depth].tagContent);
133
145
  }
134
146
  else {
135
147
  if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) {
@@ -139,7 +151,7 @@ const plistParser = (xmlStr, items = true) => {
139
151
  metaData[depth].data = parseInt(metaData[depth].tagContent, 10) || 0;
140
152
  }
141
153
  if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) {
142
- metaData[depth].data = metaData[depth].tagContent || '';
154
+ metaData[depth].data = (0, exports.decodeXmlEntities)(metaData[depth].tagContent);
143
155
  }
144
156
  if (metaData[depth].tagEnd === '/date' && metaData[depth].tagContent) {
145
157
  metaData[depth].data = metaData[depth].tagContent || '';
@@ -113,7 +113,9 @@ exports.initMemData = {
113
113
  swapused: 0,
114
114
  swapfree: 0,
115
115
  writeback: 0,
116
- dirty: 0
116
+ dirty: 0,
117
+ swapin_sec: null,
118
+ swapout_sec: null
117
119
  };
118
120
  const initOsInfo = async () => {
119
121
  return {
@@ -205,7 +207,12 @@ exports.initFsBlockDevice = {
205
207
  removable: false,
206
208
  protocol: '',
207
209
  group: '',
208
- device: ''
210
+ device: '',
211
+ partUuid: '',
212
+ partLabel: '',
213
+ partType: '',
214
+ partFlags: '',
215
+ partStart: null
209
216
  };
210
217
  exports.initFsStats = {
211
218
  rx: 0,
@@ -229,6 +236,8 @@ exports.initDiskIo = {
229
236
  rWaitPercent: null,
230
237
  wWaitPercent: null,
231
238
  tWaitPercent: null,
239
+ busyPercent: null,
240
+ idlePercent: null,
232
241
  ms: 0
233
242
  };
234
243
  exports.initDisplay = {
@@ -293,7 +302,8 @@ exports.initNetworkInterface = {
293
302
  dnsSuffix: '',
294
303
  ieee8021xAuth: '',
295
304
  ieee8021xState: '',
296
- carrierChanges: 0
305
+ carrierChanges: 0,
306
+ bridgeMembers: []
297
307
  };
298
308
  exports.initNpuData = {
299
309
  vendor: '',
@@ -315,7 +325,8 @@ exports.initPciData = {
315
325
  subVendorId: '',
316
326
  subDeviceId: '',
317
327
  revision: '',
318
- driver: ''
328
+ driver: '',
329
+ iommuGroup: ''
319
330
  };
320
331
  exports.initNetworkSpeed = {
321
332
  iface: '',
@@ -0,0 +1,20 @@
1
+ import type { DiskSpeedData } from './types';
2
+ export declare const DISK_SPEED: {
3
+ defaultMB: number;
4
+ minMB: number;
5
+ maxMB: number;
6
+ budgetMs: number;
7
+ reserveBytes: number;
8
+ block: number;
9
+ queue: number;
10
+ };
11
+ export type DiskSpeedIO = {
12
+ bytes: number;
13
+ ms: number;
14
+ };
15
+ export type DiskSpeedPlatform = {
16
+ prepareWrite?: (fd: number) => boolean;
17
+ readUncached: (file: string, bytes: number) => Promise<DiskSpeedIO | null>;
18
+ };
19
+ export declare const readFileTimed: (file: string, bytes: number, onOpen?: (fd: number) => boolean) => Promise<DiskSpeedIO | null>;
20
+ export declare const runDiskSpeed: (path: unknown, sizeMB: unknown, platform: DiskSpeedPlatform) => Promise<DiskSpeedData | null>;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runDiskSpeed = exports.readFileTimed = exports.DISK_SPEED = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_os_1 = require("node:os");
7
+ const node_path_1 = require("node:path");
8
+ const const_1 = require("./const");
9
+ const exec_1 = require("./exec");
10
+ const MB = 1024 * 1024;
11
+ exports.DISK_SPEED = {
12
+ defaultMB: 1024,
13
+ minMB: 16,
14
+ maxMB: 4096,
15
+ budgetMs: 10000,
16
+ reserveBytes: 1024 * MB,
17
+ block: 4 * MB,
18
+ queue: 4
19
+ };
20
+ const O_DSYNC = promises_1.constants.O_DSYNC ?? (const_1.WINDOWS ? 0x04000000 : 0);
21
+ const WRITE_FLAGS = promises_1.constants.O_WRONLY | promises_1.constants.O_CREAT | promises_1.constants.O_EXCL | O_DSYNC;
22
+ const elapsedMs = (start) => Number(process.hrtime.bigint() - start) / 1e6;
23
+ const mbPerSec = (bytes, ms) => (bytes > 0 && ms > 0 ? Math.round((bytes / MB / (ms / 1000)) * 10) / 10 : null);
24
+ const timedIO = async (total, op) => {
25
+ let next = 0;
26
+ let done = 0;
27
+ const start = process.hrtime.bigint();
28
+ const worker = async (id) => {
29
+ while (next < total && elapsedMs(start) < exports.DISK_SPEED.budgetMs) {
30
+ const pos = next;
31
+ const len = Math.min(exports.DISK_SPEED.block, total - pos);
32
+ next += len;
33
+ await op(pos, len, id);
34
+ done += len;
35
+ }
36
+ };
37
+ await Promise.all(Array.from({ length: exports.DISK_SPEED.queue }, (_, id) => worker(id)));
38
+ return { bytes: done, ms: elapsedMs(start) };
39
+ };
40
+ const readFileTimed = async (file, bytes, onOpen) => {
41
+ const handle = await (0, promises_1.open)(file, 'r');
42
+ try {
43
+ if (onOpen && !onOpen(handle.fd)) {
44
+ return null;
45
+ }
46
+ const buffers = Array.from({ length: exports.DISK_SPEED.queue }, () => Buffer.allocUnsafe(exports.DISK_SPEED.block));
47
+ return await timedIO(bytes, (pos, len, worker) => handle.read(buffers[worker], 0, len, pos));
48
+ }
49
+ finally {
50
+ await handle.close();
51
+ }
52
+ };
53
+ exports.readFileTimed = readFileTimed;
54
+ const fileSystemOf = async (dir) => {
55
+ if (const_1.WINDOWS) {
56
+ return /^[a-z]:/i.test(dir) ? dir.slice(0, 2).toUpperCase() : '';
57
+ }
58
+ try {
59
+ const { stdout } = await (0, exec_1.execFile)('df', ['-P', dir], { timeout: 5000 });
60
+ return stdout.toString().trim().split('\n').pop()?.split(/\s+/)[0] || '';
61
+ }
62
+ catch {
63
+ return '';
64
+ }
65
+ };
66
+ const measure = async (path, sizeMB, platform) => {
67
+ if (path !== undefined && path !== null && path !== '' && (typeof path !== 'string' || path.includes('\0'))) {
68
+ return null;
69
+ }
70
+ if (sizeMB !== undefined && sizeMB !== null && (typeof sizeMB !== 'number' || !Number.isFinite(sizeMB))) {
71
+ return null;
72
+ }
73
+ const size = Math.min(exports.DISK_SPEED.maxMB, Math.max(exports.DISK_SPEED.minMB, Math.round(sizeMB ?? exports.DISK_SPEED.defaultMB)));
74
+ const total = size * MB;
75
+ let dir = '';
76
+ try {
77
+ dir = await (0, promises_1.realpath)((0, node_path_1.resolve)(path || (0, node_os_1.tmpdir)()));
78
+ if (!(await (0, promises_1.stat)(dir)).isDirectory()) {
79
+ return null;
80
+ }
81
+ const space = await (0, promises_1.statfs)(dir);
82
+ if (space.bavail * Math.min(space.bsize, 4096) < total + exports.DISK_SPEED.reserveBytes) {
83
+ return null;
84
+ }
85
+ }
86
+ catch {
87
+ return null;
88
+ }
89
+ const start = process.hrtime.bigint();
90
+ let testDir = '';
91
+ try {
92
+ testDir = await (0, promises_1.mkdtemp)((0, node_path_1.join)(dir, '.si-diskspeed-'));
93
+ const file = (0, node_path_1.join)(testDir, 'test.bin');
94
+ const handle = await (0, promises_1.open)(file, WRITE_FLAGS, 0o600);
95
+ let write;
96
+ let uncached = true;
97
+ try {
98
+ if (platform.prepareWrite) {
99
+ uncached = platform.prepareWrite(handle.fd);
100
+ }
101
+ const buffers = Array.from({ length: exports.DISK_SPEED.queue }, () => (0, node_crypto_1.randomBytes)(exports.DISK_SPEED.block));
102
+ write = await timedIO(total, (pos, len, worker) => {
103
+ const buffer = buffers[worker];
104
+ for (let offset = 0; offset < len; offset += 4096) {
105
+ buffer.writeDoubleLE(pos + offset, offset);
106
+ }
107
+ return handle.write(buffer, 0, len, pos);
108
+ });
109
+ const syncStart = process.hrtime.bigint();
110
+ await handle.sync();
111
+ write.ms += elapsedMs(syncStart);
112
+ }
113
+ finally {
114
+ await handle.close();
115
+ }
116
+ const read = uncached && write.bytes ? await platform.readUncached(file, write.bytes).catch(() => null) : null;
117
+ const ms = Math.round(elapsedMs(start));
118
+ return {
119
+ path: dir,
120
+ fs: await fileSystemOf(dir),
121
+ sizeMB: Math.round(write.bytes / MB),
122
+ writeSpeed: mbPerSec(write.bytes, write.ms),
123
+ readSpeed: read ? mbPerSec(read.bytes, read.ms) : null,
124
+ ms
125
+ };
126
+ }
127
+ catch {
128
+ return null;
129
+ }
130
+ finally {
131
+ if (testDir) {
132
+ await (0, promises_1.rm)(testDir, { recursive: true, force: true }).catch(() => { });
133
+ }
134
+ }
135
+ };
136
+ let _queue = Promise.resolve();
137
+ const runDiskSpeed = (path, sizeMB, platform) => {
138
+ const run = _queue.then(() => measure(path, sizeMB, platform));
139
+ _queue = run.catch(() => null);
140
+ return run;
141
+ };
142
+ exports.runDiskSpeed = runDiskSpeed;
@@ -13,7 +13,7 @@ export declare const smartMonToolsInstalled: () => Promise<boolean>;
13
13
  export declare const _fs_speed: any;
14
14
  export declare const calcFsSpeed: (rx: number, wx: number) => any;
15
15
  export declare const _disk_io: any;
16
- export declare const calcDiskIO: (rIO: number, wIO: number, rWaitTime: number, wWaitTime: number, tWaitTime: number) => any;
16
+ export declare const calcDiskIO: (rIO: number, wIO: number, rWaitTime: number, wWaitTime: number, tWaitTime: number, busyTime?: number | null) => any;
17
17
  export declare const blkStdoutToObject: (stdout: string) => string;
18
18
  export declare const parseLinuxBlk: (lines: string[]) => FsBlockDevicesData[];
19
19
  export declare const raidMatchLinux: (data: FsBlockDevicesData[]) => Promise<FsBlockDevicesData[]>;
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.btrfsPoolsLinux = exports.zfsPoolsLinux = exports.parseZfsMountpoints = exports.applyPoolsLinux = exports.btrfsUsableSize = exports.btrfsProfileFromEntries = exports.parseZpoolList = exports.parseZpoolStatus = exports.matchDevicesWin = exports.matchDevicesLinux = exports.raidMatchLinux = exports.parseLinuxBlk = exports.blkStdoutToObject = exports.calcDiskIO = exports._disk_io = exports.calcFsSpeed = exports._fs_speed = exports.smartMonToolsInstalled = exports.zfsDatasets = void 0;
4
4
  const promises_1 = require("node:fs/promises");
5
- const index_1 = require("./index");
6
5
  const const_1 = require("./const");
7
6
  const defaults_1 = require("./defaults");
8
7
  const exec_1 = require("./exec");
8
+ const index_1 = require("./index");
9
9
  const security_1 = require("./security");
10
10
  let _smartMonToolsInstalled = null;
11
11
  const zfsDatasets = async () => {
@@ -101,7 +101,7 @@ const calcFsSpeed = (rx, wx) => {
101
101
  };
102
102
  exports.calcFsSpeed = calcFsSpeed;
103
103
  exports._disk_io = {};
104
- const calcDiskIO = (rIO, wIO, rWaitTime, wWaitTime, tWaitTime) => {
104
+ const calcDiskIO = (rIO, wIO, rWaitTime, wWaitTime, tWaitTime, busyTime = null) => {
105
105
  const result = (0, index_1.cloneObj)(defaults_1.initDiskIo);
106
106
  if (exports._disk_io?.ms) {
107
107
  result.rIO = rIO;
@@ -117,6 +117,13 @@ const calcDiskIO = (rIO, wIO, rWaitTime, wWaitTime, tWaitTime) => {
117
117
  result.rWaitPercent = (result.rWaitTime * 100) / result.ms;
118
118
  result.wWaitPercent = (result.wWaitTime * 100) / result.ms;
119
119
  result.tWaitPercent = (result.tWaitTime * 100) / result.ms;
120
+ if (busyTime !== null && exports._disk_io.busyTime !== null && result.ms > 0) {
121
+ result.busyPercent = Math.min(100, Math.max(0, ((busyTime - exports._disk_io.busyTime) * 100) / result.ms));
122
+ result.idlePercent = 100 - result.busyPercent;
123
+ }
124
+ exports._disk_io.busyTime = busyTime;
125
+ exports._disk_io.busyPercent = result.busyPercent;
126
+ exports._disk_io.idlePercent = result.idlePercent;
120
127
  exports._disk_io.rIO = rIO;
121
128
  exports._disk_io.wIO = wIO;
122
129
  exports._disk_io.rIO_sec = result.rIO_sec;
@@ -155,6 +162,9 @@ const calcDiskIO = (rIO, wIO, rWaitTime, wWaitTime, tWaitTime) => {
155
162
  exports._disk_io.rWaitPercent = null;
156
163
  exports._disk_io.wWaitPercent = null;
157
164
  exports._disk_io.tWaitPercent = null;
165
+ exports._disk_io.busyTime = busyTime;
166
+ exports._disk_io.busyPercent = null;
167
+ exports._disk_io.idlePercent = null;
158
168
  exports._disk_io.last_ms = 0;
159
169
  exports._disk_io.ms = Date.now();
160
170
  }
@@ -163,6 +173,10 @@ const calcDiskIO = (rIO, wIO, rWaitTime, wWaitTime, tWaitTime) => {
163
173
  exports.calcDiskIO = calcDiskIO;
164
174
  const blkStdoutToObject = (stdout) => {
165
175
  return stdout
176
+ .replace(/PARTUUID=/g, ',"partUuid":')
177
+ .replace(/PARTLABEL=/g, ',"partLabel":')
178
+ .replace(/PARTTYPE=/g, ',"partType":')
179
+ .replace(/PARTFLAGS=/g, ',"partFlags":')
166
180
  .replace(/NAME=/g, '{"name":')
167
181
  .replace(/FSTYPE=/g, ',"fsType":')
168
182
  .replace(/TYPE=/g, ',"type":')
@@ -205,7 +219,11 @@ const parseLinuxBlk = (lines) => {
205
219
  serial: disk.serial,
206
220
  removable: disk.rm === '1',
207
221
  protocol: disk.tran,
208
- group: disk.group
222
+ group: disk.group,
223
+ partUuid: disk.partUuid || '',
224
+ partLabel: disk.partLabel || '',
225
+ partType: disk.partType || '',
226
+ partFlags: disk.partFlags || ''
209
227
  });
210
228
  }
211
229
  catch { }
@@ -488,7 +506,9 @@ const btrfsPoolsLinux = async (data) => {
488
506
  name: label || fsid,
489
507
  type: profile || 'btrfs',
490
508
  fsType: 'btrfs',
491
- size: members.length === devices.length ? (0, exports.btrfsUsableSize)(profile, members.map((element) => element.size)) : members.reduce((sum, element) => sum + element.size, 0),
509
+ size: members.length === devices.length
510
+ ? (0, exports.btrfsUsableSize)(profile, members.map((element) => element.size))
511
+ : members.reduce((sum, element) => sum + element.size, 0),
492
512
  uuid: fsid,
493
513
  mount: members.find((element) => element.mount)?.mount || '',
494
514
  members: devices
@@ -9,7 +9,7 @@ export declare const usbLinuxType: (type: string, name: string) => string;
9
9
  export declare const usbDarwinType: (name: string) => "" | "Microphone" | "Controller" | "Keyboard" | "Mouse" | "Trackpad" | "Audio" | "Camera" | "Hub" | "Storage" | "Touch Bar" | "Sensor" | "Bluetooth";
10
10
  export declare const usbWindowsType: (creationclass: string, name: string) => "" | "Controller" | "Keyboard" | "Mouse" | "Hub" | "Storage";
11
11
  export declare const wifiVendor: (model: string) => "" | "Intel" | "Realtek" | "Qualcom" | "Broadcom" | "Cavium" | "Cisco" | "Marvel" | "Zyxel" | "Melanox" | "D-Link" | "TP-Link" | "Asus" | "Linksys";
12
- export declare const getLogoFile: (distro?: string) => NodeJS.Platform | "apple" | "windows" | "arch" | "cachy" | "centos" | "coreos" | "debian" | "deepin" | "elementary" | "endeavour" | "fedora" | "gentoo" | "mageia" | "mandriva" | "manjaro" | "mint" | "mx" | "opensuse" | "pclinuxos" | "puppy" | "popos" | "raspbian" | "reactos" | "redhat" | "slackware" | "sugar" | "steam" | "suse" | "ubuntu-mate" | "lubuntu" | "xubuntu" | "ubuntu" | "solaris" | "tails" | "ferenos" | "robolinux";
12
+ export declare const getLogoFile: (distro?: string) => NodeJS.Platform | "apple" | "windows" | "cachy" | "centos" | "coreos" | "debian" | "deepin" | "elementary" | "endeavour" | "fedora" | "gentoo" | "mageia" | "mandriva" | "manjaro" | "mint" | "mx" | "opensuse" | "pclinuxos" | "puppy" | "popos" | "raspbian" | "nixos" | "zorin" | "garuda" | "nobara" | "bazzite" | "reactos" | "redhat" | "slackware" | "sugar" | "steam" | "suse" | "ubuntu-mate" | "lubuntu" | "xubuntu" | "ubuntu" | "solaris" | "tails" | "ferenos" | "robolinux" | "arch";
13
13
  export declare const getWindowsRelease: (build: number) => string;
14
14
  export declare const JEDEV_RAM_manufacturers: {
15
15
  [index: string]: any;