systeminformation 6.0.0-beta.24 → 6.0.0-beta.25

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 (67) hide show
  1. package/README.md +47 -5
  2. package/dist/bsd/index.d.ts +2 -0
  3. package/dist/bsd/index.js +5 -1
  4. package/dist/common/defaults.js +15 -4
  5. package/dist/common/disk-speed.d.ts +20 -0
  6. package/dist/common/disk-speed.js +142 -0
  7. package/dist/common/filesys.d.ts +1 -1
  8. package/dist/common/filesys.js +24 -4
  9. package/dist/common/mappings.d.ts +1 -1
  10. package/dist/common/mappings.js +14 -4
  11. package/dist/common/types.d.ts +32 -0
  12. package/dist/common/windows.d.ts +1 -0
  13. package/dist/common/windows.js +19 -5
  14. package/dist/cpu-current-load.js +45 -0
  15. package/dist/cpu-current-speed.js +6 -0
  16. package/dist/darwin/cpu-current-speed.d.ts +2 -0
  17. package/dist/darwin/cpu-current-speed.js +30 -0
  18. package/dist/darwin/cpu-temperature.js +7 -13
  19. package/dist/darwin/disk-speed.d.ts +2 -0
  20. package/dist/darwin/disk-speed.js +18 -0
  21. package/dist/darwin/disks-io.js +3 -1
  22. package/dist/darwin/fans.js +11 -13
  23. package/dist/darwin/gpu.d.ts +1 -1
  24. package/dist/darwin/gpu.js +4 -4
  25. package/dist/darwin/index.d.ts +2 -0
  26. package/dist/darwin/index.js +6 -2
  27. package/dist/darwin/network-interfaces.js +14 -4
  28. package/dist/darwin/network-routes.d.ts +3 -0
  29. package/dist/darwin/network-routes.js +74 -0
  30. package/dist/disk-speed.d.ts +1 -0
  31. package/dist/disk-speed.js +17 -0
  32. package/dist/get.js +5 -5
  33. package/dist/index.d.ts +11 -8
  34. package/dist/index.js +28 -21
  35. package/dist/linux/block-devices.d.ts +1 -1
  36. package/dist/linux/block-devices.js +21 -5
  37. package/dist/linux/cpu-topology.d.ts +2 -0
  38. package/dist/linux/cpu-topology.js +15 -0
  39. package/dist/linux/disk-speed.d.ts +2 -0
  40. package/dist/linux/disk-speed.js +16 -0
  41. package/dist/linux/disks-io.d.ts +1 -1
  42. package/dist/linux/disks-io.js +18 -7
  43. package/dist/linux/index.d.ts +2 -0
  44. package/dist/linux/index.js +6 -2
  45. package/dist/linux/mem.js +20 -1
  46. package/dist/linux/network-interfaces.js +18 -7
  47. package/dist/linux/network-routes.d.ts +4 -0
  48. package/dist/linux/network-routes.js +69 -0
  49. package/dist/linux/os-info.js +32 -4
  50. package/dist/linux/pci.d.ts +1 -1
  51. package/dist/linux/pci.js +4 -3
  52. package/dist/network-routes.d.ts +1 -0
  53. package/dist/network-routes.js +17 -0
  54. package/dist/powershell.d.ts +2 -0
  55. package/dist/powershell.js +15 -0
  56. package/dist/windows/block-devices.js +6 -1
  57. package/dist/windows/cpu-topology.d.ts +3 -0
  58. package/dist/windows/cpu-topology.js +90 -0
  59. package/dist/windows/disk-speed.d.ts +6 -0
  60. package/dist/windows/disk-speed.js +73 -0
  61. package/dist/windows/disks-io.js +3 -1
  62. package/dist/windows/index.d.ts +2 -0
  63. package/dist/windows/index.js +6 -2
  64. package/dist/windows/network-interfaces.js +6 -3
  65. package/dist/windows/network-routes.d.ts +3 -0
  66. package/dist/windows/network-routes.js +41 -0
  67. package/package.json +1 -1
