systeminformation 6.0.0-beta.2 → 6.0.0-beta.20

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 (136) hide show
  1. package/README.md +67 -18
  2. package/dist/bsd/mem.js +8 -3
  3. package/dist/bsd/network-stats.d.ts +1 -1
  4. package/dist/bsd/network-stats.js +14 -7
  5. package/dist/bsd/os-info.d.ts +1 -0
  6. package/dist/common/darwin.d.ts +2 -0
  7. package/dist/common/darwin.js +17 -1
  8. package/dist/common/defaults.d.ts +2 -1
  9. package/dist/common/defaults.js +36 -6
  10. package/dist/common/exec.js +29 -13
  11. package/dist/common/files.d.ts +9 -0
  12. package/dist/common/files.js +67 -3
  13. package/dist/common/filesys.d.ts +30 -0
  14. package/dist/common/filesys.js +228 -11
  15. package/dist/common/host.js +55 -3
  16. package/dist/common/internet.js +31 -20
  17. package/dist/common/mappings.d.ts +0 -3
  18. package/dist/common/mappings.js +35 -14
  19. package/dist/common/network.d.ts +15 -2
  20. package/dist/common/network.js +18 -22
  21. package/dist/common/nvidia.d.ts +1 -1
  22. package/dist/common/nvidia.js +4 -5
  23. package/dist/common/parse.d.ts +4 -6
  24. package/dist/common/parse.js +24 -69
  25. package/dist/common/security.d.ts +2 -0
  26. package/dist/common/security.js +18 -3
  27. package/dist/common/types.d.ts +53 -5
  28. package/dist/common/windows.d.ts +4 -0
  29. package/dist/common/windows.js +57 -1
  30. package/dist/cpu-current-load.d.ts +1 -0
  31. package/dist/cpu-current-load.js +54 -8
  32. package/dist/cpu-current-speed.js +5 -3
  33. package/dist/darwin/battery.d.ts +1 -1
  34. package/dist/darwin/battery.js +15 -5
  35. package/dist/darwin/camera.js +3 -3
  36. package/dist/darwin/disk-layout.js +16 -12
  37. package/dist/darwin/disks-io.js +3 -3
  38. package/dist/darwin/displays.d.ts +1 -0
  39. package/dist/darwin/displays.js +64 -2
  40. package/dist/darwin/fans.d.ts +2 -0
  41. package/dist/darwin/fans.js +28 -0
  42. package/dist/darwin/gpu.js +1 -1
  43. package/dist/darwin/index.d.ts +3 -0
  44. package/dist/darwin/index.js +8 -2
  45. package/dist/darwin/keyboard.js +4 -4
  46. package/dist/darwin/mouse.js +4 -4
  47. package/dist/darwin/network-interfaces.d.ts +3 -0
  48. package/dist/darwin/network-interfaces.js +81 -14
  49. package/dist/darwin/network-stats.d.ts +1 -1
  50. package/dist/darwin/network-stats.js +14 -7
  51. package/dist/darwin/os-info.d.ts +2 -0
  52. package/dist/darwin/os-info.js +24 -2
  53. package/dist/darwin/process-focused.d.ts +3 -0
  54. package/dist/darwin/process-focused.js +26 -0
  55. package/dist/darwin/serial-ports.d.ts +2 -0
  56. package/dist/darwin/serial-ports.js +94 -0
  57. package/dist/darwin/users.js +1 -1
  58. package/dist/fans.d.ts +1 -0
  59. package/dist/fans.js +17 -0
  60. package/dist/get-data.d.ts +4 -0
  61. package/dist/get-data.js +6 -2
  62. package/dist/get.js +6 -1
  63. package/dist/index.d.ts +3 -0
  64. package/dist/index.js +8 -2
  65. package/dist/inet-public-ip.js +2 -1
  66. package/dist/linux/audio.js +59 -0
  67. package/dist/linux/baseboard.js +9 -20
  68. package/dist/linux/bios.js +6 -15
  69. package/dist/linux/block-devices.js +3 -1
  70. package/dist/linux/camera.js +2 -1
  71. package/dist/linux/chassis.js +4 -10
  72. package/dist/linux/cpu-temperature.js +34 -19
  73. package/dist/linux/cpu.js +3 -1
  74. package/dist/linux/disk-layout.js +9 -12
  75. package/dist/linux/disks-io.js +9 -9
  76. package/dist/linux/displays.d.ts +8 -0
  77. package/dist/linux/displays.js +151 -4
  78. package/dist/linux/fans.d.ts +2 -0
  79. package/dist/linux/fans.js +92 -0
  80. package/dist/linux/fs-size.d.ts +1 -1
  81. package/dist/linux/fs-size.js +164 -37
  82. package/dist/linux/fs-stats.js +6 -9
  83. package/dist/linux/gpu.d.ts +2 -0
  84. package/dist/linux/gpu.js +97 -22
  85. package/dist/linux/index.d.ts +3 -0
  86. package/dist/linux/index.js +8 -2
  87. package/dist/linux/mem-layout.js +3 -7
  88. package/dist/linux/mem.d.ts +1 -0
  89. package/dist/linux/mem.js +21 -1
  90. package/dist/linux/network-interfaces.d.ts +1 -0
  91. package/dist/linux/network-interfaces.js +154 -113
  92. package/dist/linux/network-stats.d.ts +1 -1
  93. package/dist/linux/network-stats.js +14 -40
  94. package/dist/linux/npu.js +2 -1
  95. package/dist/linux/os-info.js +56 -5
  96. package/dist/linux/printer.js +4 -4
  97. package/dist/linux/process-focused.d.ts +4 -0
  98. package/dist/linux/process-focused.js +32 -0
  99. package/dist/linux/process-load.js +11 -13
  100. package/dist/linux/processes.js +89 -80
  101. package/dist/linux/serial-ports.d.ts +2 -0
  102. package/dist/linux/serial-ports.js +102 -0
  103. package/dist/linux/services.js +182 -49
  104. package/dist/linux/system.js +1 -7
  105. package/dist/linux/users.js +1 -1
  106. package/dist/linux/uuid.js +4 -10
  107. package/dist/linux/wifi-networks.js +2 -2
  108. package/dist/network-interfaces.js +1 -1
  109. package/dist/process-focused.d.ts +1 -0
  110. package/dist/process-focused.js +17 -0
  111. package/dist/serial-ports.d.ts +1 -0
  112. package/dist/serial-ports.js +17 -0
  113. package/dist/versions.js +34 -80
  114. package/dist/windows/audio.d.ts +29 -0
  115. package/dist/windows/audio.js +151 -11
  116. package/dist/windows/disk-layout.js +3 -0
  117. package/dist/windows/disks-io.js +3 -3
  118. package/dist/windows/displays.d.ts +5 -0
  119. package/dist/windows/displays.js +101 -16
  120. package/dist/windows/fans.d.ts +2 -0
  121. package/dist/windows/fans.js +71 -0
  122. package/dist/windows/fs-size.js +1 -4
  123. package/dist/windows/gpu.js +3 -2
  124. package/dist/windows/index.d.ts +3 -0
  125. package/dist/windows/index.js +8 -2
  126. package/dist/windows/network-interfaces.js +36 -41
  127. package/dist/windows/network-stats.js +20 -6
  128. package/dist/windows/process-focused.d.ts +3 -0
  129. package/dist/windows/process-focused.js +36 -0
  130. package/dist/windows/process-load.js +7 -5
  131. package/dist/windows/processes.d.ts +1 -0
  132. package/dist/windows/processes.js +54 -26
  133. package/dist/windows/serial-ports.d.ts +3 -0
  134. package/dist/windows/serial-ports.js +73 -0
  135. package/dist/windows/services.js +4 -1
  136. package/package.json +1 -1
