systeminformation 5.33.3 → 6.0.0-beta.0
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 -957
- 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 +21 -0
- package/dist/bsd/os-info.js +38 -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/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 +299 -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 +1 -0
- package/dist/common/internet.js +47 -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 +992 -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 +1 -0
- package/dist/darwin/os-info.js +110 -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 +59 -0
- package/dist/index.js +130 -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/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 +2 -0
- package/dist/linux/gpu.js +273 -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 +104 -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 +1122 -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 +2 -0
- package/dist/windows/block-devices.js +48 -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 +112 -0
- package/dist/windows/disks-io.d.ts +2 -0
- package/dist/windows/disks-io.js +43 -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 +65 -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 -1832
- 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 -1321
- 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 -2824
- package/lib/virtualbox.js +0 -116
- package/lib/wifi.js +0 -839
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NetworkStatsData } from './types';
|
|
2
|
+
export declare const wifiDBFromQuality: (quality: string) => number | null;
|
|
3
|
+
export declare const wifiQualityFromDB: (db: number | string) => number | null;
|
|
4
|
+
export declare const wifiFrequencyFromChannel: (channel: number) => any;
|
|
5
|
+
export declare const wifiChannelFromFrequencies: (frequency: number) => number;
|
|
6
|
+
export declare const getFirstExternalNetworkInterface: (interfaces: any) => string;
|
|
7
|
+
export declare const testVirtualNic: (iface: string, ifaceName: string, mac: string) => boolean;
|
|
8
|
+
export declare const calcNetworkSpeed: (iface: string, rx_bytes: number, tx_bytes: number, rx_dropped: number, rx_errors: number, tx_dropped: number, tx_errors: number, operstate: string, _network: any) => NetworkStatsData;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calcNetworkSpeed = exports.testVirtualNic = exports.getFirstExternalNetworkInterface = exports.wifiChannelFromFrequencies = exports.wifiFrequencyFromChannel = exports.wifiQualityFromDB = exports.wifiDBFromQuality = void 0;
|
|
4
|
+
const defaults_1 = require("./defaults");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const mappings_1 = require("./mappings");
|
|
7
|
+
const wifiDBFromQuality = (quality) => {
|
|
8
|
+
const qual = parseFloat(quality);
|
|
9
|
+
if (Number.isNaN(qual)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (qual < 0) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
if (qual >= 100) {
|
|
16
|
+
return -50;
|
|
17
|
+
}
|
|
18
|
+
return qual / 2 - 100;
|
|
19
|
+
};
|
|
20
|
+
exports.wifiDBFromQuality = wifiDBFromQuality;
|
|
21
|
+
const wifiQualityFromDB = (db) => {
|
|
22
|
+
const dbValue = typeof db === 'number' ? db : parseFloat(db);
|
|
23
|
+
if (Number.isNaN(dbValue)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const result = 2 * (dbValue + 100);
|
|
27
|
+
return result <= 100 ? result : 100;
|
|
28
|
+
};
|
|
29
|
+
exports.wifiQualityFromDB = wifiQualityFromDB;
|
|
30
|
+
const wifiFrequencyFromChannel = (channel) => {
|
|
31
|
+
return Object.keys(mappings_1.wifiFrequencies).includes(String(channel)) ? mappings_1.wifiFrequencies[channel] : null;
|
|
32
|
+
};
|
|
33
|
+
exports.wifiFrequencyFromChannel = wifiFrequencyFromChannel;
|
|
34
|
+
const wifiChannelFromFrequencies = (frequency) => {
|
|
35
|
+
let channel = 0;
|
|
36
|
+
for (const key in mappings_1.wifiFrequencies) {
|
|
37
|
+
if (Object.keys(mappings_1.wifiFrequencies).includes(key)) {
|
|
38
|
+
if (mappings_1.wifiFrequencies[key] === frequency) {
|
|
39
|
+
channel = (0, index_1.toInt)(key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return channel;
|
|
44
|
+
};
|
|
45
|
+
exports.wifiChannelFromFrequencies = wifiChannelFromFrequencies;
|
|
46
|
+
const getFirstExternalNetworkInterface = (interfaces) => {
|
|
47
|
+
let ifacename = '';
|
|
48
|
+
let ifacenameFirst = '';
|
|
49
|
+
let scopeid = 9999;
|
|
50
|
+
for (const dev in interfaces) {
|
|
51
|
+
(interfaces[dev] || []).forEach((details) => {
|
|
52
|
+
if (details && details.internal === false) {
|
|
53
|
+
ifacenameFirst = ifacenameFirst || dev;
|
|
54
|
+
if (details.scopeid && details.scopeid < scopeid) {
|
|
55
|
+
ifacename = dev;
|
|
56
|
+
scopeid = details.scopeid;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return ifacename || ifacenameFirst || '';
|
|
62
|
+
};
|
|
63
|
+
exports.getFirstExternalNetworkInterface = getFirstExternalNetworkInterface;
|
|
64
|
+
const testVirtualNic = (iface, ifaceName, mac) => {
|
|
65
|
+
const virtualMacs = [
|
|
66
|
+
'00:00:00:00:00:00',
|
|
67
|
+
'00:03:FF',
|
|
68
|
+
'00:05:69',
|
|
69
|
+
'00:0C:29',
|
|
70
|
+
'00:0F:4B',
|
|
71
|
+
'00:13:07',
|
|
72
|
+
'00:13:BE',
|
|
73
|
+
'00:15:5d',
|
|
74
|
+
'00:16:3E',
|
|
75
|
+
'00:1C:42',
|
|
76
|
+
'00:21:F6',
|
|
77
|
+
'00:24:0B',
|
|
78
|
+
'00:50:56',
|
|
79
|
+
'00:A0:B1',
|
|
80
|
+
'00:E0:C8',
|
|
81
|
+
'08:00:27',
|
|
82
|
+
'0A:00:27',
|
|
83
|
+
'18:92:2C',
|
|
84
|
+
'16:DF:49',
|
|
85
|
+
'3C:F3:92',
|
|
86
|
+
'54:52:00',
|
|
87
|
+
'FC:15:97'
|
|
88
|
+
];
|
|
89
|
+
if (mac) {
|
|
90
|
+
return (virtualMacs.filter((item) => {
|
|
91
|
+
return mac.toUpperCase().startsWith(item.substring(0, mac.length));
|
|
92
|
+
}).length > 0 ||
|
|
93
|
+
iface.toLowerCase().indexOf(' virtual ') > -1 ||
|
|
94
|
+
ifaceName.toLowerCase().indexOf(' virtual ') > -1 ||
|
|
95
|
+
iface.toLowerCase().indexOf('vethernet ') > -1 ||
|
|
96
|
+
ifaceName.toLowerCase().indexOf('vethernet ') > -1 ||
|
|
97
|
+
iface.toLowerCase().startsWith('veth') ||
|
|
98
|
+
ifaceName.toLowerCase().startsWith('veth') ||
|
|
99
|
+
iface.toLowerCase().startsWith('vboxnet') ||
|
|
100
|
+
ifaceName.toLowerCase().startsWith('vboxnet'));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
exports.testVirtualNic = testVirtualNic;
|
|
107
|
+
const calcNetworkSpeed = (iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network) => {
|
|
108
|
+
const result = (0, index_1.cloneObj)(defaults_1.initNetworkSpeed);
|
|
109
|
+
let rx_sec = null;
|
|
110
|
+
let tx_sec = null;
|
|
111
|
+
let rx_bytes_intervall = 0;
|
|
112
|
+
let tx_bytes_intervall = 0;
|
|
113
|
+
let ms = 0;
|
|
114
|
+
if (_network[iface]?.ms) {
|
|
115
|
+
ms = Date.now() - _network[iface].ms;
|
|
116
|
+
rx_bytes_intervall = rx_bytes - _network[iface].rx_bytes;
|
|
117
|
+
tx_bytes_intervall = tx_bytes - _network[iface].tx_bytes;
|
|
118
|
+
rx_sec = rx_bytes_intervall >= 0 ? rx_bytes_intervall / (ms / 1000) : 0;
|
|
119
|
+
tx_sec = tx_bytes_intervall >= 0 ? tx_bytes_intervall / (ms / 1000) : 0;
|
|
120
|
+
_network[iface].rx_bytes = rx_bytes;
|
|
121
|
+
_network[iface].tx_bytes = tx_bytes;
|
|
122
|
+
_network[iface].rx_sec = rx_sec;
|
|
123
|
+
_network[iface].tx_sec = tx_sec;
|
|
124
|
+
_network[iface].rx_dropped = rx_dropped;
|
|
125
|
+
_network[iface].rx_errors = rx_errors;
|
|
126
|
+
_network[iface].tx_dropped = tx_dropped;
|
|
127
|
+
_network[iface].tx_errors = tx_errors;
|
|
128
|
+
_network[iface].ms = Date.now();
|
|
129
|
+
_network[iface].last_ms = result.ms;
|
|
130
|
+
_network[iface].operstate = operstate;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (!_network[iface]) {
|
|
134
|
+
_network[iface] = {};
|
|
135
|
+
}
|
|
136
|
+
_network[iface].rx_bytes = rx_bytes;
|
|
137
|
+
_network[iface].tx_bytes = tx_bytes;
|
|
138
|
+
_network[iface].rx_sec = null;
|
|
139
|
+
_network[iface].tx_sec = null;
|
|
140
|
+
_network[iface].rx_dropped = result.rx_dropped;
|
|
141
|
+
_network[iface].rx_errors = result.rx_errors;
|
|
142
|
+
_network[iface].tx_dropped = result.tx_dropped;
|
|
143
|
+
_network[iface].tx_errors = result.tx_errors;
|
|
144
|
+
_network[iface].ms = Date.now();
|
|
145
|
+
_network[iface].last_ms = 0;
|
|
146
|
+
_network[iface].operstate = operstate;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
iface,
|
|
150
|
+
operstate,
|
|
151
|
+
rx_bytes,
|
|
152
|
+
rx_dropped,
|
|
153
|
+
rx_errors,
|
|
154
|
+
tx_bytes,
|
|
155
|
+
tx_dropped,
|
|
156
|
+
tx_errors,
|
|
157
|
+
rx_sec,
|
|
158
|
+
tx_sec,
|
|
159
|
+
ms
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
exports.calcNetworkSpeed = calcNetworkSpeed;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GpuData, GpuNvidiaData } from './types';
|
|
2
|
+
export declare const getNvidiaSmi: () => Promise<string | null>;
|
|
3
|
+
export declare const nvidiaSmi: () => Promise<string>;
|
|
4
|
+
export declare const nvidiaDevices: () => Promise<({
|
|
5
|
+
driverVersion: string | undefined;
|
|
6
|
+
subDeviceId: string | undefined;
|
|
7
|
+
name: string | undefined;
|
|
8
|
+
pciBus: string | undefined;
|
|
9
|
+
fanSpeed: any;
|
|
10
|
+
memoryTotal: any;
|
|
11
|
+
memoryUsed: any;
|
|
12
|
+
memoryFree: any;
|
|
13
|
+
utilizationGpu: any;
|
|
14
|
+
utilizationMemory: any;
|
|
15
|
+
temperatureGpu: any;
|
|
16
|
+
temperatureMemory: any;
|
|
17
|
+
powerDraw: any;
|
|
18
|
+
powerLimit: any;
|
|
19
|
+
clockCore: any;
|
|
20
|
+
clockMemory: any;
|
|
21
|
+
} | null)[]>;
|
|
22
|
+
export declare const mergeControllerNvidia: (controller: GpuData, nvidia: GpuNvidiaData | any) => GpuData;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeControllerNvidia = exports.nvidiaDevices = exports.nvidiaSmi = exports.getNvidiaSmi = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const const_1 = require("./const");
|
|
6
|
+
const exec_1 = require("./exec");
|
|
7
|
+
const security_1 = require("./security");
|
|
8
|
+
let _nvidiaSmiPath = null;
|
|
9
|
+
const getNvidiaSmi = async () => {
|
|
10
|
+
if (_nvidiaSmiPath !== null) {
|
|
11
|
+
return _nvidiaSmiPath;
|
|
12
|
+
}
|
|
13
|
+
if (const_1.WINDOWS) {
|
|
14
|
+
const system32Path = String.raw `${const_1.WINDIR}\System32\nvidia-smi.exe`;
|
|
15
|
+
try {
|
|
16
|
+
await (0, promises_1.stat)(system32Path);
|
|
17
|
+
_nvidiaSmiPath = system32Path;
|
|
18
|
+
return _nvidiaSmiPath;
|
|
19
|
+
}
|
|
20
|
+
catch { }
|
|
21
|
+
try {
|
|
22
|
+
const basePath = String.raw `${const_1.WINDIR}\System32\DriverStore\FileRepository`;
|
|
23
|
+
let lastMod = 0;
|
|
24
|
+
for (const dir of await (0, promises_1.readdir)(basePath)) {
|
|
25
|
+
if (!dir.toLowerCase().startsWith('nv')) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const smiPath = [basePath, dir, 'nvidia-smi.exe'].join('\\');
|
|
29
|
+
try {
|
|
30
|
+
const stats = await (0, promises_1.stat)(smiPath);
|
|
31
|
+
if (stats.ctimeMs > lastMod) {
|
|
32
|
+
lastMod = stats.ctimeMs;
|
|
33
|
+
_nvidiaSmiPath = smiPath;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch { }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch { }
|
|
40
|
+
}
|
|
41
|
+
else if (const_1.LINUX) {
|
|
42
|
+
_nvidiaSmiPath = 'nvidia-smi';
|
|
43
|
+
}
|
|
44
|
+
return _nvidiaSmiPath;
|
|
45
|
+
};
|
|
46
|
+
exports.getNvidiaSmi = getNvidiaSmi;
|
|
47
|
+
const nvidiaSmi = async () => {
|
|
48
|
+
const nvidiaSmiExe = await (0, exports.getNvidiaSmi)();
|
|
49
|
+
if (nvidiaSmiExe) {
|
|
50
|
+
const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits';
|
|
51
|
+
const cmd = `${nvidiaSmiExe} ${nvidiaSmiOpts}`;
|
|
52
|
+
try {
|
|
53
|
+
const sanitized = (0, security_1.sanitizeShellString)(cmd) + (const_1.LINUX ? ' 2>/dev/null' : '') + (const_1.WINDOWS ? ' 2> nul' : '');
|
|
54
|
+
const { stdout } = await (0, exec_1.exec)(sanitized, const_1.execOptsWin);
|
|
55
|
+
return stdout;
|
|
56
|
+
}
|
|
57
|
+
catch { }
|
|
58
|
+
}
|
|
59
|
+
return '';
|
|
60
|
+
};
|
|
61
|
+
exports.nvidiaSmi = nvidiaSmi;
|
|
62
|
+
const safeParseNumber = (value) => {
|
|
63
|
+
if ([null, undefined].includes(value)) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
return Number.parseFloat(value);
|
|
67
|
+
};
|
|
68
|
+
const nvidiaDevices = async () => {
|
|
69
|
+
const stdout = await (0, exports.nvidiaSmi)();
|
|
70
|
+
if (!stdout) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const gpus = stdout.split('\n').filter(Boolean);
|
|
74
|
+
let results = gpus.map((gpu) => {
|
|
75
|
+
const splittedData = gpu.split(', ').map((value) => (value.includes('N/A') ? undefined : value));
|
|
76
|
+
if (splittedData.length === 16) {
|
|
77
|
+
return {
|
|
78
|
+
driverVersion: splittedData[0],
|
|
79
|
+
subDeviceId: splittedData[1],
|
|
80
|
+
name: splittedData[2],
|
|
81
|
+
pciBus: splittedData[3],
|
|
82
|
+
fanSpeed: safeParseNumber(splittedData[4]),
|
|
83
|
+
memoryTotal: safeParseNumber(splittedData[5]),
|
|
84
|
+
memoryUsed: safeParseNumber(splittedData[6]),
|
|
85
|
+
memoryFree: safeParseNumber(splittedData[7]),
|
|
86
|
+
utilizationGpu: safeParseNumber(splittedData[8]),
|
|
87
|
+
utilizationMemory: safeParseNumber(splittedData[9]),
|
|
88
|
+
temperatureGpu: safeParseNumber(splittedData[10]),
|
|
89
|
+
temperatureMemory: safeParseNumber(splittedData[11]),
|
|
90
|
+
powerDraw: safeParseNumber(splittedData[12]),
|
|
91
|
+
powerLimit: safeParseNumber(splittedData[13]),
|
|
92
|
+
clockCore: safeParseNumber(splittedData[14]),
|
|
93
|
+
clockMemory: safeParseNumber(splittedData[15])
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
results = results.filter((item) => {
|
|
101
|
+
return item !== null && 'pciBus' in item;
|
|
102
|
+
});
|
|
103
|
+
return results;
|
|
104
|
+
};
|
|
105
|
+
exports.nvidiaDevices = nvidiaDevices;
|
|
106
|
+
const mergeControllerNvidia = (controller, nvidia) => {
|
|
107
|
+
if (nvidia.driverVersion) {
|
|
108
|
+
controller.driverVersion = nvidia.driverVersion;
|
|
109
|
+
}
|
|
110
|
+
if (nvidia.subDeviceId) {
|
|
111
|
+
controller.subDeviceId = nvidia.subDeviceId;
|
|
112
|
+
}
|
|
113
|
+
if (nvidia.name) {
|
|
114
|
+
controller.name = nvidia.name;
|
|
115
|
+
}
|
|
116
|
+
if (nvidia.pciBus) {
|
|
117
|
+
controller.pciBus = nvidia.pciBus;
|
|
118
|
+
}
|
|
119
|
+
if (nvidia.fanSpeed) {
|
|
120
|
+
controller.fanSpeed = nvidia.fanSpeed;
|
|
121
|
+
}
|
|
122
|
+
if (nvidia.memoryTotal) {
|
|
123
|
+
controller.memoryTotal = nvidia.memoryTotal;
|
|
124
|
+
controller.vram = nvidia.memoryTotal;
|
|
125
|
+
controller.vramDynamic = false;
|
|
126
|
+
}
|
|
127
|
+
if (nvidia.memoryUsed) {
|
|
128
|
+
controller.memoryUsed = nvidia.memoryUsed;
|
|
129
|
+
}
|
|
130
|
+
if (nvidia.memoryFree) {
|
|
131
|
+
controller.memoryFree = nvidia.memoryFree;
|
|
132
|
+
}
|
|
133
|
+
if (nvidia.utilizationGpu) {
|
|
134
|
+
controller.utilizationGpu = nvidia.utilizationGpu;
|
|
135
|
+
}
|
|
136
|
+
if (nvidia.utilizationMemory) {
|
|
137
|
+
controller.utilizationMemory = nvidia.utilizationMemory;
|
|
138
|
+
}
|
|
139
|
+
if (nvidia.temperatureGpu) {
|
|
140
|
+
controller.temperatureGpu = nvidia.temperatureGpu;
|
|
141
|
+
}
|
|
142
|
+
if (nvidia.temperatureMemory) {
|
|
143
|
+
controller.temperatureMemory = nvidia.temperatureMemory;
|
|
144
|
+
}
|
|
145
|
+
if (nvidia.powerDraw) {
|
|
146
|
+
controller.powerDraw = nvidia.powerDraw;
|
|
147
|
+
}
|
|
148
|
+
if (nvidia.powerLimit) {
|
|
149
|
+
controller.powerLimit = nvidia.powerLimit;
|
|
150
|
+
}
|
|
151
|
+
if (nvidia.clockCore) {
|
|
152
|
+
controller.clockCore = nvidia.clockCore;
|
|
153
|
+
}
|
|
154
|
+
if (nvidia.clockMemory) {
|
|
155
|
+
controller.clockMemory = nvidia.clockMemory;
|
|
156
|
+
}
|
|
157
|
+
return controller;
|
|
158
|
+
};
|
|
159
|
+
exports.mergeControllerNvidia = mergeControllerNvidia;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CpuData, ProcStatData } from './types';
|
|
2
|
+
export type headerType = {
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
cap: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const parseHead: (head: string, rights: number) => headerType[];
|
|
8
|
+
export declare const parseProcStat: (line: string) => number;
|
|
9
|
+
export declare const calcProcStatLinux: (line: string, all: number, _cpu_old: CpuData) => ProcStatData;
|
|
10
|
+
export declare const parseJsonArray: (data: string) => any[];
|
|
11
|
+
export declare const cleanDefaults: (str: string) => string;
|
|
12
|
+
export declare const kFactor: (str: string) => number;
|
|
13
|
+
export declare const splitByNumber: (str: string) => string[];
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitByNumber = exports.kFactor = exports.cleanDefaults = exports.parseJsonArray = exports.calcProcStatLinux = exports.parseProcStat = exports.parseHead = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const parseHead = (head, rights) => {
|
|
6
|
+
let space = rights > 0;
|
|
7
|
+
let count = 1;
|
|
8
|
+
let from = 0;
|
|
9
|
+
let to = 0;
|
|
10
|
+
const result = [];
|
|
11
|
+
for (let i = 0; i < head.length; i++) {
|
|
12
|
+
if (count <= rights) {
|
|
13
|
+
if (/\s/.test(head[i]) && !space) {
|
|
14
|
+
to = i - 1;
|
|
15
|
+
result.push({
|
|
16
|
+
from: from,
|
|
17
|
+
to: to + 1,
|
|
18
|
+
cap: head.substring(from, to + 1)
|
|
19
|
+
});
|
|
20
|
+
from = to + 2;
|
|
21
|
+
count++;
|
|
22
|
+
}
|
|
23
|
+
space = head[i] === ' ';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (!/\s/.test(head[i]) && space) {
|
|
27
|
+
to = i - 1;
|
|
28
|
+
if (from < to) {
|
|
29
|
+
result.push({
|
|
30
|
+
from: from,
|
|
31
|
+
to: to,
|
|
32
|
+
cap: head.substring(from, to)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
from = to + 1;
|
|
36
|
+
count++;
|
|
37
|
+
}
|
|
38
|
+
space = head[i] === ' ';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
to = 5000;
|
|
42
|
+
result.push({
|
|
43
|
+
from: from,
|
|
44
|
+
to: to,
|
|
45
|
+
cap: head.substring(from, to)
|
|
46
|
+
});
|
|
47
|
+
let len = result.length;
|
|
48
|
+
for (let i = 0; i < len; i++) {
|
|
49
|
+
if (result[i].cap.replace(/\s/g, '').length === 0) {
|
|
50
|
+
if (i + 1 < len) {
|
|
51
|
+
result[i].to = result[i + 1].to;
|
|
52
|
+
result[i].cap = result[i].cap + result[i + 1].cap;
|
|
53
|
+
result.splice(i + 1, 1);
|
|
54
|
+
len = len - 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
exports.parseHead = parseHead;
|
|
61
|
+
const parseProcStat = (line) => {
|
|
62
|
+
const parts = line.replace(/ +/g, ' ').split(' ');
|
|
63
|
+
const user = parts.length >= 2 ? (0, index_1.toInt)(parts[1]) : 0;
|
|
64
|
+
const nice = parts.length >= 3 ? (0, index_1.toInt)(parts[2]) : 0;
|
|
65
|
+
const system = parts.length >= 4 ? (0, index_1.toInt)(parts[3]) : 0;
|
|
66
|
+
const idle = parts.length >= 5 ? (0, index_1.toInt)(parts[4]) : 0;
|
|
67
|
+
const iowait = parts.length >= 6 ? (0, index_1.toInt)(parts[5]) : 0;
|
|
68
|
+
const irq = parts.length >= 7 ? (0, index_1.toInt)(parts[6]) : 0;
|
|
69
|
+
const softirq = parts.length >= 8 ? (0, index_1.toInt)(parts[7]) : 0;
|
|
70
|
+
const steal = parts.length >= 9 ? (0, index_1.toInt)(parts[8]) : 0;
|
|
71
|
+
const guest = parts.length >= 10 ? (0, index_1.toInt)(parts[9]) : 0;
|
|
72
|
+
const guest_nice = parts.length >= 11 ? (0, index_1.toInt)(parts[10]) : 0;
|
|
73
|
+
return user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice;
|
|
74
|
+
};
|
|
75
|
+
exports.parseProcStat = parseProcStat;
|
|
76
|
+
const calcProcStatLinux = (line, all, _cpu_old) => {
|
|
77
|
+
const statparts = line.replace(/ +/g, ' ').split(')');
|
|
78
|
+
if (statparts.length >= 2) {
|
|
79
|
+
const parts = statparts[1].split(' ');
|
|
80
|
+
if (parts.length >= 16) {
|
|
81
|
+
const pid = (0, index_1.toInt)(statparts[0].split(' ')[0]);
|
|
82
|
+
const utime = (0, index_1.toInt)(parts[12]);
|
|
83
|
+
const stime = (0, index_1.toInt)(parts[13]);
|
|
84
|
+
const cutime = (0, index_1.toInt)(parts[14]);
|
|
85
|
+
const cstime = (0, index_1.toInt)(parts[15]);
|
|
86
|
+
let cpuu = 0;
|
|
87
|
+
let cpus = 0;
|
|
88
|
+
if (_cpu_old.all > 0 && _cpu_old.list[pid]) {
|
|
89
|
+
cpuu = ((utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all)) * 100;
|
|
90
|
+
cpus = ((stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all)) * 100;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
cpuu = ((utime + cutime) / all) * 100;
|
|
94
|
+
cpus = ((stime + cstime) / all) * 100;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
pid: pid,
|
|
98
|
+
name: '',
|
|
99
|
+
utime: utime,
|
|
100
|
+
stime: stime,
|
|
101
|
+
cutime: cutime,
|
|
102
|
+
cstime: cstime,
|
|
103
|
+
cpuu: cpuu,
|
|
104
|
+
cpus: cpus
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
pid: 0,
|
|
110
|
+
name: '',
|
|
111
|
+
utime: 0,
|
|
112
|
+
stime: 0,
|
|
113
|
+
cutime: 0,
|
|
114
|
+
cstime: 0,
|
|
115
|
+
cpuu: 0,
|
|
116
|
+
cpus: 0
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
exports.calcProcStatLinux = calcProcStatLinux;
|
|
120
|
+
const parseJsonArray = (data) => {
|
|
121
|
+
try {
|
|
122
|
+
const jsonData = JSON.parse(data);
|
|
123
|
+
return Array.isArray(jsonData) ? jsonData : [jsonData];
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.parseJsonArray = parseJsonArray;
|
|
130
|
+
const cleanDefaults = (str) => {
|
|
131
|
+
const cmpStr = str.toLowerCase();
|
|
132
|
+
if (cmpStr.indexOf('o.e.m.') === -1 && cmpStr.indexOf('default string') === -1 && cmpStr !== 'default') {
|
|
133
|
+
return str || '';
|
|
134
|
+
}
|
|
135
|
+
return '';
|
|
136
|
+
};
|
|
137
|
+
exports.cleanDefaults = cleanDefaults;
|
|
138
|
+
const kFactor = (str) => {
|
|
139
|
+
return str.indexOf('K') !== -1 ? 1024 : 1;
|
|
140
|
+
};
|
|
141
|
+
exports.kFactor = kFactor;
|
|
142
|
+
const splitByNumber = (str) => {
|
|
143
|
+
let numberStarted = false;
|
|
144
|
+
let num = '';
|
|
145
|
+
let cpart = '';
|
|
146
|
+
for (const c of str) {
|
|
147
|
+
if ((c >= '0' && c <= '9') || numberStarted) {
|
|
148
|
+
numberStarted = true;
|
|
149
|
+
num += c;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
cpart += c;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [cpart, num];
|
|
156
|
+
};
|
|
157
|
+
exports.splitByNumber = splitByNumber;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RaspberryFullRevisionData } from './types';
|
|
2
|
+
export declare const decodePiCpuinfo: (lines?: string[]) => RaspberryFullRevisionData;
|
|
3
|
+
export declare const isRaspberry: (cpuinfo?: string[]) => Promise<boolean>;
|
|
4
|
+
export declare const getRpiGpu: (cpuinfo?: string[]) => Promise<"" | "VideoCore VI" | "VideoCore VII" | "VideoCore IV">;
|
|
5
|
+
export declare const isRaspbian: () => Promise<boolean>;
|