package/README.md CHANGED
@@ -51,6 +51,8 @@ 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)
54
56
 
55
57
  ### Extended Windows support
56
58
 
@@ -72,6 +74,10 @@ imported individually - see [Installation](#installation) and [Usage](#usage).
72
74
  - **Minimum Node.js version is now 20.0** (older releases are no longer supported).
73
75
  - **Import paths.** With the new `exports` map only the documented entry points are
74
76
  importable (deep `dist/...` paths are no longer part of the public API).
77
+ - **`osInfo().distro` reports flavors and derivatives** (e.g. `Kubuntu` instead of
78
+ `Ubuntu`, `Raspberry Pi OS` instead of `Debian GNU/Linux`) - adapt checks on the distro name.
79
+ - **macOS (Apple Silicon): `macos-smc` replaces `macos-temperature-sensor`** as optional
80
+ package for temperatures, fans and the current CPU frequency - see [Known Issues](#known-issues).
75
81
 
76
82
  ## Quick Start
77
83
 
@@ -165,7 +171,7 @@ implementations can be tree-shaken away.
165
171
 
166
172
  - complete rewrite in TypeScript with typed declarations for every function
167
173
  - 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()`
174
+ - new functions: `camera()`, `keyboard()`, `mouse()`, `thunderbolt()`, `pci()`, `npu()`, `software()`, `npm()`, `fans()`, `serialPorts()`, `networkRoutes()`, `diskSpeed()`
169
175
  - extended Windows support: `disksIO()`, `fsStats()`, `fsOpenFiles()`, `thunderbolt()`
170
176
  - `time()` and `version()` are now asynchronous - all functions are async (async/await preferred, promises as alternative)
171
177
  - callbacks are no longer supported
@@ -206,6 +212,11 @@ Full function reference with examples can be found at [https://systeminformation
206
212
  | | timezone | X | X | X | X | X | e.g. GMT+0200 |
207
213
  | | timezoneName | X | X | X | X | X | e.g. CEST |
208
214
 
215
+ | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
216
+ | ---------------------- | ------------- | ----- | --- | --- | --- | --- | --------------------------------------------- |
217
+ | si.powerShellStart() | : void | | | | X | | start pool of persistent PowerShell processes |
218
+ | si.powerShellRelease() | : void | | | | X | | terminate all pooled PowerShell processes |
219
+
209
220
  #### 2. System (HW)
210
221
 
211
222
  | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
@@ -323,6 +334,8 @@ Full function reference with examples can be found at [https://systeminformation
323
334
  | | swaptotal | X | X | X | X | X | |
324
335
  | | swapused | X | X | X | X | X | |
325
336
  | | swapfree | X | X | X | X | X | |
337
+ | | swapin_sec | X | | | | | pages swapped in per sec. (* see notes) |
338
+ | | swapout_sec | X | | | | | pages swapped out per sec. (* see notes) |
326
339
  | si.memLayout() | [{...}] | X | X | X | X | | Memory Layout (array) |
327
340
  | | [0].size | X | X | X | X | | size in bytes |
328
341
  | | [0].bank | X | X | | X | | memory bank |
@@ -478,6 +491,8 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
478
491
  | | currentLoadIrq | X | | X | X | X | CPU load system in % |
479
492
  | | rawCurrentLoad... | X | | X | X | X | CPU load raw values (ticks) |
480
493
  | | cpus[] | X | | X | X | X | current loads per CPU in % + raw ticks |
494
+ | | cpus[].coreId | X | | X | X | | physical core of this logical CPU (null if unknown, macOS: Apple Silicon only) |
495
+ | | cpus[].socketId | X | | X | X | | socket / package of this logical CPU (null if unknown, macOS: Apple Silicon only) |
481
496
  | si.fullLoad() | : integer | X | | X | X | | CPU full load since bootup in % |
482
497
  | si.processes() | {...} | X | X | X | X | X | # running processes |
483
498
  | | all | X | X | X | X | X | # of all processes |
@@ -565,6 +580,11 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
565
580
  | | [0].protocol | X | | X | | | protocol (SATA, PCI-Express, ...) |
566
581
  | | [0].group | X | | | | | raid / pool member (e.g. md1, ZFS pool,<br>btrfs label) |
567
582
  | | [0].device | X | | X | X | | physical device mapped to (e.g. /dev/sda) |
583
+ | | [0].partUuid | X | | | | | partition UUID (PARTUUID) |
584
+ | | [0].partLabel | X | | | | | partition label (GPT name) |
585
+ | | [0].partType | X | | | | | partition type (MBR id e.g. 0x83, 0x5 = extended, or GPT type GUID) |
586
+ | | [0].partFlags | X | | | | | partition flags (e.g. 0x80 = bootable) |
587
+ | | [0].partStart | X | | | | | start offset of partition in bytes |
568
588
  | si.disksIO() | {...} | X | | X | X | | current transfer stats |
569
589
  | | rIO | X | | X | X | | read IOs on all mounted drives |
570
590
  | | wIO | X | | X | X | | write IOs on all mounted drives |
@@ -578,7 +598,16 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
578
598
  | | rWaitPercent | X | | | | | read IO request time percent (* see notes) |
579
599
  | | wWaitPercent | X | | | | | write IO request time percent (* see notes) |
580
600
  | | tWaitPercent | X | | | | | total IO request time percent (* see notes) |
601
+ | | busyPercent | X | | | | | percent of time disks were busy, avg. over all disks (* see notes) |
602
+ | | idlePercent | X | | | | | percent of time disks were idle, avg. over all disks (* see notes) |
581
603
  | | ms | X | | X | X | | interval length (for per second values) |
604
+ | si.diskSpeed(path, sizeMB) | {...} | X | X | X | X | | disk speed test (writes a temp. file, default 1 GB, max. 10 s per phase) |
605
+ | | path | X | X | X | X | | tested directory (default: temp directory) |
606
+ | | fs | X | X | X | X | | file system / device holding the directory |
607
+ | | sizeMB | X | X | X | X | | tested size in MB (less if the time budget was used up) |
608
+ | | writeSpeed | X | X | X | X | | write throughput in MB/s (incl. fsync) |
609
+ | | readSpeed | X | X | X | X | | read throughput in MB/s past the file cache, null if not possible (*) |
610
+ | | ms | X | X | X | X | | total duration in ms |
582
611
  | si.fsSize(drive) | [{...}] | X | X | X | X | | returns array of mounted file systems<br>drive param is optional |
583
612
  | | [0].fs | X | X | X | X | | name of file system |
584
613
  | | [0].type | X | X | X | X | | type of file system |
@@ -617,6 +646,7 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
617
646
  | | [0].subDeviceId | X | | X | X | | subsystem device id (hex) |
618
647
  | | [0].revision | X | | X | X | | revision |
619
648
  | | [0].driver | X | | | X | | kernel driver / service |
649
+ | | [0].iommuGroup | X | | | | | IOMMU group (if IOMMU enabled) |
620
650
  | si.thunderbolt() | [{...}] | X | | X | X | | Thunderbolt controllers/devices |
621
651
  | | [0].name | X | | X | X | | name |
622
652
  | | [0].uuid | X | | X | | | device UUID |
@@ -719,8 +749,15 @@ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boa
719
749
  | | [0].ieee8021xAuth | X | | | X | | IEEE 802.1x auth |
720
750
  | | [0].ieee8021xState | X | | | X | | IEEE 802.1x state |
721
751
  | | [0].carrierChanges | X | | | | | # changes up/down |
752
+ | | [0].bridgeMembers | X | | X | | | interfaces enslaved to this bridge (empty if not a bridge) |
722
753
  | si.networkInterfaceDefault() | : string | X | X | X | X | X | get name of default network interface |
723
754
  | si.networkGatewayDefault() | : string | X | X | X | X | X | get default network gateway |
755
+ | si.networkRoutes() | [{...}] | X | X | X | X | | routing table (array of routes) |
756
+ | | [0].destination | X | X | X | X | | destination in CIDR notation (default route: 0.0.0.0/0 or ::/0) |
757
+ | | [0].gateway | X | X | X | X | | next hop (empty if directly connected) |
758
+ | | [0].iface | X | X | X | X | | interface |
759
+ | | [0].metric | X | | | X | | metric (Windows: route + interface metric), null if unknown |
760
+ | | [0].family | X | X | X | X | | IPv4 or IPv6 |
724
761
  | 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
762
  | | [0].iface | X | X | X | X | | interface |
726
763
  | | [0].operstate | X | X | X | X | | up / down |
@@ -1038,12 +1075,13 @@ $ npm install osx-temperature-sensor --save
1038
1075
  For Apple Silicon (ARM) based machines install
1039
1076
 
1040
1077
  ```bash
1041
- $ npm install macos-temperature-sensor --save
1078
+ $ npm install macos-smc --save
1042
1079
  ```
1043
1080
 
1044
1081
  `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()`.
1082
+ On Apple Silicon machines `macos-smc` also enables the GPU temperature (`temperatureGpu`) in `gpu()`, the fan speeds in `fans()`
1083
+ 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
1084
+ the former `macos-temperature-sensor` package, which is no longer used.
1047
1085
 
1048
1086
  #### Windows - Fan Speed
1049
1087
 
@@ -1073,9 +1111,13 @@ To be able to detect S.M.A.R.T. status on Linux you need to install `smartmontoo
1073
1111
 
1074
1112
  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
1113
 
1114
+ #### Windows - PowerShell Processes
1115
+
1116
+ 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.
1117
+
1076
1118
  ## *: Additional Notes
1077
1119
 
1078
- In `fsStats()`, `disksIO()` and `networkStats()` the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
1120
+ In `fsStats()`, `disksIO()`, `networkStats()` and `mem()` (swapin_sec, swapout_sec) the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
1079
1121
  with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs
1080
1122
  divided by the time between two calls of the function.
1081
1123
 
@@ -4,6 +4,7 @@ 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,6 +12,7 @@ export { audio } from '../linux/audio';
11
12
  export { baseboard } from '../linux/baseboard';
12
13
  export { bios } from '../linux/bios';
13
14
  export { chassis } from '../linux/chassis';
15
+ export { diskSpeed } from '../linux/disk-speed';
14
16
  export { disksIO } from '../linux/disks-io';
15
17
  export { fsSize } from '../linux/fs-size';
16
18
  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.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");
@@ -33,6 +35,8 @@ var bios_1 = require("../linux/bios");
33
35
  Object.defineProperty(exports, "bios", { enumerable: true, get: function () { return bios_1.bios; } });
34
36
  var chassis_1 = require("../linux/chassis");
35
37
  Object.defineProperty(exports, "chassis", { enumerable: true, get: function () { return chassis_1.chassis; } });
38
+ var disk_speed_1 = require("../linux/disk-speed");
39
+ Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
36
40
  var disks_io_1 = require("../linux/disks-io");
37
41
  Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
38
42
  var fs_size_1 = require("../linux/fs-size");
@@ -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;
@@ -294,8 +294,6 @@ const getLogoFile = (distro = '') => {
294
294
  return 'windows';
295
295
  case distro.indexOf('mac os') !== -1 || distro.indexOf('macos') !== -1:
296
296
  return 'apple';
297
- case distro.indexOf('arch') !== -1:
298
- return 'arch';
299
297
  case distro.indexOf('cachy') !== -1:
300
298
  return 'cachy';
301
299
  case distro.indexOf('centos') !== -1:
@@ -334,10 +332,20 @@ const getLogoFile = (distro = '') => {
334
332
  return 'pclinuxos';
335
333
  case distro.indexOf('puppy') !== -1:
336
334
  return 'puppy';
337
- case distro.indexOf('popos') !== -1:
335
+ case distro.indexOf('popos') !== -1 || distro.indexOf('pop!_os') !== -1:
338
336
  return 'popos';
339
- case distro.indexOf('raspbian') !== -1:
337
+ case distro.indexOf('raspbian') !== -1 || distro.indexOf('raspberry') !== -1:
340
338
  return 'raspbian';
339
+ case distro.indexOf('nixos') !== -1:
340
+ return 'nixos';
341
+ case distro.indexOf('zorin') !== -1:
342
+ return 'zorin';
343
+ case distro.indexOf('garuda') !== -1:
344
+ return 'garuda';
345
+ case distro.indexOf('nobara') !== -1:
346
+ return 'nobara';
347
+ case distro.indexOf('bazzite') !== -1:
348
+ return 'bazzite';
341
349
  case distro.indexOf('reactos') !== -1:
342
350
  return 'reactos';
343
351
  case distro.indexOf('redhat') !== -1:
@@ -366,6 +374,8 @@ const getLogoFile = (distro = '') => {
366
374
  return 'ferenos';
367
375
  case distro.indexOf('robolinux') !== -1:
368
376
  return 'robolinux';
377
+ case distro.indexOf('arch') !== -1:
378
+ return 'arch';
369
379
  default:
370
380
  return const_1.PLATFORM;
371
381
  }
@@ -376,6 +376,12 @@ export type CurrentLoadCpuData = {
376
376
  rawLoadIdle: number;
377
377
  rawLoadIowait: number;
378
378
  rawLoadIrq: number;
379
+ coreId: number | null;
380
+ socketId: number | null;
381
+ };
382
+ export type CpuTopologyData = {
383
+ coreId: number | null;
384
+ socketId: number | null;
379
385
  };
380
386
  export type WifiNetworkData = {
381
387
  ssid: string;
@@ -448,6 +454,8 @@ export type MemData = {
448
454
  swapfree: number;
449
455
  writeback: number;
450
456
  dirty: number;
457
+ swapin_sec: number | null;
458
+ swapout_sec: number | null;
451
459
  };
452
460
  export type MemLayoutData = {
453
461
  size: number;
@@ -641,6 +649,19 @@ export type FsBlockDevicesData = {
641
649
  protocol: string;
642
650
  group: string;
643
651
  device: string;
652
+ partUuid: string;
653
+ partLabel: string;
654
+ partType: string;
655
+ partFlags: string;
656
+ partStart: number | null;
657
+ };
658
+ export type DiskSpeedData = {
659
+ path: string;
660
+ fs: string;
661
+ sizeMB: number;
662
+ writeSpeed: number | null;
663
+ readSpeed: number | null;
664
+ ms: number;
644
665
  };
645
666
  export type FsStatsData = {
646
667
  rx: number;
@@ -664,6 +685,8 @@ export type DisksIoData = {
664
685
  rWaitPercent: number | null;
665
686
  wWaitPercent: number | null;
666
687
  tWaitPercent: number | null;
688
+ busyPercent: number | null;
689
+ idlePercent: number | null;
667
690
  ms: number;
668
691
  };
669
692
  export type SmartData = {
@@ -979,6 +1002,14 @@ export type NetworkInterfacesData = {
979
1002
  ieee8021xAuth: string;
980
1003
  ieee8021xState: string;
981
1004
  carrierChanges: number;
1005
+ bridgeMembers: string[];
1006
+ };
1007
+ export type NetworkRouteData = {
1008
+ destination: string;
1009
+ gateway: string;
1010
+ iface: string;
1011
+ metric: number | null;
1012
+ family: string;
982
1013
  };
983
1014
  export type NetworkStatsData = {
984
1015
  iface: string;
@@ -1053,6 +1084,7 @@ export type PciData = {
1053
1084
  subDeviceId: string;
1054
1085
  revision: string;
1055
1086
  driver: string;
1087
+ iommuGroup: string;
1056
1088
  };
1057
1089
  export type NpuData = {
1058
1090
  vendor: string;
@@ -45,6 +45,7 @@ declare class PowerShellPool {
45
45
  workers: PowerShellWorker[];
46
46
  _rr: number;
47
47
  _started: Promise<void> | null;
48
+ _generation: number;
48
49
  constructor({ size, env }?: {
49
50
  size?: number;
50
51
  env?: NodeJS.ProcessEnv;