package/README.md CHANGED
@@ -49,6 +49,8 @@ in a browser.
49
49
  - `npu()` - detected NPUs / AI accelerators (experimental)
50
50
  - `software()` - installed software / applications
51
51
  - `npm()` - globally installed npm packages
52
+ - `fans()` - detected fans with rpm and pwm
53
+ - `serialPorts()` - detected serial / COM ports
52
54
 
53
55
  ### Extended Windows support
54
56
 
@@ -163,7 +165,7 @@ implementations can be tree-shaken away.
163
165
 
164
166
  - complete rewrite in TypeScript with typed declarations for every function
165
167
  - modular imports: load the whole library, a single operating system, or a single function
166
- - new functions: `camera()`, `keyboard()`, `mouse()`, `thunderbolt()`, `pci()`, `npu()`, `software()`, `npm()`
168
+ - new functions: `camera()`, `keyboard()`, `mouse()`, `thunderbolt()`, `pci()`, `npu()`, `software()`, `npm()`, `fans()`, `serialPorts()`
167
169
  - extended Windows support: `disksIO()`, `fsStats()`, `fsOpenFiles()`, `thunderbolt()`
168
170
  - `time()` and `version()` are now asynchronous - all functions are async (async/await preferred, promises as alternative)
169
171
  - callbacks are no longer supported
