systeminformation 5.33.5 → 6.0.0-beta.1
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.
- package/README.md +873 -958
- package/dist/audio.d.ts +1 -0
- package/dist/audio.js +18 -0
- package/dist/baseboard.d.ts +1 -0
- package/dist/baseboard.js +17 -0
- package/dist/battery.d.ts +1 -0
- package/dist/battery.js +19 -0
- package/dist/bios.d.ts +1 -0
- package/dist/bios.js +17 -0
- package/dist/block-devices.d.ts +1 -0
- package/dist/block-devices.js +17 -0
- package/dist/bluetooth.d.ts +1 -0
- package/dist/bluetooth.js +17 -0
- package/dist/bsd/battery.d.ts +2 -0
- package/dist/bsd/battery.js +27 -0
- package/dist/bsd/cpu-cache.d.ts +1 -0
- package/dist/bsd/cpu-cache.js +37 -0
- package/dist/bsd/cpu-flags.d.ts +1 -0
- package/dist/bsd/cpu-flags.js +28 -0
- package/dist/bsd/cpu-temperature.d.ts +1 -0
- package/dist/bsd/cpu-temperature.js +29 -0
- package/dist/bsd/cpu.d.ts +1 -0
- package/dist/bsd/cpu.js +98 -0
- package/dist/bsd/index.d.ts +38 -0
- package/dist/bsd/index.js +85 -0
- package/dist/bsd/mem.d.ts +1 -0
- package/dist/bsd/mem.js +37 -0
- package/dist/bsd/network-stats.d.ts +2 -0
- package/dist/bsd/network-stats.js +92 -0
- package/dist/bsd/os-info.d.ts +24 -0
- package/dist/bsd/os-info.js +47 -0
- package/dist/bsd/uuid.d.ts +2 -0
- package/dist/bsd/uuid.js +30 -0
- package/dist/camera.d.ts +1 -0
- package/dist/camera.js +17 -0
- package/dist/chassis.d.ts +1 -0
- package/dist/chassis.js +17 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +107 -0
- package/dist/common/acceleration.d.ts +8 -0
- package/dist/common/acceleration.js +86 -0
- package/dist/common/codepage.d.ts +1 -0
- package/dist/common/codepage.js +43 -0
- package/dist/common/const.d.ts +25 -0
- package/dist/common/const.js +26 -0
- package/dist/common/cpu.d.ts +2 -0
- package/dist/common/cpu.js +12 -0
- package/dist/common/darwin.d.ts +6 -0
- package/dist/common/darwin.js +266 -0
- package/dist/common/datetime.d.ts +9 -0
- package/dist/common/datetime.js +161 -0
- package/dist/common/defaults.d.ts +25 -0
- package/dist/common/defaults.js +304 -0
- package/dist/common/exec.d.ts +10 -0
- package/dist/common/exec.js +69 -0
- package/dist/common/files.d.ts +2 -0
- package/dist/common/files.js +39 -0
- package/dist/common/filesys.d.ts +11 -0
- package/dist/common/filesys.js +282 -0
- package/dist/common/host.d.ts +2 -0
- package/dist/common/host.js +67 -0
- package/dist/common/index.d.ts +12 -0
- package/dist/common/index.js +146 -0
- package/dist/common/internet.d.ts +6 -0
- package/dist/common/internet.js +92 -0
- package/dist/common/mappings.d.ts +55 -0
- package/dist/common/mappings.js +4133 -0
- package/dist/common/network.d.ts +8 -0
- package/dist/common/network.js +162 -0
- package/dist/common/nvidia.d.ts +22 -0
- package/dist/common/nvidia.js +159 -0
- package/dist/common/parse.d.ts +13 -0
- package/dist/common/parse.js +157 -0
- package/dist/common/raspberry.d.ts +5 -0
- package/dist/common/raspberry.js +277 -0
- package/dist/common/security.d.ts +31 -0
- package/dist/common/security.js +241 -0
- package/dist/common/types.d.ts +1024 -0
- package/dist/common/types.js +2 -0
- package/dist/common/windows.d.ts +58 -0
- package/dist/common/windows.js +292 -0
- package/dist/cpu-cache.d.ts +1 -0
- package/dist/cpu-cache.js +19 -0
- package/dist/cpu-current-load.d.ts +2 -0
- package/dist/cpu-current-load.js +249 -0
- package/dist/cpu-current-speed.d.ts +3 -0
- package/dist/cpu-current-speed.js +84 -0
- package/dist/cpu-flags.d.ts +1 -0
- package/dist/cpu-flags.js +19 -0
- package/dist/cpu-full-load.d.ts +1 -0
- package/dist/cpu-full-load.js +30 -0
- package/dist/cpu-temperature.d.ts +1 -0
- package/dist/cpu-temperature.js +19 -0
- package/dist/cpu.d.ts +1 -0
- package/dist/cpu.js +19 -0
- package/dist/darwin/audio.d.ts +2 -0
- package/dist/darwin/audio.js +46 -0
- package/dist/darwin/baseboard.d.ts +1 -0
- package/dist/darwin/baseboard.js +48 -0
- package/dist/darwin/battery.d.ts +2 -0
- package/dist/darwin/battery.js +65 -0
- package/dist/darwin/bios.d.ts +1 -0
- package/dist/darwin/bios.js +45 -0
- package/dist/darwin/block-devices.d.ts +2 -0
- package/dist/darwin/block-devices.js +101 -0
- package/dist/darwin/bluetooth.d.ts +3 -0
- package/dist/darwin/bluetooth.js +84 -0
- package/dist/darwin/camera.d.ts +2 -0
- package/dist/darwin/camera.js +55 -0
- package/dist/darwin/chassis.d.ts +2 -0
- package/dist/darwin/chassis.js +32 -0
- package/dist/darwin/cpu-cache.d.ts +2 -0
- package/dist/darwin/cpu-cache.js +29 -0
- package/dist/darwin/cpu-flags.d.ts +1 -0
- package/dist/darwin/cpu-flags.js +16 -0
- package/dist/darwin/cpu-temperature.d.ts +1 -0
- package/dist/darwin/cpu-temperature.js +44 -0
- package/dist/darwin/cpu.d.ts +1 -0
- package/dist/darwin/cpu.js +69 -0
- package/dist/darwin/disk-layout.d.ts +2 -0
- package/dist/darwin/disk-layout.js +231 -0
- package/dist/darwin/disks-io.d.ts +2 -0
- package/dist/darwin/disks-io.js +56 -0
- package/dist/darwin/displays.d.ts +2 -0
- package/dist/darwin/displays.js +98 -0
- package/dist/darwin/fs-open-files.d.ts +2 -0
- package/dist/darwin/fs-open-files.js +27 -0
- package/dist/darwin/fs-stats.d.ts +2 -0
- package/dist/darwin/fs-stats.js +47 -0
- package/dist/darwin/gpu.d.ts +2 -0
- package/dist/darwin/gpu.js +55 -0
- package/dist/darwin/index.d.ts +56 -0
- package/dist/darwin/index.js +122 -0
- package/dist/darwin/keyboard.d.ts +2 -0
- package/dist/darwin/keyboard.js +73 -0
- package/dist/darwin/mem-layout.d.ts +2 -0
- package/dist/darwin/mem-layout.js +60 -0
- package/dist/darwin/mem.d.ts +2 -0
- package/dist/darwin/mem.js +50 -0
- package/dist/darwin/mouse.d.ts +2 -0
- package/dist/darwin/mouse.js +78 -0
- package/dist/darwin/network-connections.d.ts +2 -0
- package/dist/darwin/network-connections.js +98 -0
- package/dist/darwin/network-gateway-default.d.ts +1 -0
- package/dist/darwin/network-gateway-default.js +26 -0
- package/dist/darwin/network-interface-default.d.ts +2 -0
- package/dist/darwin/network-interface-default.js +41 -0
- package/dist/darwin/network-interfaces.d.ts +2 -0
- package/dist/darwin/network-interfaces.js +205 -0
- package/dist/darwin/network-stats.d.ts +2 -0
- package/dist/darwin/network-stats.js +86 -0
- package/dist/darwin/npm.d.ts +1 -0
- package/dist/darwin/npm.js +5 -0
- package/dist/darwin/npu.d.ts +2 -0
- package/dist/darwin/npu.js +41 -0
- package/dist/darwin/os-info.d.ts +2 -0
- package/dist/darwin/os-info.js +140 -0
- package/dist/darwin/pci.d.ts +2 -0
- package/dist/darwin/pci.js +37 -0
- package/dist/darwin/printer.d.ts +2 -0
- package/dist/darwin/printer.js +45 -0
- package/dist/darwin/software.d.ts +2 -0
- package/dist/darwin/software.js +39 -0
- package/dist/darwin/system.d.ts +1 -0
- package/dist/darwin/system.js +29 -0
- package/dist/darwin/thunderbolt.d.ts +1 -0
- package/dist/darwin/thunderbolt.js +53 -0
- package/dist/darwin/usb.d.ts +3 -0
- package/dist/darwin/usb.js +69 -0
- package/dist/darwin/users.d.ts +2 -0
- package/dist/darwin/users.js +13 -0
- package/dist/darwin/uuid.d.ts +2 -0
- package/dist/darwin/uuid.js +39 -0
- package/dist/darwin/wifi-connections.d.ts +2 -0
- package/dist/darwin/wifi-connections.js +60 -0
- package/dist/darwin/wifi-interfaces.d.ts +2 -0
- package/dist/darwin/wifi-interfaces.js +27 -0
- package/dist/darwin/wifi-networks.d.ts +2 -0
- package/dist/darwin/wifi-networks.js +61 -0
- package/dist/disk-layout.d.ts +1 -0
- package/dist/disk-layout.js +17 -0
- package/dist/disks-io.d.ts +1 -0
- package/dist/disks-io.js +17 -0
- package/dist/displays.d.ts +1 -0
- package/dist/displays.js +17 -0
- package/dist/docker-socket.d.ts +11 -0
- package/dist/docker-socket.js +113 -0
- package/dist/docker.d.ts +102 -0
- package/dist/docker.js +532 -0
- package/dist/fs-open-files.d.ts +1 -0
- package/dist/fs-open-files.js +17 -0
- package/dist/fs-size.d.ts +1 -0
- package/dist/fs-size.js +23 -0
- package/dist/fs-stats.d.ts +1 -0
- package/dist/fs-stats.js +17 -0
- package/dist/get-data.d.ts +110 -0
- package/dist/get-data.js +151 -0
- package/dist/get.d.ts +5 -0
- package/dist/get.js +117 -0
- package/dist/gpu.d.ts +1 -0
- package/dist/gpu.js +17 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +132 -0
- package/dist/inet-checksite.d.ts +1 -0
- package/dist/inet-checksite.js +11 -0
- package/dist/inet-latency.d.ts +1 -0
- package/dist/inet-latency.js +17 -0
- package/dist/inet-public-ip.d.ts +2 -0
- package/dist/inet-public-ip.js +10 -0
- package/dist/keyboard.d.ts +1 -0
- package/dist/keyboard.js +17 -0
- package/dist/linux/audio.d.ts +2 -0
- package/dist/linux/audio.js +67 -0
- package/dist/linux/baseboard.d.ts +1 -0
- package/dist/linux/baseboard.js +81 -0
- package/dist/linux/battery.d.ts +2 -0
- package/dist/linux/battery.js +88 -0
- package/dist/linux/bios.d.ts +2 -0
- package/dist/linux/bios.js +55 -0
- package/dist/linux/block-devices.d.ts +2 -0
- package/dist/linux/block-devices.js +30 -0
- package/dist/linux/bluetooth.d.ts +2 -0
- package/dist/linux/bluetooth.js +86 -0
- package/dist/linux/camera.d.ts +2 -0
- package/dist/linux/camera.js +63 -0
- package/dist/linux/chassis.d.ts +1 -0
- package/dist/linux/chassis.js +41 -0
- package/dist/linux/cpu-cache.d.ts +1 -0
- package/dist/linux/cpu-cache.js +35 -0
- package/dist/linux/cpu-flags.d.ts +1 -0
- package/dist/linux/cpu-flags.js +33 -0
- package/dist/linux/cpu-temperature.d.ts +1 -0
- package/dist/linux/cpu-temperature.js +179 -0
- package/dist/linux/cpu.d.ts +1 -0
- package/dist/linux/cpu.js +135 -0
- package/dist/linux/disk-layout.d.ts +2 -0
- package/dist/linux/disk-layout.js +151 -0
- package/dist/linux/disks-io.d.ts +2 -0
- package/dist/linux/disks-io.js +58 -0
- package/dist/linux/displays.d.ts +2 -0
- package/dist/linux/displays.js +193 -0
- package/dist/linux/fs-open-files.d.ts +2 -0
- package/dist/linux/fs-open-files.js +44 -0
- package/dist/linux/fs-size.d.ts +2 -0
- package/dist/linux/fs-size.js +157 -0
- package/dist/linux/fs-stats.d.ts +2 -0
- package/dist/linux/fs-stats.js +65 -0
- package/dist/linux/gpu.d.ts +15 -0
- package/dist/linux/gpu.js +383 -0
- package/dist/linux/index.d.ts +56 -0
- package/dist/linux/index.js +122 -0
- package/dist/linux/inet-latency.d.ts +1 -0
- package/dist/linux/inet-latency.js +39 -0
- package/dist/linux/keyboard.d.ts +2 -0
- package/dist/linux/keyboard.js +61 -0
- package/dist/linux/mem-layout.d.ts +2 -0
- package/dist/linux/mem-layout.js +112 -0
- package/dist/linux/mem.d.ts +2 -0
- package/dist/linux/mem.js +61 -0
- package/dist/linux/mouse.d.ts +2 -0
- package/dist/linux/mouse.js +73 -0
- package/dist/linux/network-connections.d.ts +2 -0
- package/dist/linux/network-connections.js +114 -0
- package/dist/linux/network-gateway-default.d.ts +1 -0
- package/dist/linux/network-gateway-default.js +22 -0
- package/dist/linux/network-interface-default.d.ts +2 -0
- package/dist/linux/network-interface-default.js +46 -0
- package/dist/linux/network-interfaces.d.ts +3 -0
- package/dist/linux/network-interfaces.js +353 -0
- package/dist/linux/network-stats.d.ts +2 -0
- package/dist/linux/network-stats.js +99 -0
- package/dist/linux/npm.d.ts +1 -0
- package/dist/linux/npm.js +5 -0
- package/dist/linux/npu.d.ts +2 -0
- package/dist/linux/npu.js +77 -0
- package/dist/linux/os-info.d.ts +1 -0
- package/dist/linux/os-info.js +114 -0
- package/dist/linux/pci.d.ts +2 -0
- package/dist/linux/pci.js +56 -0
- package/dist/linux/printer.d.ts +2 -0
- package/dist/linux/printer.js +80 -0
- package/dist/linux/process-load.d.ts +2 -0
- package/dist/linux/process-load.js +164 -0
- package/dist/linux/processes.d.ts +2 -0
- package/dist/linux/processes.js +358 -0
- package/dist/linux/services.d.ts +2 -0
- package/dist/linux/services.js +222 -0
- package/dist/linux/software.d.ts +2 -0
- package/dist/linux/software.js +110 -0
- package/dist/linux/system.d.ts +1 -0
- package/dist/linux/system.js +186 -0
- package/dist/linux/thunderbolt.d.ts +2 -0
- package/dist/linux/thunderbolt.js +51 -0
- package/dist/linux/time.d.ts +6 -0
- package/dist/linux/time.js +28 -0
- package/dist/linux/usb.d.ts +2 -0
- package/dist/linux/usb.js +62 -0
- package/dist/linux/users.d.ts +2 -0
- package/dist/linux/users.js +102 -0
- package/dist/linux/uuid.d.ts +2 -0
- package/dist/linux/uuid.js +44 -0
- package/dist/linux/wifi-connections.d.ts +2 -0
- package/dist/linux/wifi-connections.js +196 -0
- package/dist/linux/wifi-interfaces.d.ts +2 -0
- package/dist/linux/wifi-interfaces.js +96 -0
- package/dist/linux/wifi-networks.d.ts +2 -0
- package/dist/linux/wifi-networks.js +176 -0
- package/dist/mem-layout.d.ts +1 -0
- package/dist/mem-layout.js +17 -0
- package/dist/mem.d.ts +1 -0
- package/dist/mem.js +19 -0
- package/dist/mouse.d.ts +1 -0
- package/dist/mouse.js +17 -0
- package/dist/network-connections.d.ts +1 -0
- package/dist/network-connections.js +17 -0
- package/dist/network-gateway-default.d.ts +1 -0
- package/dist/network-gateway-default.js +17 -0
- package/dist/network-interface-default.d.ts +1 -0
- package/dist/network-interface-default.js +17 -0
- package/dist/network-interfaces.d.ts +1 -0
- package/dist/network-interfaces.js +18 -0
- package/dist/network-stats.d.ts +1 -0
- package/dist/network-stats.js +19 -0
- package/dist/npm.d.ts +2 -0
- package/dist/npm.js +22 -0
- package/dist/npu.d.ts +1 -0
- package/dist/npu.js +17 -0
- package/dist/observe.d.ts +5 -0
- package/dist/observe.js +16 -0
- package/dist/os-info.d.ts +1 -0
- package/dist/os-info.js +21 -0
- package/dist/pci.d.ts +1 -0
- package/dist/pci.js +17 -0
- package/dist/printer.d.ts +1 -0
- package/dist/printer.js +17 -0
- package/dist/process-load.d.ts +1 -0
- package/dist/process-load.js +15 -0
- package/dist/processes.d.ts +1 -0
- package/dist/processes.js +15 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +15 -0
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +16 -0
- package/dist/software.d.ts +1 -0
- package/dist/software.js +17 -0
- package/dist/sun/index.d.ts +17 -0
- package/dist/sun/index.js +43 -0
- package/dist/sun/inet-latency.d.ts +1 -0
- package/dist/sun/inet-latency.js +30 -0
- package/dist/sun/os-info.d.ts +1 -0
- package/dist/sun/os-info.js +26 -0
- package/dist/sun/users.d.ts +2 -0
- package/dist/sun/users.js +13 -0
- package/dist/system.d.ts +1 -0
- package/dist/system.js +17 -0
- package/dist/thunderbolt.d.ts +1 -0
- package/dist/thunderbolt.js +17 -0
- package/dist/time.d.ts +6 -0
- package/dist/time.js +28 -0
- package/dist/usb.d.ts +1 -0
- package/dist/usb.js +17 -0
- package/dist/users.d.ts +1 -0
- package/dist/users.js +21 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +19 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +16 -0
- package/dist/versions.d.ts +2 -0
- package/dist/versions.js +1150 -0
- package/dist/virtualbox.d.ts +2 -0
- package/dist/virtualbox.js +89 -0
- package/dist/wifi-connections.d.ts +1 -0
- package/dist/wifi-connections.js +17 -0
- package/dist/wifi-interfaces.d.ts +1 -0
- package/dist/wifi-interfaces.js +17 -0
- package/dist/wifi-networks.d.ts +1 -0
- package/dist/wifi-networks.js +17 -0
- package/dist/windows/audio.d.ts +2 -0
- package/dist/windows/audio.js +23 -0
- package/dist/windows/baseboard.d.ts +1 -0
- package/dist/windows/baseboard.js +35 -0
- package/dist/windows/battery.d.ts +1 -0
- package/dist/windows/battery.js +81 -0
- package/dist/windows/bios.d.ts +1 -0
- package/dist/windows/bios.js +37 -0
- package/dist/windows/block-devices.d.ts +3 -0
- package/dist/windows/block-devices.js +58 -0
- package/dist/windows/bluetooth.d.ts +2 -0
- package/dist/windows/bluetooth.js +31 -0
- package/dist/windows/camera.d.ts +2 -0
- package/dist/windows/camera.js +47 -0
- package/dist/windows/chassis.d.ts +1 -0
- package/dist/windows/chassis.js +29 -0
- package/dist/windows/cpu-cache.d.ts +2 -0
- package/dist/windows/cpu-cache.js +59 -0
- package/dist/windows/cpu-flags.d.ts +1 -0
- package/dist/windows/cpu-flags.js +61 -0
- package/dist/windows/cpu-temperature.d.ts +1 -0
- package/dist/windows/cpu-temperature.js +32 -0
- package/dist/windows/cpu.d.ts +1 -0
- package/dist/windows/cpu.js +96 -0
- package/dist/windows/disk-layout.d.ts +2 -0
- package/dist/windows/disk-layout.js +129 -0
- package/dist/windows/disks-io.d.ts +2 -0
- package/dist/windows/disks-io.js +46 -0
- package/dist/windows/displays.d.ts +2 -0
- package/dist/windows/displays.js +213 -0
- package/dist/windows/fs-open-files.d.ts +2 -0
- package/dist/windows/fs-open-files.js +22 -0
- package/dist/windows/fs-size.d.ts +2 -0
- package/dist/windows/fs-size.js +47 -0
- package/dist/windows/fs-stats.d.ts +2 -0
- package/dist/windows/fs-stats.js +37 -0
- package/dist/windows/gpu.d.ts +2 -0
- package/dist/windows/gpu.js +128 -0
- package/dist/windows/index.d.ts +56 -0
- package/dist/windows/index.js +122 -0
- package/dist/windows/inet-latency.d.ts +1 -0
- package/dist/windows/inet-latency.js +34 -0
- package/dist/windows/keyboard.d.ts +2 -0
- package/dist/windows/keyboard.js +47 -0
- package/dist/windows/mem-layout.d.ts +2 -0
- package/dist/windows/mem-layout.js +39 -0
- package/dist/windows/mem.d.ts +2 -0
- package/dist/windows/mem.js +33 -0
- package/dist/windows/mouse.d.ts +2 -0
- package/dist/windows/mouse.js +64 -0
- package/dist/windows/network-connections.d.ts +2 -0
- package/dist/windows/network-connections.js +93 -0
- package/dist/windows/network-gateway-default.d.ts +1 -0
- package/dist/windows/network-gateway-default.js +36 -0
- package/dist/windows/network-interface-default.d.ts +2 -0
- package/dist/windows/network-interface-default.js +56 -0
- package/dist/windows/network-interfaces.d.ts +2 -0
- package/dist/windows/network-interfaces.js +346 -0
- package/dist/windows/network-stats.d.ts +2 -0
- package/dist/windows/network-stats.js +135 -0
- package/dist/windows/npm.d.ts +1 -0
- package/dist/windows/npm.js +5 -0
- package/dist/windows/npu.d.ts +2 -0
- package/dist/windows/npu.js +29 -0
- package/dist/windows/os-info.d.ts +1 -0
- package/dist/windows/os-info.js +70 -0
- package/dist/windows/pci.d.ts +2 -0
- package/dist/windows/pci.js +33 -0
- package/dist/windows/printer.d.ts +2 -0
- package/dist/windows/printer.js +36 -0
- package/dist/windows/process-load.d.ts +2 -0
- package/dist/windows/process-load.js +121 -0
- package/dist/windows/processes.d.ts +9 -0
- package/dist/windows/processes.js +139 -0
- package/dist/windows/services.d.ts +2 -0
- package/dist/windows/services.js +83 -0
- package/dist/windows/shell.d.ts +1 -0
- package/dist/windows/shell.js +19 -0
- package/dist/windows/software.d.ts +2 -0
- package/dist/windows/software.js +53 -0
- package/dist/windows/system.d.ts +1 -0
- package/dist/windows/system.js +98 -0
- package/dist/windows/thunderbolt.d.ts +2 -0
- package/dist/windows/thunderbolt.js +34 -0
- package/dist/windows/usb.d.ts +2 -0
- package/dist/windows/usb.js +37 -0
- package/dist/windows/users.d.ts +2 -0
- package/dist/windows/users.js +151 -0
- package/dist/windows/uuid.d.ts +2 -0
- package/dist/windows/uuid.js +28 -0
- package/dist/windows/wifi-connections.d.ts +2 -0
- package/dist/windows/wifi-connections.js +56 -0
- package/dist/windows/wifi-interfaces.d.ts +2 -0
- package/dist/windows/wifi-interfaces.js +45 -0
- package/dist/windows/wifi-networks.d.ts +2 -0
- package/dist/windows/wifi-networks.js +50 -0
- package/package.json +78 -12
- package/lib/audio.js +0 -277
- package/lib/battery.js +0 -334
- package/lib/bluetooth.js +0 -315
- package/lib/bluetoothVendors.js +0 -1138
- package/lib/cli.js +0 -100
- package/lib/cpu.js +0 -2285
- package/lib/docker.js +0 -791
- package/lib/dockerSocket.js +0 -117
- package/lib/filesystem.js +0 -1849
- package/lib/graphics.js +0 -1321
- package/lib/index.d.ts +0 -1051
- package/lib/index.js +0 -520
- package/lib/internet.js +0 -259
- package/lib/memory.js +0 -622
- package/lib/network.js +0 -2008
- package/lib/osinfo.js +0 -1322
- package/lib/printer.js +0 -209
- package/lib/processes.js +0 -1459
- package/lib/system.js +0 -855
- package/lib/usb.js +0 -309
- package/lib/users.js +0 -412
- package/lib/util.js +0 -2833
- package/lib/virtualbox.js +0 -116
- package/lib/wifi.js +0 -839
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
declare class PowerShellWorker {
|
|
2
|
+
exe: string;
|
|
3
|
+
env: NodeJS.ProcessEnv;
|
|
4
|
+
child: any;
|
|
5
|
+
pending: Map<string, {
|
|
6
|
+
resolve: (value: any) => void;
|
|
7
|
+
reject: (reason?: any) => void;
|
|
8
|
+
endMarker: string;
|
|
9
|
+
json: boolean;
|
|
10
|
+
__result?: string;
|
|
11
|
+
__ok?: boolean;
|
|
12
|
+
__timer?: ReturnType<typeof setTimeout>;
|
|
13
|
+
}>;
|
|
14
|
+
stdoutBuf: string;
|
|
15
|
+
stderrBuf: string;
|
|
16
|
+
queue: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
script: string;
|
|
19
|
+
endMarker: string;
|
|
20
|
+
resolve: (value: any) => void;
|
|
21
|
+
reject: (reason?: any) => void;
|
|
22
|
+
json: boolean;
|
|
23
|
+
__timer?: ReturnType<typeof setTimeout>;
|
|
24
|
+
}>;
|
|
25
|
+
busy: boolean;
|
|
26
|
+
dead: boolean;
|
|
27
|
+
constructor({ exe, env }: {
|
|
28
|
+
exe: string;
|
|
29
|
+
env: NodeJS.ProcessEnv;
|
|
30
|
+
});
|
|
31
|
+
start(): void;
|
|
32
|
+
_fail(err: Error): void;
|
|
33
|
+
stop(): void;
|
|
34
|
+
exec(script: string): Promise<any>;
|
|
35
|
+
_json(result: string): any;
|
|
36
|
+
_pump(): void;
|
|
37
|
+
_writeRaw(text: string): void;
|
|
38
|
+
_onStdout(chunk: string): void;
|
|
39
|
+
_onStderr(chunk: string): void;
|
|
40
|
+
}
|
|
41
|
+
declare class PowerShellPool {
|
|
42
|
+
size: number;
|
|
43
|
+
exe: string;
|
|
44
|
+
env: NodeJS.ProcessEnv;
|
|
45
|
+
workers: PowerShellWorker[];
|
|
46
|
+
_rr: number;
|
|
47
|
+
_started: Promise<void> | null;
|
|
48
|
+
constructor({ size, env }?: {
|
|
49
|
+
size?: number;
|
|
50
|
+
env?: NodeJS.ProcessEnv;
|
|
51
|
+
});
|
|
52
|
+
start(): Promise<void>;
|
|
53
|
+
exec(script: string): Promise<any>;
|
|
54
|
+
stop(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
export declare const psArray: (value: any) => any[];
|
|
57
|
+
export declare const ps: PowerShellPool;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ps = exports.psArray = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const files_1 = require("../common/files");
|
|
6
|
+
const const_1 = require("./const");
|
|
7
|
+
const WINDIR = process.env.WINDIR || String.raw `C:\Windows`;
|
|
8
|
+
const JOB_TIMEOUT_MS = 60000;
|
|
9
|
+
let _powerShell = '';
|
|
10
|
+
const pickPowerShellExecutable = async () => {
|
|
11
|
+
if (!const_1.WINDOWS)
|
|
12
|
+
return '';
|
|
13
|
+
if (!_powerShell) {
|
|
14
|
+
const defaultPath = String.raw `${WINDIR}\system32\WindowsPowerShell\v1.0\powershell.exe`;
|
|
15
|
+
if (await (0, files_1.fileExists)(defaultPath)) {
|
|
16
|
+
_powerShell = defaultPath;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
_powerShell = 'powershell.exe';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return _powerShell;
|
|
23
|
+
};
|
|
24
|
+
function splitLines(buffered) {
|
|
25
|
+
const lines = [];
|
|
26
|
+
let start = 0;
|
|
27
|
+
while (true) {
|
|
28
|
+
const idx = buffered.indexOf('\n', start);
|
|
29
|
+
if (idx === -1)
|
|
30
|
+
break;
|
|
31
|
+
let line = buffered.slice(start, idx);
|
|
32
|
+
if (line.endsWith('\r'))
|
|
33
|
+
line = line.slice(0, -1);
|
|
34
|
+
lines.push(line);
|
|
35
|
+
start = idx + 1;
|
|
36
|
+
}
|
|
37
|
+
return { lines, rest: buffered.slice(start) };
|
|
38
|
+
}
|
|
39
|
+
class PowerShellWorker {
|
|
40
|
+
exe;
|
|
41
|
+
env;
|
|
42
|
+
child;
|
|
43
|
+
pending;
|
|
44
|
+
stdoutBuf;
|
|
45
|
+
stderrBuf;
|
|
46
|
+
queue;
|
|
47
|
+
busy;
|
|
48
|
+
dead;
|
|
49
|
+
constructor({ exe, env }) {
|
|
50
|
+
this.exe = exe;
|
|
51
|
+
this.env = env;
|
|
52
|
+
this.child = null;
|
|
53
|
+
this.pending = new Map();
|
|
54
|
+
this.stdoutBuf = '';
|
|
55
|
+
this.stderrBuf = '';
|
|
56
|
+
this.queue = [];
|
|
57
|
+
this.busy = false;
|
|
58
|
+
this.dead = false;
|
|
59
|
+
}
|
|
60
|
+
start() {
|
|
61
|
+
if (this.child)
|
|
62
|
+
return;
|
|
63
|
+
const args = ['-NoLogo', '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', '-'];
|
|
64
|
+
this.child = (0, node_child_process_1.spawn)(this.exe, args, {
|
|
65
|
+
stdio: 'pipe',
|
|
66
|
+
windowsHide: true,
|
|
67
|
+
env: { ...process.env, ...this.env }
|
|
68
|
+
});
|
|
69
|
+
this.child.stdout.setEncoding('utf8');
|
|
70
|
+
this.child.stderr.setEncoding('utf8');
|
|
71
|
+
this.child.stdout.on('data', (chunk) => this._onStdout(chunk));
|
|
72
|
+
this.child.stderr.on('data', (chunk) => this._onStderr(chunk));
|
|
73
|
+
this.child.stdin.on('error', () => { });
|
|
74
|
+
this.child.on('error', (err) => this._fail(err));
|
|
75
|
+
this.child.on('close', (code, signal) => {
|
|
76
|
+
this._fail(new Error(`PowerShell exited (code=${code}, signal=${signal})`));
|
|
77
|
+
});
|
|
78
|
+
this._writeRaw('[Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n' + '$OutputEncoding = [System.Text.Encoding]::UTF8\n');
|
|
79
|
+
this.child.unref();
|
|
80
|
+
this.child.stdin.unref();
|
|
81
|
+
this.child.stdout.unref();
|
|
82
|
+
this.child.stderr.unref();
|
|
83
|
+
}
|
|
84
|
+
_fail(err) {
|
|
85
|
+
this.dead = true;
|
|
86
|
+
for (const job of this.pending.values()) {
|
|
87
|
+
if (job.__timer)
|
|
88
|
+
clearTimeout(job.__timer);
|
|
89
|
+
job.reject(err);
|
|
90
|
+
}
|
|
91
|
+
this.pending.clear();
|
|
92
|
+
for (const job of this.queue)
|
|
93
|
+
job.reject(err);
|
|
94
|
+
this.queue = [];
|
|
95
|
+
}
|
|
96
|
+
stop() {
|
|
97
|
+
if (!this.child)
|
|
98
|
+
return;
|
|
99
|
+
try {
|
|
100
|
+
this._writeRaw('exit\n');
|
|
101
|
+
this.child.stdin.end();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
try {
|
|
107
|
+
this.child.kill();
|
|
108
|
+
}
|
|
109
|
+
catch { }
|
|
110
|
+
this.child = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exec(script) {
|
|
114
|
+
const json = script.toLowerCase().includes('convertto-json');
|
|
115
|
+
if (this.dead)
|
|
116
|
+
return Promise.reject(new Error('Worker is dead'));
|
|
117
|
+
this.start();
|
|
118
|
+
const id = Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
119
|
+
const endMarker = `__PS_END__${id}__`;
|
|
120
|
+
return new Promise((resolve, reject) => {
|
|
121
|
+
this.queue.push({ id, script, endMarker, resolve, reject, json });
|
|
122
|
+
this._pump();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
_json(result) {
|
|
126
|
+
const trimmed = result.replace(/\r\n/g, '').trim();
|
|
127
|
+
if ((trimmed.startsWith('{') && trimmed.endsWith('}')) || (trimmed.startsWith('[') && trimmed.endsWith(']'))) {
|
|
128
|
+
try {
|
|
129
|
+
return JSON.parse(trimmed);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
_pump() {
|
|
138
|
+
if (this.busy || this.dead)
|
|
139
|
+
return;
|
|
140
|
+
const job = this.queue.shift();
|
|
141
|
+
if (!job)
|
|
142
|
+
return;
|
|
143
|
+
this.busy = true;
|
|
144
|
+
this.pending.set(job.id, job);
|
|
145
|
+
const scriptB64 = Buffer.from(job.script, 'utf8').toString('base64');
|
|
146
|
+
const wrapper = `
|
|
147
|
+
$__id = '${job.id}';
|
|
148
|
+
$__end = '${job.endMarker}';
|
|
149
|
+
$__b64 = '${scriptB64}';
|
|
150
|
+
$__script = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($__b64));
|
|
151
|
+
|
|
152
|
+
$ErrorActionPreference = 'Continue';
|
|
153
|
+
try {
|
|
154
|
+
# Evaluate script in a scriptblock; capture all streams.
|
|
155
|
+
# 'Continue' (v5 semantics): non-terminating errors become inline text and
|
|
156
|
+
# partial output of multi-statement scripts survives; only hard failures
|
|
157
|
+
# reach the catch block.
|
|
158
|
+
$__out = & ([ScriptBlock]::Create($__script)) *>&1 | Out-String;
|
|
159
|
+
$__ok = $true;
|
|
160
|
+
} catch {
|
|
161
|
+
$__out = ($_ | Out-String);
|
|
162
|
+
$__ok = $false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
$__payload = @{ id = $__id; ok = $__ok; out = $__out } | ConvertTo-Json -Compress;
|
|
166
|
+
[Console]::WriteLine($__payload);
|
|
167
|
+
[Console]::WriteLine($__end);
|
|
168
|
+
`;
|
|
169
|
+
try {
|
|
170
|
+
this._writeRaw(`${wrapper.replace(/\r?\n/g, '\n')}\n`);
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
this._fail(err instanceof Error ? err : new Error(String(err)));
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
this.child?.stdout?.ref();
|
|
177
|
+
job.__timer = setTimeout(() => {
|
|
178
|
+
if (this.pending.has(job.id)) {
|
|
179
|
+
this._fail(new Error(`PowerShell command timed out after ${JOB_TIMEOUT_MS} ms`));
|
|
180
|
+
try {
|
|
181
|
+
this.child?.kill();
|
|
182
|
+
}
|
|
183
|
+
catch { }
|
|
184
|
+
}
|
|
185
|
+
}, JOB_TIMEOUT_MS);
|
|
186
|
+
job.__timer.unref?.();
|
|
187
|
+
}
|
|
188
|
+
_writeRaw(text) {
|
|
189
|
+
if (!this.child?.stdin?.writable) {
|
|
190
|
+
throw new Error('PowerShell stdin not writable');
|
|
191
|
+
}
|
|
192
|
+
this.child.stdin.write(text, 'utf8');
|
|
193
|
+
}
|
|
194
|
+
_onStdout(chunk) {
|
|
195
|
+
this.stdoutBuf += chunk;
|
|
196
|
+
const { lines, rest } = splitLines(this.stdoutBuf);
|
|
197
|
+
this.stdoutBuf = rest;
|
|
198
|
+
for (const line of lines) {
|
|
199
|
+
if (line.startsWith('__PS_END__') && line.endsWith('__')) {
|
|
200
|
+
const id = line.slice('__PS_END__'.length, -'__'.length);
|
|
201
|
+
const job = this.pending.get(id);
|
|
202
|
+
if (job) {
|
|
203
|
+
if (job.__timer)
|
|
204
|
+
clearTimeout(job.__timer);
|
|
205
|
+
this.pending.delete(id);
|
|
206
|
+
this.busy = false;
|
|
207
|
+
if (job.__result != null) {
|
|
208
|
+
if (job.json)
|
|
209
|
+
job.resolve(job.__ok === false ? null : this._json(job.__result));
|
|
210
|
+
else
|
|
211
|
+
job.resolve(job.__result);
|
|
212
|
+
}
|
|
213
|
+
else
|
|
214
|
+
job.resolve(job.json ? null : '');
|
|
215
|
+
this._pump();
|
|
216
|
+
if (!this.busy)
|
|
217
|
+
this.child?.stdout?.unref();
|
|
218
|
+
}
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (line?.startsWith('{') && line.endsWith('}')) {
|
|
222
|
+
try {
|
|
223
|
+
const msg = JSON.parse(line);
|
|
224
|
+
const job = this.pending.get(msg.id);
|
|
225
|
+
if (job) {
|
|
226
|
+
job.__result = String(msg.out ?? '');
|
|
227
|
+
job.__ok = msg.ok !== false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch { }
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
_onStderr(chunk) {
|
|
235
|
+
this.stderrBuf = (this.stderrBuf + chunk).slice(-8192);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
class PowerShellPool {
|
|
239
|
+
size;
|
|
240
|
+
exe;
|
|
241
|
+
env;
|
|
242
|
+
workers;
|
|
243
|
+
_rr;
|
|
244
|
+
_started;
|
|
245
|
+
constructor({ size = 2, env = { LANG: 'en_US.UTF-8' } } = {}) {
|
|
246
|
+
this.size = Math.max(1, Math.trunc(size));
|
|
247
|
+
this.env = env;
|
|
248
|
+
this.workers = [];
|
|
249
|
+
this._rr = 0;
|
|
250
|
+
this.exe = '';
|
|
251
|
+
this._started = null;
|
|
252
|
+
}
|
|
253
|
+
start() {
|
|
254
|
+
if (!this._started) {
|
|
255
|
+
this._started = (async () => {
|
|
256
|
+
this.exe = await pickPowerShellExecutable();
|
|
257
|
+
for (let i = 0; i < this.size; i++) {
|
|
258
|
+
const w = new PowerShellWorker({ exe: this.exe, env: this.env });
|
|
259
|
+
w.start();
|
|
260
|
+
this.workers.push(w);
|
|
261
|
+
}
|
|
262
|
+
})().catch((err) => {
|
|
263
|
+
this._started = null;
|
|
264
|
+
throw err;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return this._started;
|
|
268
|
+
}
|
|
269
|
+
async exec(script) {
|
|
270
|
+
await this.start();
|
|
271
|
+
const idx = this._rr++ % this.workers.length;
|
|
272
|
+
let w = this.workers[idx];
|
|
273
|
+
if (w.dead) {
|
|
274
|
+
w = new PowerShellWorker({ exe: this.exe, env: this.env });
|
|
275
|
+
w.start();
|
|
276
|
+
this.workers[idx] = w;
|
|
277
|
+
}
|
|
278
|
+
return w.exec(script);
|
|
279
|
+
}
|
|
280
|
+
async stop() {
|
|
281
|
+
for (const w of this.workers)
|
|
282
|
+
w.stop();
|
|
283
|
+
this.workers = [];
|
|
284
|
+
this._started = null;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const psArray = (value) => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);
|
|
288
|
+
exports.psArray = psArray;
|
|
289
|
+
exports.ps = new PowerShellPool({ size: 4 });
|
|
290
|
+
if (const_1.WINDOWS) {
|
|
291
|
+
process.on('exit', () => exports.ps.stop());
|
|
292
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cpuCache: () => Promise<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cpuCache = void 0;
|
|
4
|
+
const const_1 = require("./common/const");
|
|
5
|
+
const cpuCache = async () => {
|
|
6
|
+
switch (true) {
|
|
7
|
+
case const_1.LINUX:
|
|
8
|
+
return (await import('./linux/cpu-cache.js')).cpuCache();
|
|
9
|
+
case const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD:
|
|
10
|
+
return (await import('./bsd/cpu-cache.js')).cpuCache();
|
|
11
|
+
case const_1.DARWIN:
|
|
12
|
+
return (await import('./darwin/cpu-cache.js')).cpuCache();
|
|
13
|
+
case const_1.WINDOWS:
|
|
14
|
+
return (await import('./windows/cpu-cache.js')).cpuCache();
|
|
15
|
+
default:
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.cpuCache = cpuCache;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.currentLoad = void 0;
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const const_1 = require("./common/const");
|
|
7
|
+
const exec_1 = require("./common/exec");
|
|
8
|
+
let _current_cpu = {
|
|
9
|
+
user: 0,
|
|
10
|
+
nice: 0,
|
|
11
|
+
system: 0,
|
|
12
|
+
idle: 0,
|
|
13
|
+
irq: 0,
|
|
14
|
+
steal: 0,
|
|
15
|
+
guest: 0,
|
|
16
|
+
load: 0,
|
|
17
|
+
tick: 0,
|
|
18
|
+
ms: 0,
|
|
19
|
+
currentLoad: 0,
|
|
20
|
+
currentLoadUser: 0,
|
|
21
|
+
currentLoadSystem: 0,
|
|
22
|
+
currentLoadNice: 0,
|
|
23
|
+
currentLoadIdle: 0,
|
|
24
|
+
currentLoadIrq: 0,
|
|
25
|
+
currentLoadSteal: 0,
|
|
26
|
+
currentLoadGuest: 0,
|
|
27
|
+
rawCurrentLoad: 0,
|
|
28
|
+
rawCurrentLoadUser: 0,
|
|
29
|
+
rawCurrentLoadSystem: 0,
|
|
30
|
+
rawCurrentLoadNice: 0,
|
|
31
|
+
rawCurrentLoadIdle: 0,
|
|
32
|
+
rawCurrentLoadIrq: 0,
|
|
33
|
+
rawCurrentLoadSteal: 0,
|
|
34
|
+
rawCurrentLoadGuest: 0
|
|
35
|
+
};
|
|
36
|
+
const _cpus = [];
|
|
37
|
+
let _corecount = 0;
|
|
38
|
+
const currentLoad = async () => {
|
|
39
|
+
await (0, common_1.nextTick)();
|
|
40
|
+
const loads = (0, node_os_1.loadavg)().map((x) => x / (0, node_os_1.cpus)().length);
|
|
41
|
+
const avgLoad = parseFloat(Math.max(...loads).toFixed(2));
|
|
42
|
+
let result = {
|
|
43
|
+
avgLoad: 0,
|
|
44
|
+
currentLoad: 0,
|
|
45
|
+
currentLoadUser: 0,
|
|
46
|
+
currentLoadSystem: 0,
|
|
47
|
+
currentLoadNice: 0,
|
|
48
|
+
currentLoadIdle: 0,
|
|
49
|
+
currentLoadIrq: 0,
|
|
50
|
+
currentLoadSteal: 0,
|
|
51
|
+
currentLoadGuest: 0,
|
|
52
|
+
rawCurrentLoad: 0,
|
|
53
|
+
rawCurrentLoadUser: 0,
|
|
54
|
+
rawCurrentLoadSystem: 0,
|
|
55
|
+
rawCurrentLoadNice: 0,
|
|
56
|
+
rawCurrentLoadIdle: 0,
|
|
57
|
+
rawCurrentLoadIrq: 0,
|
|
58
|
+
rawCurrentLoadSteal: 0,
|
|
59
|
+
rawCurrentLoadGuest: 0,
|
|
60
|
+
cpus: []
|
|
61
|
+
};
|
|
62
|
+
const now = Date.now() - _current_cpu.ms;
|
|
63
|
+
if (now >= 200) {
|
|
64
|
+
_current_cpu.ms = Date.now();
|
|
65
|
+
const cpus = (0, node_os_1.cpus)().map((cpu) => {
|
|
66
|
+
cpu.times.steal = 0;
|
|
67
|
+
cpu.times.guest = 0;
|
|
68
|
+
if (const_1.WINDOWS) {
|
|
69
|
+
cpu.times.sys = Math.max(0, cpu.times.sys - cpu.times.irq);
|
|
70
|
+
}
|
|
71
|
+
return cpu;
|
|
72
|
+
});
|
|
73
|
+
let totalUser = 0;
|
|
74
|
+
let totalSystem = 0;
|
|
75
|
+
let totalNice = 0;
|
|
76
|
+
let totalIrq = 0;
|
|
77
|
+
let totalIdle = 0;
|
|
78
|
+
let totalSteal = 0;
|
|
79
|
+
let totalGuest = 0;
|
|
80
|
+
const cores = [];
|
|
81
|
+
_corecount = cpus && cpus.length ? cpus.length : 0;
|
|
82
|
+
if (const_1.LINUX) {
|
|
83
|
+
try {
|
|
84
|
+
const { stdout } = await (0, exec_1.exec)('cat /proc/stat 2>/dev/null | grep cpu');
|
|
85
|
+
const lines = stdout.split('\n');
|
|
86
|
+
if (lines.length > 1) {
|
|
87
|
+
lines.shift();
|
|
88
|
+
if (lines.length === cpus.length) {
|
|
89
|
+
for (let i = 0; i < lines.length; i++) {
|
|
90
|
+
const parts = lines[i].split(' ');
|
|
91
|
+
if (parts.length >= 10) {
|
|
92
|
+
const steal = parseFloat(parts[8]) || 0;
|
|
93
|
+
const guest = parseFloat(parts[9]) || 0;
|
|
94
|
+
cpus[i].times.steal = steal;
|
|
95
|
+
cpus[i].times.guest = guest;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch { }
|
|
102
|
+
}
|
|
103
|
+
for (let i = 0; i < _corecount; i++) {
|
|
104
|
+
const cpu = cpus[i].times;
|
|
105
|
+
totalUser += cpu.user;
|
|
106
|
+
totalSystem += cpu.sys;
|
|
107
|
+
totalNice += cpu.nice;
|
|
108
|
+
totalIdle += cpu.idle;
|
|
109
|
+
totalIrq += cpu.irq;
|
|
110
|
+
totalSteal += cpu.steal || 0;
|
|
111
|
+
totalGuest += cpu.guest || 0;
|
|
112
|
+
const tmpTick = _cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0;
|
|
113
|
+
const tmpLoad = _cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0;
|
|
114
|
+
const tmpUser = _cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0;
|
|
115
|
+
const tmpSystem = _cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0;
|
|
116
|
+
const tmpNice = _cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0;
|
|
117
|
+
const tmpIdle = _cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0;
|
|
118
|
+
const tmpIrq = _cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0;
|
|
119
|
+
const tmpSteal = _cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0;
|
|
120
|
+
const tmpGuest = _cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0;
|
|
121
|
+
_cpus[i] = cpu;
|
|
122
|
+
_cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle;
|
|
123
|
+
_cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest;
|
|
124
|
+
_cpus[i].currentTick = _cpus[i].totalTick - tmpTick;
|
|
125
|
+
_cpus[i].load = _cpus[i].totalLoad - tmpLoad;
|
|
126
|
+
_cpus[i].loadUser = _cpus[i].user - tmpUser;
|
|
127
|
+
_cpus[i].loadSystem = _cpus[i].sys - tmpSystem;
|
|
128
|
+
_cpus[i].loadNice = _cpus[i].nice - tmpNice;
|
|
129
|
+
_cpus[i].loadIdle = _cpus[i].idle - tmpIdle;
|
|
130
|
+
_cpus[i].loadIrq = _cpus[i].irq - tmpIrq;
|
|
131
|
+
_cpus[i].loadSteal = _cpus[i].steal - tmpSteal;
|
|
132
|
+
_cpus[i].loadGuest = _cpus[i].guest - tmpGuest;
|
|
133
|
+
cores[i] = {};
|
|
134
|
+
const coreTick = _cpus[i].currentTick || 1;
|
|
135
|
+
cores[i].load = (_cpus[i].load / coreTick) * 100;
|
|
136
|
+
cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
|
|
137
|
+
cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
|
|
138
|
+
cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
|
|
139
|
+
cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
|
|
140
|
+
cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
|
|
141
|
+
cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
|
|
142
|
+
cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
|
|
143
|
+
cores[i].rawLoad = _cpus[i].load;
|
|
144
|
+
cores[i].rawLoadUser = _cpus[i].loadUser;
|
|
145
|
+
cores[i].rawLoadSystem = _cpus[i].loadSystem;
|
|
146
|
+
cores[i].rawLoadNice = _cpus[i].loadNice;
|
|
147
|
+
cores[i].rawLoadIdle = _cpus[i].loadIdle;
|
|
148
|
+
cores[i].rawLoadIrq = _cpus[i].loadIrq;
|
|
149
|
+
cores[i].rawLoadSteal = _cpus[i].loadSteal;
|
|
150
|
+
cores[i].rawLoadGuest = _cpus[i].loadGuest;
|
|
151
|
+
}
|
|
152
|
+
const totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle;
|
|
153
|
+
const totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest;
|
|
154
|
+
const currentTick = totalTick - _current_cpu.tick || 1;
|
|
155
|
+
result = {
|
|
156
|
+
avgLoad: avgLoad,
|
|
157
|
+
currentLoad: ((totalLoad - _current_cpu.load) / currentTick) * 100,
|
|
158
|
+
currentLoadUser: ((totalUser - _current_cpu.user) / currentTick) * 100,
|
|
159
|
+
currentLoadSystem: ((totalSystem - _current_cpu.system) / currentTick) * 100,
|
|
160
|
+
currentLoadNice: ((totalNice - _current_cpu.nice) / currentTick) * 100,
|
|
161
|
+
currentLoadIdle: ((totalIdle - _current_cpu.idle) / currentTick) * 100,
|
|
162
|
+
currentLoadIrq: ((totalIrq - _current_cpu.irq) / currentTick) * 100,
|
|
163
|
+
currentLoadSteal: ((totalSteal - _current_cpu.steal) / currentTick) * 100,
|
|
164
|
+
currentLoadGuest: ((totalGuest - _current_cpu.guest) / currentTick) * 100,
|
|
165
|
+
rawCurrentLoad: totalLoad - _current_cpu.load,
|
|
166
|
+
rawCurrentLoadUser: totalUser - _current_cpu.user,
|
|
167
|
+
rawCurrentLoadSystem: totalSystem - _current_cpu.system,
|
|
168
|
+
rawCurrentLoadNice: totalNice - _current_cpu.nice,
|
|
169
|
+
rawCurrentLoadIdle: totalIdle - _current_cpu.idle,
|
|
170
|
+
rawCurrentLoadIrq: totalIrq - _current_cpu.irq,
|
|
171
|
+
rawCurrentLoadSteal: totalSteal - _current_cpu.steal,
|
|
172
|
+
rawCurrentLoadGuest: totalGuest - _current_cpu.guest,
|
|
173
|
+
cpus: cores
|
|
174
|
+
};
|
|
175
|
+
_current_cpu = {
|
|
176
|
+
user: totalUser,
|
|
177
|
+
nice: totalNice,
|
|
178
|
+
system: totalSystem,
|
|
179
|
+
idle: totalIdle,
|
|
180
|
+
irq: totalIrq,
|
|
181
|
+
steal: totalSteal,
|
|
182
|
+
guest: totalGuest,
|
|
183
|
+
tick: totalTick,
|
|
184
|
+
load: totalLoad,
|
|
185
|
+
ms: _current_cpu.ms,
|
|
186
|
+
currentLoad: result.currentLoad,
|
|
187
|
+
currentLoadUser: result.currentLoadUser,
|
|
188
|
+
currentLoadSystem: result.currentLoadSystem,
|
|
189
|
+
currentLoadNice: result.currentLoadNice,
|
|
190
|
+
currentLoadIdle: result.currentLoadIdle,
|
|
191
|
+
currentLoadIrq: result.currentLoadIrq,
|
|
192
|
+
currentLoadSteal: result.currentLoadSteal,
|
|
193
|
+
currentLoadGuest: result.currentLoadGuest,
|
|
194
|
+
rawCurrentLoad: result.rawCurrentLoad,
|
|
195
|
+
rawCurrentLoadUser: result.rawCurrentLoadUser,
|
|
196
|
+
rawCurrentLoadSystem: result.rawCurrentLoadSystem,
|
|
197
|
+
rawCurrentLoadNice: result.rawCurrentLoadNice,
|
|
198
|
+
rawCurrentLoadIdle: result.rawCurrentLoadIdle,
|
|
199
|
+
rawCurrentLoadIrq: result.rawCurrentLoadIrq,
|
|
200
|
+
rawCurrentLoadSteal: result.rawCurrentLoadSteal,
|
|
201
|
+
rawCurrentLoadGuest: result.rawCurrentLoadGuest
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const cores = [];
|
|
206
|
+
for (let i = 0; i < _corecount; i++) {
|
|
207
|
+
cores[i] = {};
|
|
208
|
+
const coreTick = _cpus[i].currentTick || 1;
|
|
209
|
+
cores[i].load = (_cpus[i].load / coreTick) * 100;
|
|
210
|
+
cores[i].loadUser = (_cpus[i].loadUser / coreTick) * 100;
|
|
211
|
+
cores[i].loadSystem = (_cpus[i].loadSystem / coreTick) * 100;
|
|
212
|
+
cores[i].loadNice = (_cpus[i].loadNice / coreTick) * 100;
|
|
213
|
+
cores[i].loadIdle = (_cpus[i].loadIdle / coreTick) * 100;
|
|
214
|
+
cores[i].loadIrq = (_cpus[i].loadIrq / coreTick) * 100;
|
|
215
|
+
cores[i].loadSteal = (_cpus[i].loadSteal / coreTick) * 100;
|
|
216
|
+
cores[i].loadGuest = (_cpus[i].loadGuest / coreTick) * 100;
|
|
217
|
+
cores[i].rawLoad = _cpus[i].load;
|
|
218
|
+
cores[i].rawLoadUser = _cpus[i].loadUser;
|
|
219
|
+
cores[i].rawLoadSystem = _cpus[i].loadSystem;
|
|
220
|
+
cores[i].rawLoadNice = _cpus[i].loadNice;
|
|
221
|
+
cores[i].rawLoadIdle = _cpus[i].loadIdle;
|
|
222
|
+
cores[i].rawLoadIrq = _cpus[i].loadIrq;
|
|
223
|
+
cores[i].rawLoadSteal = _cpus[i].loadSteal;
|
|
224
|
+
cores[i].rawLoadGuest = _cpus[i].loadGuest;
|
|
225
|
+
}
|
|
226
|
+
result = {
|
|
227
|
+
avgLoad: avgLoad,
|
|
228
|
+
currentLoad: _current_cpu.currentLoad,
|
|
229
|
+
currentLoadUser: _current_cpu.currentLoadUser,
|
|
230
|
+
currentLoadSystem: _current_cpu.currentLoadSystem,
|
|
231
|
+
currentLoadNice: _current_cpu.currentLoadNice,
|
|
232
|
+
currentLoadIdle: _current_cpu.currentLoadIdle,
|
|
233
|
+
currentLoadIrq: _current_cpu.currentLoadIrq,
|
|
234
|
+
currentLoadSteal: _current_cpu.currentLoadSteal,
|
|
235
|
+
currentLoadGuest: _current_cpu.currentLoadGuest,
|
|
236
|
+
rawCurrentLoad: _current_cpu.rawCurrentLoad,
|
|
237
|
+
rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser,
|
|
238
|
+
rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem,
|
|
239
|
+
rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice,
|
|
240
|
+
rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle,
|
|
241
|
+
rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq,
|
|
242
|
+
rawCurrentLoadSteal: _current_cpu.rawCurrentLoadSteal,
|
|
243
|
+
rawCurrentLoadGuest: _current_cpu.rawCurrentLoadGuest,
|
|
244
|
+
cpus: cores
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
248
|
+
};
|
|
249
|
+
exports.currentLoad = currentLoad;
|