@@ -289,6 +291,12 @@ Full function reference with examples can be found at [https://systeminformation
289
291
  | | max | X | X | X | X | | max temperature |
290
292
  | | socket | X | | | | | array socket temperatures |
291
293
  | | chipset | X | | | | | chipset temperature |
294
+ | si.fans() | [{...}] | X | | X* | X* | | detected fans |
295
+ | | [0].id | X | | X* | X* | | identifier, e.g. hwmon2/fan1 |
296
+ | | [0].label | X | | X* | X* | | label if the driver provides one |
297
+ | | [0].rpm | X | | X* | X* | | speed in rpm (or null) |
298
+ | | [0].pwm | X | | X* | X* | | duty cycle in % (or null) |
299
+ | | [0].source | X | | X* | X* | | chip / provider the value came from |
292
300
  | si.npu() | [{...}] | X | | X | X | | detected NPUs / AI accelerators |
293
301
  | | [0].vendor | X | | X | X | | vendor (Intel, AMD, Apple, ...) |
294
302
  | | [0].name | X | | X | X | | name |
@@ -306,12 +314,12 @@ Full function reference with examples can be found at [https://systeminformation
306
314
  | | total | X | X | X | X | X | total memory in bytes |
307
315
  | | free | X | X | X | X | X | not used in bytes |
308
316
  | | used | X | X | X | X | X | used (incl. buffers/cache) |
309
- | | active | X | X | X | X | X | used actively (excl. buffers/cache) |
317
+ | | active | X | X | X | X | X | used actively (excl. buffers/cache and ZFS ARC) |
310
318
  | | buffcache | X | X | X | | X | used by buffers+cache |
311
319
  | | buffers | X | | | | | used by buffers |
312
320
  | | cached | X | | | | | used by cache |
313
321
  | | slab | X | | | | | used by slab |
314
- | | available | X | X | X | X | X | potentially available (total - active) |
322
+ | | available | X | X | X | X | X | potentially available (total - active), incl. reclaimable ZFS ARC |
315
323
  | | swaptotal | X | X | X | X | X | |
316
324
  | | swapused | X | X | X | X | X | |
317
325
  | | swapfree | X | X | X | X | X | |
@@ -357,6 +365,8 @@ In v6 the former `graphics()` function was split into `si.gpu()` (graphics contr
357
365
 
358
366
  On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode each mirrored monitor gets its own entry (sharing the resolution and position of the mirrored screen).
359
367
 
368
+ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boards. It is a device tree platform device rather than a PCI one, so `model`, `utilizationGpu`, `temperatureGpu` and `clockCore` are read from the Tegra sysfs nodes - neither `tegrastats` nor `jtop` is required. Its memory is shared with the system, so `vram` is `null` and `vramDynamic` is `true`.
369
+
360
370
  | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
361
371
  | ------------- | ---------------------- | ----- | --- | --- | --- | --- | --------------------------------- |
362
372
  | si.gpu() | [{...}] | X | | X | X | | array of graphics controllers |
@@ -365,8 +375,9 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
365
375
  | | [0].model | X | | X | X | | graphics controller model |
366
376
  | | [0].deviceId | | | X | | | device ID |
367
377
  | | [0].bus | X | | X | X | | on which bus (e.g. PCIe) |
368
- | | [0].vram | X | | X | X | | VRAM size (in MB) |
369
- | | [0].vramDynamic | X | | X | X | | true if dynamically allocated ram |
378
+ | | [0].busAddress | X | | | X | | PCI bus address, e.g. '01:00.0' |
379
+ | | [0].vram | X | | X | X | | VRAM size (in MB), `null` if shared |
380
+ | | [0].vramDynamic | X | | X | X | | true if dynamically allocated ram (integrated GPUs) |
370
381
  | | [0].external | | | X | | | is external GPU |
371
382
  | | [0].cores | | | X | | | Apple silicon only |
372
383
  | | [0].metalVersion | | | X | | | Apple Metal Version |
@@ -380,6 +391,7 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
380
391
  | | [0].serial | | | X | X | | serial number |
381
392
  | | [0].displayId | | | X | X | | display ID |
382
393
  | | [0].main | X | | X | X | | true if main monitor |
394
+ | | [0].mirror | X | | X | X | | true if mirrored / duplicated |
383
395
  | | [0].builtin | X | | X | | | true if built-in monitor |
384
396
  | | [0].connection | X | | X | X | | e.g. DisplayPort or HDMI |
385
397
  | | [0].sizeX | X | | | X | | size in mm horizontal |
@@ -391,7 +403,15 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
391
403
  | | [0].currentResY | X | | X | X | | current pixel vertical |
392
404
  | | [0].positionX | X | | X | X | | display position X |
393
405
  | | [0].positionY | X | | X | X | | display position Y |
406
+ | | [0].workAreaResolutionX | X | | X | X | | working area (screen minus task bar / panels / menu bar and Dock) resolution X |
407
+ | | [0].workAreaResolutionY | X | | X | X | | working area resolution Y |
408
+ | | [0].workAreaPositionX | X | | X | X | | working area position X |
409
+ | | [0].workAreaPositionY | X | | X | X | | working area position Y |
394
410
  | | [0].currentRefreshRate | X | | X | X | | current screen refresh rate |
411
+ | | [0].scale | | | | X | | DPI scaling factor, e.g. 1.5 |
412
+ | | [0].powerState | X | | | X | | 'on', 'standby', 'suspend', 'off' |
413
+ | | [0].gpu | | | X | X | | GPU model driving this display |
414
+ | | [0].gpuBusAddress | X | | | X | | PCI addr, joins gpu().busAddress |
395
415
 
396
416
  #### 7. Operating System
397
417
 
@@ -416,6 +436,7 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
416
436
  | | remoteSession | | | | X | | runs in remote session (win only) |
417
437
  | | installDate | X | | X | X | | OS installation date (Date object or null) |
418
438
  | | displayServer | X | X | X | X | X | display server e.g. wayland, x11, quartz, dwm, surfaceflinger or '' (headless) |
439
+ | | security | X | | X | | | mandatory access control / system integrity (module, enabled, mode, policy) |
419
440
  | si.uuid() | {...} | X | X | X | X | X | object of several UUIDs |
420
441
  | | os | X | X | X | X | | os specific UUID |
421
442
  | | hardware | X | X | X | X | | hardware specific UUID |
@@ -447,12 +468,13 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
447
468
  | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
448
469
  | -------------------------------- | ----------------- | ----- | --- | --- | --- | --- | --------------------------------------------------------------------------------------- |
449
470
  | si.currentLoad() | {...} | X | | X | X | X | CPU-Load |
450
- | | avgLoad | X | | X | | X | average load |
471
+ | | avgLoad | X | | X | X | X | average load<br>(Windows: approximated, see docs) |
451
472
  | | currentLoad | X | | X | X | X | CPU load in % |
452
473
  | | currentLoadUser | X | | X | X | X | CPU load user in % |
453
474
  | | currentLoadSystem | X | | X | X | X | CPU load system in % |
454
475
  | | currentLoadNice | X | | X | X | X | CPU load nice in % |
455
476
  | | currentLoadIdle | X | | X | X | X | CPU load idle in % |
477
+ | | currentLoadIowait | X | | | | | CPU load waiting for IO in % (Linux only, 0 elsewhere) |
456
478
  | | currentLoadIrq | X | | X | X | X | CPU load system in % |
457
479
  | | rawCurrentLoad... | X | | X | X | X | CPU load raw values (ticks) |
458
480
  | | cpus[] | X | | X | X | X | current loads per CPU in % + raw ticks |
@@ -470,6 +492,7 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
470
492
  | | ...[0].cpu | X | X | X | X | X | process % CPU usage |
471
493
  | | ...[0].cpuu | X | X | | X | | process % CPU usage (user) |
472
494
  | | ...[0].cpus | X | X | | X | | process % CPU usage (system) |
495
+ | | ...[0].cpuTime | X | X | X | X | X | process cpu time in seconds (own, without reaped children); null if not available |
473
496
  | | ...[0].mem | X | X | X | X | X | process memory % |
474
497
  | | ...[0].priority | X | X | X | X | X | process priority |
475
498
  | | ...[0].memVsz | X | X | X | X | X | process virtual memory size |
@@ -499,6 +522,10 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
499
522
  | | [0].pids | X | X | X | X | | pids |
500
523
  | | [0].cpu | X | X | X | | | process % CPU |
501
524
  | | [0].mem | X | X | X | | | process % MEM |
525
+ | si.processFocused() | {...} | X | | X | X | | process owning the currently focused window (X11 only on Linux); null if not detectable |
526
+ | | pid | X | | X | X | | PID of the focused process |
527
+ | | name | X | | X | X | | name of the focused process |
528
+ | | path | X | | X | X | | path of the focused process |
502
529
 
503
530
  #### 9. File System
504
531
 
@@ -523,7 +550,7 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
523
550
  | | [0].smartStatus | X | | X | X | | S.M.A.R.T Status (see Known Issues) |
524
551
  | | [0].temperature | X | | | | | S.M.A.R.T temperature |
525
552
  | | [0].smartData | X | | | X | | full S.M.A.R.T data from smartctl<br>requires at least smartmontools 7.0 |
526
- | si.blockDevices() | [{...}] | X | | X | X | | returns array of disks, partitions,<br>raids and roms |
553
+ | si.blockDevices() | [{...}] | X | | X | X | | returns array of disks, partitions,<br>raids, pools and roms |
527
554
  | | [0].name | X | | X | X | | name |
528
555
  | | [0].type | X | | X | X | | type |
529
556
  | | [0].fstype | X | | X | X | | file system type (e.g. ext4) |
@@ -536,18 +563,18 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
536
563
  | | [0].serial | X | | | X | | serial |
537
564
  | | [0].removable | X | | X | X | | serial |
538
565
  | | [0].protocol | X | | X | | | protocol (SATA, PCI-Express, ...) |
539
- | | [0].group | X | | | | | Raid group member (e.g. md1) |
566
+ | | [0].group | X | | | | | raid / pool member (e.g. md1, ZFS pool,<br>btrfs label) |
540
567
  | | [0].device | X | | X | X | | physical device mapped to (e.g. /dev/sda) |
541
568
  | si.disksIO() | {...} | X | | X | X | | current transfer stats |
542
569
  | | rIO | X | | X | X | | read IOs on all mounted drives |
543
570
  | | wIO | X | | X | X | | write IOs on all mounted drives |
544
571
  | | tIO | X | | X | X | | write IOs on all mounted drives |
545
- | | rIO_sec | X | | X | X | | read IO per sec (* see notes) |
546
- | | wIO_sec | X | | X | X | | write IO per sec (* see notes) |
547
- | | tIO_sec | X | | X | X | | total IO per sec (* see notes) |
548
- | | rWaitTime | X | | | | | read IO request time (* see notes) |
549
- | | wWaitTime | X | | | | | write IO request time (* see notes) |
550
- | | tWaitTime | X | | | | | total IO request time (* see notes) |
572
+ | | rIO_sec | X | | X | X | | read IO operations per sec, not bytes (* see notes) |
573
+ | | wIO_sec | X | | X | X | | write IO operations per sec, not bytes (* see notes) |
574
+ | | tIO_sec | X | | X | X | | total IO operations per sec, not bytes (* see notes) |
575
+ | | rWaitTime | X | | | | | read IO request time in ms during interval, null on 1st call (* notes) |
576
+ | | wWaitTime | X | | | | | write IO request time in ms during interval, null on 1st call (* notes) |
577
+ | | tWaitTime | X | | | | | total IO request time in ms during interval, null on 1st call (* notes) |
551
578
  | | rWaitPercent | X | | | | | read IO request time percent (* see notes) |
552
579
  | | wWaitPercent | X | | | | | write IO request time percent (* see notes) |
553
580
  | | tWaitPercent | X | | | | | total IO request time percent (* see notes) |
@@ -608,6 +635,15 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
608
635
  | | [0].maxPower | X | | | | | max power |
609
636
  | | [0].default | X | | X | X | | is default printer |
610
637
  | | [0].serialNumber | | | X | | | serial number |
638
+ | si.serialPorts() | [{...}] | X | | X | X | | detected serial / COM ports |
639
+ | | [0].device | X | | X | X | | device path (COMx on Windows) |
640
+ | | [0].name | X | | X | X | | product / friendly name |
641
+ | | [0].manufacturer | X | | X | X | | manufacturer |
642
+ | | [0].serialNumber | X | | X | X | | serial number (USB only) |
643
+ | | [0].vendorId | X | | X | X | | vendor id (hex) |
644
+ | | [0].productId | X | | X | X | | product id (hex) |
645
+ | | [0].pnpId | X | | | X | | stable id (by-id / DeviceID) |
646
+ | | [0].type | X | | X | X | | usb, onboard, pci, bluetooth |
611
647
 
612
648
  #### 11. Devices
613
649
 
@@ -649,11 +685,10 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
649
685
  | | [0].revision | X | | | | | revision |
650
686
  | | [0].driver | X | | | | | driver |
651
687
  | | [0].default | | | X | X | | is default |
652
- | | [0].channel | X | | X | | | channel e.g. USB, HDMI, ... |
688
+ | | [0].channel | X | | X | X | | channel e.g. USB, HDMI, ... |
653
689
  | | [0].type | X | | X | X | | type e.g. Speaker |
654
- | | [0].in | | | X | X | | is input channel |
655
- | | [0].out | | | X | X | | is output channel |
656
- | | [0].interfaceType | X | | X | X | | interface type (PCIe, USB, HDMI, ...) |
690
+ | | [0].in | X | | X | X | | is input channel |
691
+ | | [0].out | X | | X | X | | is output channel |
657
692
  | | [0].status | X | | X | X | | status (e.g. active) |
658
693
 
659
694
  #### 12. Network related functions
@@ -663,11 +698,14 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
663
698
  | si.networkInterfaces() | [{...}] | X | X | X | X | X | array of network interfaces<br>With the 'default' parameter it returns<br>only the default interface |
664
699
  | | [0].iface | X | X | X | X | X | interface |
665
700
  | | [0].ifaceName | X | X | X | X | X | interface name (differs on Windows) |
701
+ | | [0].vendor | X | | X | X | | network adapter vendor (not available for every adapter) |
702
+ | | [0].model | X | | X | X | | network adapter model (not available for every adapter) |
666
703
  | | [0].default | X | X | X | X | X | true if this is the default interface |
667
704
  | | [0].ip4 | X | X | X | X | X | ip4 address |
668
705
  | | [0].ip4subnet | X | X | X | X | X | ip4 subnet mask |
669
706
  | | [0].ip6 | X | X | X | X | X | ip6 address |
670
707
  | | [0].ip6subnet | X | X | X | X | X | ip6 subnet mask |
708
+ | | [0].gateway | X | X | X | X | | default gateway of this interface |
671
709
  | | [0].mac | X | X | X | X | X | MAC address |
672
710
  | | [0].internal | X | X | X | X | X | true if internal interface |
673
711
  | | [0].virtual | X | X | X | X | X | true if virtual interface |
@@ -687,9 +725,11 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
687
725
  | | [0].iface | X | X | X | X | | interface |
688
726
  | | [0].operstate | X | X | X | X | | up / down |
689
727
  | | [0].rx_bytes | X | X | X | X | | received bytes overall |
728
+ | | [0].rx_packets | X | X | X | X | | received packets overall |
690
729
  | | [0].rx_dropped | X | X | X | X | | received dropped overall |
691
730
  | | [0].rx_errors | X | X | X | X | | received errors overall |
692
731
  | | [0].tx_bytes | X | X | X | X | | transferred bytes overall |
732
+ | | [0].tx_packets | X | X | X | X | | transferred packets overall |
693
733
  | | [0].tx_dropped | X | X | X | X | | transferred dropped overall |
694
734
  | | [0].tx_errors | X | X | X | X | | transferred errors overall |
695
735
  | | [0].rx_sec | X | X | X | X | | received bytes / second (* see notes) |
@@ -1003,6 +1043,15 @@ $ npm install macos-temperature-sensor --save
1003
1043
 
1004
1044
  `systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`.
1005
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()`.
1047
+
1048
+ #### Windows - Fan Speed
1049
+
1050
+ Windows itself does not expose actual fan speeds: `Win32_Fan` only reports that a fan exists, its `DesiredSpeed` is the *requested* speed and is left empty by virtually every mainboard. Real values are read from a running [LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor) or OpenHardwareMonitor, which publish their sensors in an own WMI namespace. Without one of these tools running, `fans()` returns an empty array or entries without `rpm`.
1051
+
1052
+ #### Serial Ports
1053
+
1054
+ `serialPorts()` only *enumerates* ports - opening one (baud rate, termios, RTS toggling) needs a native binding and is out of scope for this zero-dependency library. Two things worth knowing: on Linux a port shows up in the list even when your user is not in the `dialout` / `uucp` group, so listing can succeed while opening fails; on Windows the `COMx` number is reassigned per USB port, so `pnpId` is the only stable key. RS-232 and RS-485 cannot be told apart by enumeration - an RS-485 transceiver looks like an ordinary UART to the operating system - so no such information is reported.
1006
1055
 
1007
1056
  #### Windows Temperature, Battery, ...
1008
1057
 
package/dist/bsd/mem.js CHANGED
@@ -8,7 +8,7 @@ const mem = async () => {
8
8
  await (0, common_1.nextTick)();
9
9
  const defaults = (0, common_1.cloneObj)(defaults_1.initMemData);
10
10
  try {
11
- const { stdout } = await (0, exec_1.execSave)('/sbin/sysctl -i hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size');
11
+ const { stdout } = await (0, exec_1.execSave)('/sbin/sysctl -i hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size kstat.zfs.misc.arcstats.size kstat.zfs.misc.arcstats.c_min');
12
12
  const lines = stdout.toString().split('\n');
13
13
  const pagesize = parseInt((0, common_1.getValue)(lines, 'vm.stats.vm.v_page_size'), 10);
14
14
  const inactive = parseInt((0, common_1.getValue)(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
@@ -19,13 +19,18 @@ const mem = async () => {
19
19
  if (isNaN(total)) {
20
20
  total = parseInt((0, common_1.getValue)(lines, 'hw.physmem'), 10);
21
21
  }
22
+ const arcSize = parseInt((0, common_1.getValue)(lines, 'kstat.zfs.misc.arcstats.size'), 10) || 0;
23
+ const arcMin = parseInt((0, common_1.getValue)(lines, 'kstat.zfs.misc.arcstats.c_min'), 10) || 0;
24
+ const arc = Math.max(arcSize - arcMin, 0);
25
+ const available = Math.min(total, buffcache + free + arc);
22
26
  return {
23
27
  ...defaults,
24
28
  total,
25
29
  free,
30
+ used: total - free,
26
31
  buffcache,
27
- available: buffcache + free,
28
- active: total - free - buffcache,
32
+ available,
33
+ active: total - available,
29
34
  swaptotal: 0,
30
35
  swapfree: 0,
31
36
  swapused: 0
@@ -1,2 +1,2 @@
1
- import { NetworkStatsData } from '../common/types';
1
+ import type { NetworkStatsData } from '../common/types';
2
2
  export declare const networkStats: (interfaces: string) => Promise<NetworkStatsData[]>;
@@ -1,30 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.networkStats = void 0;
4
- const exec_1 = require("../common/exec");
5
4
  const common_1 = require("../common");
6
- const security_1 = require("../common/security");
7
5
  const defaults_1 = require("../common/defaults");
8
- const darwin_1 = require("../darwin");
6
+ const exec_1 = require("../common/exec");
9
7
  const network_1 = require("../common/network");
10
- const _network = {};
8
+ const security_1 = require("../common/security");
9
+ const darwin_1 = require("../darwin");
10
+ const EXEC_OPTS = { timeout: 5000 };
11
+ const _network = Object.create(null);
11
12
  const networkStatsSingle = async (iface) => {
12
- const defaults = defaults_1.initNetworkSpeed;
13
+ const defaults = { ...defaults_1.initNetworkSpeed, iface };
13
14
  if (!_network[iface] || (_network[iface] && !_network[iface].ms) || (_network[iface] && _network[iface].ms && Date.now() - _network[iface].ms >= 500)) {
14
15
  let operstate = 'unknown';
15
16
  let rx_bytes = 0;
16
17
  let tx_bytes = 0;
18
+ let rx_packets = 0;
19
+ let tx_packets = 0;
17
20
  let rx_dropped = 0;
18
21
  let rx_errors = 0;
19
22
  let tx_dropped = 0;
20
23
  let tx_errors = 0;
21
- const { stdout } = await (0, exec_1.execSave)(`netstat -ibndI ${iface}`);
24
+ const stdout = await (0, exec_1.execSecure)('netstat', ['-ibndI', iface], EXEC_OPTS);
22
25
  if (stdout) {
23
26
  const lines = stdout.split('\n');
24
27
  for (let i = 1; i < lines.length; i++) {
25
28
  const line = lines[i].replace(/ +/g, ' ').split(' ');
26
29
  if (line && line[0] && line[7] && line[10]) {
27
30
  rx_bytes = rx_bytes + (0, common_1.toInt)(line[7]);
31
+ rx_packets = rx_packets + (0, common_1.toInt)(line[4]);
32
+ tx_packets = tx_packets + (0, common_1.toInt)(line[8]);
28
33
  if (line[6].trim() !== '-') {
29
34
  rx_dropped = rx_dropped + (0, common_1.toInt)(line[6]);
30
35
  }
@@ -41,7 +46,7 @@ const networkStatsSingle = async (iface) => {
41
46
  operstate = 'up';
42
47
  }
43
48
  }
44
- return (0, network_1.calcNetworkSpeed)(iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
49
+ return (0, network_1.calcNetworkSpeed)({ iface, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate }, _network);
45
50
  }
46
51
  return defaults;
47
52
  }
@@ -50,6 +55,8 @@ const networkStatsSingle = async (iface) => {
50
55
  ...defaults,
51
56
  rx_bytes: _network[iface].rx_bytes,
52
57
  tx_bytes: _network[iface].tx_bytes,
58
+ rx_packets: _network[iface].rx_packets,
59
+ tx_packets: _network[iface].tx_packets,
53
60
  rx_sec: _network[iface].rx_sec,
54
61
  tx_sec: _network[iface].tx_sec,
55
62
  rx_dropped: _network[iface].rx_dropped,
@@ -18,6 +18,7 @@ export declare const osInfo: () => Promise<import("../common/types").OsData | {
18
18
  installDate: Date | null;
19
19
  awake: boolean;
20
20
  hwAcceleration: string[];
21
+ security: import("../common/types").OsSecurityData;
21
22
  hypervizor?: boolean;
22
23
  remoteSession?: boolean;
23
24
  hypervisor?: boolean;
@@ -1,5 +1,7 @@
1
1
  import type { UserData } from './types';
2
2
  export declare const darwinXcodeExists: () => Promise<boolean>;
3
+ export declare const USB_DATA_TYPES: string[];
4
+ export declare const spItems: (data: any, dataTypes: string | string[]) => any[];
3
5
  export declare const plistParser: (xmlStr: string, items?: boolean) => any;
4
6
  export declare const formatBssid: (s: string) => string;
5
7
  export declare const plistReader: (output: string) => {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.darwinXcodeExists = void 0;
3
+ exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.spItems = exports.USB_DATA_TYPES = exports.darwinXcodeExists = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const promises_1 = require("fs/promises");
6
6
  const datetime_1 = require("./datetime");
@@ -14,6 +14,22 @@ const darwinXcodeExists = async () => {
14
14
  };
15
15
  exports.darwinXcodeExists = darwinXcodeExists;
16
16
  const isProtoKey = (key) => key === '__proto__' || key === 'constructor' || key === 'prototype';
17
+ exports.USB_DATA_TYPES = ['SPUSBDataType', 'SPUSBHostDataType'];
18
+ const spItems = (data, dataTypes) => {
19
+ const types = Array.isArray(dataTypes) ? dataTypes : [dataTypes];
20
+ const result = [];
21
+ if (!Array.isArray(data)) {
22
+ return result;
23
+ }
24
+ for (const dataType of types) {
25
+ const section = data.find((s) => s && s._dataType === dataType);
26
+ if (section && Array.isArray(section._items)) {
27
+ result.push(...section._items);
28
+ }
29
+ }
30
+ return result;
31
+ };
32
+ exports.spItems = spItems;
17
33
  const plistParser = (xmlStr, items = true) => {
18
34
  const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
19
35
  const startStr = '<plist version';
@@ -1,6 +1,7 @@
1
- import type { AudioData, BaseboardData, BatteryObject, BiosData, ChassisData, CpuCacheData, CpuObject, CpuTemperatureObject, DisksIoData, DisplayData, FsBlockDevicesData, FsOpenFilesData, FsStatsData, InetChecksiteData, MemData, NetworkInterfacesData, NetworkStatsData, NpuData, OsData, PciData, ProcessesData, SystemData, UsbData, UuidData } from './types';
1
+ import type { AudioData, BaseboardData, BatteryObject, BiosData, ChassisData, CpuCacheData, CpuObject, CpuTemperatureObject, DisksIoData, DisplayData, FsBlockDevicesData, FsOpenFilesData, FsStatsData, InetChecksiteData, MemData, NetworkInterfacesData, NetworkStatsData, NpuData, OsData, PciData, ProcessesData, SerialPortData, SystemData, UsbData, UuidData } from './types';
2
2
  export declare const initBatteryResult: BatteryObject;
3
3
  export declare const initAudioResult: AudioData;
4
+ export declare const initSerialPortResult: SerialPortData;
4
5
  export declare const initUsbResult: UsbData;
5
6
  export declare const initCpuResult: CpuObject;
6
7
  export declare const initCpuCacheResult: CpuCacheData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initNetworkSpeed = exports.initPciData = exports.initNpuData = exports.initNetworkInterface = exports.initProcesses = exports.initDisplay = exports.initDiskIo = exports.initFsStats = exports.initFsBlockDevice = exports.initFsOpenFiles = exports.initSystem = exports.initBios = exports.initBaseboard = exports.initChassis = exports.initUUID = exports.initOsInfo = exports.initMemData = exports.initCheckSite = exports.initCpuTemperature = exports.initCpuCacheResult = exports.initCpuResult = exports.initUsbResult = exports.initAudioResult = exports.initBatteryResult = void 0;
3
+ exports.initNetworkSpeed = exports.initPciData = exports.initNpuData = exports.initNetworkInterface = exports.initProcesses = exports.initDisplay = exports.initDiskIo = exports.initFsStats = exports.initFsBlockDevice = exports.initFsOpenFiles = exports.initSystem = exports.initBios = exports.initBaseboard = exports.initChassis = exports.initUUID = exports.initOsInfo = exports.initMemData = exports.initCheckSite = exports.initCpuTemperature = exports.initCpuCacheResult = exports.initCpuResult = exports.initUsbResult = exports.initSerialPortResult = exports.initAudioResult = exports.initBatteryResult = void 0;
4
4
  const node_os_1 = require("node:os");
5
5
  const acceleration_1 = require("./acceleration");
6
6
  const const_1 = require("./const");
@@ -34,6 +34,16 @@ exports.initAudioResult = {
34
34
  out: null,
35
35
  status: ''
36
36
  };
37
+ exports.initSerialPortResult = {
38
+ device: '',
39
+ name: null,
40
+ manufacturer: null,
41
+ serialNumber: null,
42
+ vendorId: null,
43
+ productId: null,
44
+ pnpId: null,
45
+ type: 'unknown'
46
+ };
37
47
  exports.initUsbResult = {
38
48
  id: null,
39
49
  bus: null,
@@ -125,7 +135,13 @@ const initOsInfo = async () => {
125
135
  lastUpdate: null,
126
136
  displayServer: '',
127
137
  awake: true,
128
- hwAcceleration: await (0, acceleration_1.hwAcceleration)()
138
+ hwAcceleration: await (0, acceleration_1.hwAcceleration)(),
139
+ security: {
140
+ module: '',
141
+ enabled: false,
142
+ mode: '',
143
+ policy: ''
144
+ }
129
145
  };
130
146
  };
131
147
  exports.initOsInfo = initOsInfo;
@@ -207,9 +223,9 @@ exports.initDiskIo = {
207
223
  rIO_sec: null,
208
224
  wIO_sec: null,
209
225
  tIO_sec: null,
210
- rWaitTime: 0,
211
- wWaitTime: 0,
212
- tWaitTime: 0,
226
+ rWaitTime: null,
227
+ wWaitTime: null,
228
+ tWaitTime: null,
213
229
  rWaitPercent: null,
214
230
  wWaitPercent: null,
215
231
  tWaitPercent: null,
@@ -224,6 +240,7 @@ exports.initDisplay = {
224
240
  deviceName: '',
225
241
  displayId: null,
226
242
  main: false,
243
+ mirror: false,
227
244
  builtin: false,
228
245
  connection: '',
229
246
  sizeX: null,
@@ -235,7 +252,15 @@ exports.initDisplay = {
235
252
  currentResY: null,
236
253
  positionX: 0,
237
254
  positionY: 0,
238
- currentRefreshRate: null
255
+ workAreaResolutionX: null,
256
+ workAreaResolutionY: null,
257
+ workAreaPositionX: null,
258
+ workAreaPositionY: null,
259
+ currentRefreshRate: null,
260
+ scale: null,
261
+ powerState: '',
262
+ gpu: '',
263
+ gpuBusAddress: ''
239
264
  };
240
265
  exports.initProcesses = {
241
266
  all: 0,
@@ -248,11 +273,14 @@ exports.initProcesses = {
248
273
  exports.initNetworkInterface = {
249
274
  iface: '',
250
275
  ifaceName: '',
276
+ vendor: '',
277
+ model: '',
251
278
  default: false,
252
279
  ip4: '',
253
280
  ip4subnet: '',
254
281
  ip6: '',
255
282
  ip6subnet: '',
283
+ gateway: '',
256
284
  mac: '',
257
285
  internal: true,
258
286
  virtual: false,
@@ -293,9 +321,11 @@ exports.initNetworkSpeed = {
293
321
  iface: '',
294
322
  operstate: '',
295
323
  rx_bytes: 0,
324
+ rx_packets: 0,
296
325
  rx_dropped: 0,
297
326
  rx_errors: 0,
298
327
  tx_bytes: 0,
328
+ tx_packets: 0,
299
329
  tx_dropped: 0,
300
330
  tx_errors: 0,
301
331
  rx_sec: null,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.execSave = exports.timeout = exports.execSecure = exports.shareInflight = exports.execFile = exports.exec = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_util_1 = require("node:util");
6
+ const const_1 = require("./const");
6
7
  exports.exec = (0, node_util_1.promisify)(node_child_process_1.exec);
7
8
  exports.execFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
8
9
  const _inflight = new Map();
@@ -17,35 +18,50 @@ const shareInflight = (key, fn) => {
17
18
  exports.shareInflight = shareInflight;
18
19
  const execSecure = (cmd, args, options) => {
19
20
  let result = '';
20
- options = options || {};
21
+ const { timeout: timeoutMs, ...spawnOptions } = options || {};
21
22
  return new Promise((resolve) => {
22
23
  process.nextTick(() => {
23
- try {
24
- const child = (0, node_child_process_1.spawn)(cmd, args, options);
25
- if (child && !child.pid) {
26
- child.on('error', () => {
27
- resolve(result);
28
- });
24
+ let timer = null;
25
+ const done = () => {
26
+ if (timer) {
27
+ clearTimeout(timer);
28
+ timer = null;
29
29
  }
30
+ resolve(result);
31
+ };
32
+ try {
33
+ const child = (0, node_child_process_1.spawn)(cmd, args, { stdio: ['pipe', 'pipe', 'ignore'], ...spawnOptions });
30
34
  if (child?.pid) {
35
+ if (timeoutMs) {
36
+ timer = setTimeout(() => {
37
+ child.kill('SIGKILL');
38
+ child.stdout?.destroy();
39
+ child.stderr?.destroy();
40
+ child.unref();
41
+ done();
42
+ }, timeoutMs);
43
+ }
31
44
  child.stdout.on('data', (data) => {
32
- result += data.toString();
45
+ if (result.length < const_1.MAX_BUFFER_SIZE) {
46
+ result = (result + data.toString()).substring(0, const_1.MAX_BUFFER_SIZE);
47
+ }
33
48
  });
34
49
  child.on('close', () => {
35
50
  child.kill();
36
- resolve(result);
51
+ done();
37
52
  });
38
53
  child.on('error', () => {
39
54
  child.kill();
40
- resolve(result);
55
+ done();
41
56
  });
42
57
  }
43
58
  else {
44
- resolve(result);
59
+ child?.on('error', () => done());
60
+ done();
45
61
  }
46
62
  }
47
63
  catch {
48
- resolve(result);
64
+ done();
49
65
  }
50
66
  });
51
67
  });
@@ -63,7 +79,7 @@ const execSave = async (cmd, options = {}) => {
63
79
  return { stdout: stdout.toString(), stderr: stderr.toString() };
64
80
  }
65
81
  catch (e) {
66
- return { stdout: e.stdout, stderr: e.stderr };
82
+ return { stdout: String(e.stdout ?? ''), stderr: String(e.stderr ?? '') };
67
83
  }
68
84
  };
69
85
  exports.execSave = execSave;
@@ -1,2 +1,11 @@
1
1
  export declare const getFilesInPath: (source: string) => Promise<string[]>;
2
2
  export declare const fileExists: (file: string) => Promise<boolean>;
3
+ export declare const readSysfs: (file: string) => Promise<string>;
4
+ export declare const readFileLines: (file: string) => Promise<string[]>;
5
+ export declare const readSysfsMany: (dir: string, names: string[]) => Promise<string[]>;
6
+ export declare const readProcStats: (pids: any[]) => Promise<{
7
+ all: string;
8
+ procs: string[];
9
+ }>;
10
+ export declare const readFileMax: (file: string, maxBytes?: number) => Promise<string>;
11
+ export declare const DMI_PATH = "/sys/devices/virtual/dmi/id";