systeminformation 5.33.2 → 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.
Files changed (494) hide show
  1. package/README.md +882 -931
  2. package/dist/audio.d.ts +1 -0
  3. package/dist/audio.js +18 -0
  4. package/dist/baseboard.d.ts +1 -0
  5. package/dist/baseboard.js +17 -0
  6. package/dist/battery.d.ts +1 -0
  7. package/dist/battery.js +19 -0
  8. package/dist/bios.d.ts +1 -0
  9. package/dist/bios.js +17 -0
  10. package/dist/block-devices.d.ts +1 -0
  11. package/dist/block-devices.js +17 -0
  12. package/dist/bluetooth.d.ts +1 -0
  13. package/dist/bluetooth.js +17 -0
  14. package/dist/bsd/battery.d.ts +2 -0
  15. package/dist/bsd/battery.js +27 -0
  16. package/dist/bsd/cpu-cache.d.ts +1 -0
  17. package/dist/bsd/cpu-cache.js +37 -0
  18. package/dist/bsd/cpu-flags.d.ts +1 -0
  19. package/dist/bsd/cpu-flags.js +28 -0
  20. package/dist/bsd/cpu-temperature.d.ts +1 -0
  21. package/dist/bsd/cpu-temperature.js +29 -0
  22. package/dist/bsd/cpu.d.ts +1 -0
  23. package/dist/bsd/cpu.js +98 -0
  24. package/dist/bsd/index.d.ts +38 -0
  25. package/dist/bsd/index.js +85 -0
  26. package/dist/bsd/mem.d.ts +1 -0
  27. package/dist/bsd/mem.js +37 -0
  28. package/dist/bsd/network-stats.d.ts +2 -0
  29. package/dist/bsd/network-stats.js +92 -0
  30. package/dist/bsd/os-info.d.ts +21 -0
  31. package/dist/bsd/os-info.js +38 -0
  32. package/dist/bsd/uuid.d.ts +2 -0
  33. package/dist/bsd/uuid.js +30 -0
  34. package/dist/camera.d.ts +1 -0
  35. package/dist/camera.js +17 -0
  36. package/dist/chassis.d.ts +1 -0
  37. package/dist/chassis.js +17 -0
  38. package/dist/cli.d.ts +2 -0
  39. package/dist/cli.js +107 -0
  40. package/dist/common/codepage.d.ts +1 -0
  41. package/dist/common/codepage.js +43 -0
  42. package/dist/common/const.d.ts +25 -0
  43. package/dist/common/const.js +26 -0
  44. package/dist/common/cpu.d.ts +2 -0
  45. package/dist/common/cpu.js +12 -0
  46. package/dist/common/darwin.d.ts +6 -0
  47. package/dist/common/darwin.js +266 -0
  48. package/dist/common/datetime.d.ts +9 -0
  49. package/dist/common/datetime.js +161 -0
  50. package/dist/common/defaults.d.ts +25 -0
  51. package/dist/common/defaults.js +299 -0
  52. package/dist/common/exec.d.ts +10 -0
  53. package/dist/common/exec.js +69 -0
  54. package/dist/common/files.d.ts +2 -0
  55. package/dist/common/files.js +39 -0
  56. package/dist/common/filesys.d.ts +11 -0
  57. package/dist/common/filesys.js +282 -0
  58. package/dist/common/host.d.ts +2 -0
  59. package/dist/common/host.js +67 -0
  60. package/dist/common/index.d.ts +12 -0
  61. package/dist/common/index.js +146 -0
  62. package/dist/common/internet.d.ts +1 -0
  63. package/dist/common/internet.js +47 -0
  64. package/dist/common/mappings.d.ts +55 -0
  65. package/dist/common/mappings.js +4133 -0
  66. package/dist/common/network.d.ts +8 -0
  67. package/dist/common/network.js +162 -0
  68. package/dist/common/nvidia.d.ts +22 -0
  69. package/dist/common/nvidia.js +159 -0
  70. package/dist/common/parse.d.ts +13 -0
  71. package/dist/common/parse.js +157 -0
  72. package/dist/common/raspberry.d.ts +5 -0
  73. package/dist/common/raspberry.js +277 -0
  74. package/dist/common/security.d.ts +31 -0
  75. package/dist/common/security.js +241 -0
  76. package/dist/common/types.d.ts +992 -0
  77. package/dist/common/types.js +2 -0
  78. package/dist/common/windows.d.ts +58 -0
  79. package/dist/common/windows.js +292 -0
  80. package/dist/cpu-cache.d.ts +1 -0
  81. package/dist/cpu-cache.js +19 -0
  82. package/dist/cpu-current-load.d.ts +2 -0
  83. package/dist/cpu-current-load.js +249 -0
  84. package/dist/cpu-current-speed.d.ts +3 -0
  85. package/dist/cpu-current-speed.js +84 -0
  86. package/dist/cpu-flags.d.ts +1 -0
  87. package/dist/cpu-flags.js +19 -0
  88. package/dist/cpu-full-load.d.ts +1 -0
  89. package/dist/cpu-full-load.js +30 -0
  90. package/dist/cpu-temperature.d.ts +1 -0
  91. package/dist/cpu-temperature.js +19 -0
  92. package/dist/cpu.d.ts +1 -0
  93. package/dist/cpu.js +19 -0
  94. package/dist/darwin/audio.d.ts +2 -0
  95. package/dist/darwin/audio.js +46 -0
  96. package/dist/darwin/baseboard.d.ts +1 -0
  97. package/dist/darwin/baseboard.js +48 -0
  98. package/dist/darwin/battery.d.ts +2 -0
  99. package/dist/darwin/battery.js +65 -0
  100. package/dist/darwin/bios.d.ts +1 -0
  101. package/dist/darwin/bios.js +45 -0
  102. package/dist/darwin/block-devices.d.ts +2 -0
  103. package/dist/darwin/block-devices.js +101 -0
  104. package/dist/darwin/bluetooth.d.ts +3 -0
  105. package/dist/darwin/bluetooth.js +84 -0
  106. package/dist/darwin/camera.d.ts +2 -0
  107. package/dist/darwin/camera.js +55 -0
  108. package/dist/darwin/chassis.d.ts +2 -0
  109. package/dist/darwin/chassis.js +32 -0
  110. package/dist/darwin/cpu-cache.d.ts +2 -0
  111. package/dist/darwin/cpu-cache.js +29 -0
  112. package/dist/darwin/cpu-flags.d.ts +1 -0
  113. package/dist/darwin/cpu-flags.js +16 -0
  114. package/dist/darwin/cpu-temperature.d.ts +1 -0
  115. package/dist/darwin/cpu-temperature.js +44 -0
  116. package/dist/darwin/cpu.d.ts +1 -0
  117. package/dist/darwin/cpu.js +69 -0
  118. package/dist/darwin/disk-layout.d.ts +2 -0
  119. package/dist/darwin/disk-layout.js +231 -0
  120. package/dist/darwin/disks-io.d.ts +2 -0
  121. package/dist/darwin/disks-io.js +56 -0
  122. package/dist/darwin/displays.d.ts +2 -0
  123. package/dist/darwin/displays.js +98 -0
  124. package/dist/darwin/fs-open-files.d.ts +2 -0
  125. package/dist/darwin/fs-open-files.js +27 -0
  126. package/dist/darwin/fs-stats.d.ts +2 -0
  127. package/dist/darwin/fs-stats.js +47 -0
  128. package/dist/darwin/gpu.d.ts +2 -0
  129. package/dist/darwin/gpu.js +55 -0
  130. package/dist/darwin/index.d.ts +56 -0
  131. package/dist/darwin/index.js +122 -0
  132. package/dist/darwin/keyboard.d.ts +2 -0
  133. package/dist/darwin/keyboard.js +73 -0
  134. package/dist/darwin/mem-layout.d.ts +2 -0
  135. package/dist/darwin/mem-layout.js +60 -0
  136. package/dist/darwin/mem.d.ts +2 -0
  137. package/dist/darwin/mem.js +50 -0
  138. package/dist/darwin/mouse.d.ts +2 -0
  139. package/dist/darwin/mouse.js +78 -0
  140. package/dist/darwin/network-connections.d.ts +2 -0
  141. package/dist/darwin/network-connections.js +98 -0
  142. package/dist/darwin/network-gateway-default.d.ts +1 -0
  143. package/dist/darwin/network-gateway-default.js +26 -0
  144. package/dist/darwin/network-interface-default.d.ts +2 -0
  145. package/dist/darwin/network-interface-default.js +41 -0
  146. package/dist/darwin/network-interfaces.d.ts +2 -0
  147. package/dist/darwin/network-interfaces.js +205 -0
  148. package/dist/darwin/network-stats.d.ts +2 -0
  149. package/dist/darwin/network-stats.js +86 -0
  150. package/dist/darwin/npm.d.ts +1 -0
  151. package/dist/darwin/npm.js +5 -0
  152. package/dist/darwin/npu.d.ts +2 -0
  153. package/dist/darwin/npu.js +41 -0
  154. package/dist/darwin/os-info.d.ts +1 -0
  155. package/dist/darwin/os-info.js +110 -0
  156. package/dist/darwin/pci.d.ts +2 -0
  157. package/dist/darwin/pci.js +37 -0
  158. package/dist/darwin/printer.d.ts +2 -0
  159. package/dist/darwin/printer.js +45 -0
  160. package/dist/darwin/software.d.ts +2 -0
  161. package/dist/darwin/software.js +39 -0
  162. package/dist/darwin/system.d.ts +1 -0
  163. package/dist/darwin/system.js +29 -0
  164. package/dist/darwin/thunderbolt.d.ts +1 -0
  165. package/dist/darwin/thunderbolt.js +53 -0
  166. package/dist/darwin/usb.d.ts +3 -0
  167. package/dist/darwin/usb.js +69 -0
  168. package/dist/darwin/users.d.ts +2 -0
  169. package/dist/darwin/users.js +13 -0
  170. package/dist/darwin/uuid.d.ts +2 -0
  171. package/dist/darwin/uuid.js +39 -0
  172. package/dist/darwin/wifi-connections.d.ts +2 -0
  173. package/dist/darwin/wifi-connections.js +60 -0
  174. package/dist/darwin/wifi-interfaces.d.ts +2 -0
  175. package/dist/darwin/wifi-interfaces.js +27 -0
  176. package/dist/darwin/wifi-networks.d.ts +2 -0
  177. package/dist/darwin/wifi-networks.js +61 -0
  178. package/dist/disk-layout.d.ts +1 -0
  179. package/dist/disk-layout.js +17 -0
  180. package/dist/disks-io.d.ts +1 -0
  181. package/dist/disks-io.js +17 -0
  182. package/dist/displays.d.ts +1 -0
  183. package/dist/displays.js +17 -0
  184. package/dist/docker-socket.d.ts +11 -0
  185. package/dist/docker-socket.js +113 -0
  186. package/dist/docker.d.ts +102 -0
  187. package/dist/docker.js +532 -0
  188. package/dist/fs-open-files.d.ts +1 -0
  189. package/dist/fs-open-files.js +17 -0
  190. package/dist/fs-size.d.ts +1 -0
  191. package/dist/fs-size.js +23 -0
  192. package/dist/fs-stats.d.ts +1 -0
  193. package/dist/fs-stats.js +17 -0
  194. package/dist/get-data.d.ts +110 -0
  195. package/dist/get-data.js +151 -0
  196. package/dist/get.d.ts +5 -0
  197. package/dist/get.js +117 -0
  198. package/dist/gpu.d.ts +1 -0
  199. package/dist/gpu.js +17 -0
  200. package/dist/index.d.ts +59 -0
  201. package/dist/index.js +130 -0
  202. package/dist/inet-checksite.d.ts +1 -0
  203. package/dist/inet-checksite.js +11 -0
  204. package/dist/inet-latency.d.ts +1 -0
  205. package/dist/inet-latency.js +17 -0
  206. package/dist/keyboard.d.ts +1 -0
  207. package/dist/keyboard.js +17 -0
  208. package/dist/linux/audio.d.ts +2 -0
  209. package/dist/linux/audio.js +67 -0
  210. package/dist/linux/baseboard.d.ts +1 -0
  211. package/dist/linux/baseboard.js +81 -0
  212. package/dist/linux/battery.d.ts +2 -0
  213. package/dist/linux/battery.js +88 -0
  214. package/dist/linux/bios.d.ts +2 -0
  215. package/dist/linux/bios.js +55 -0
  216. package/dist/linux/block-devices.d.ts +2 -0
  217. package/dist/linux/block-devices.js +30 -0
  218. package/dist/linux/bluetooth.d.ts +2 -0
  219. package/dist/linux/bluetooth.js +86 -0
  220. package/dist/linux/camera.d.ts +2 -0
  221. package/dist/linux/camera.js +63 -0
  222. package/dist/linux/chassis.d.ts +1 -0
  223. package/dist/linux/chassis.js +41 -0
  224. package/dist/linux/cpu-cache.d.ts +1 -0
  225. package/dist/linux/cpu-cache.js +35 -0
  226. package/dist/linux/cpu-flags.d.ts +1 -0
  227. package/dist/linux/cpu-flags.js +33 -0
  228. package/dist/linux/cpu-temperature.d.ts +1 -0
  229. package/dist/linux/cpu-temperature.js +179 -0
  230. package/dist/linux/cpu.d.ts +1 -0
  231. package/dist/linux/cpu.js +135 -0
  232. package/dist/linux/disk-layout.d.ts +2 -0
  233. package/dist/linux/disk-layout.js +151 -0
  234. package/dist/linux/disks-io.d.ts +2 -0
  235. package/dist/linux/disks-io.js +58 -0
  236. package/dist/linux/displays.d.ts +2 -0
  237. package/dist/linux/displays.js +193 -0
  238. package/dist/linux/fs-open-files.d.ts +2 -0
  239. package/dist/linux/fs-open-files.js +44 -0
  240. package/dist/linux/fs-size.d.ts +2 -0
  241. package/dist/linux/fs-size.js +157 -0
  242. package/dist/linux/fs-stats.d.ts +2 -0
  243. package/dist/linux/fs-stats.js +65 -0
  244. package/dist/linux/gpu.d.ts +2 -0
  245. package/dist/linux/gpu.js +273 -0
  246. package/dist/linux/index.d.ts +56 -0
  247. package/dist/linux/index.js +122 -0
  248. package/dist/linux/inet-latency.d.ts +1 -0
  249. package/dist/linux/inet-latency.js +39 -0
  250. package/dist/linux/keyboard.d.ts +2 -0
  251. package/dist/linux/keyboard.js +61 -0
  252. package/dist/linux/mem-layout.d.ts +2 -0
  253. package/dist/linux/mem-layout.js +112 -0
  254. package/dist/linux/mem.d.ts +2 -0
  255. package/dist/linux/mem.js +61 -0
  256. package/dist/linux/mouse.d.ts +2 -0
  257. package/dist/linux/mouse.js +73 -0
  258. package/dist/linux/network-connections.d.ts +2 -0
  259. package/dist/linux/network-connections.js +114 -0
  260. package/dist/linux/network-gateway-default.d.ts +1 -0
  261. package/dist/linux/network-gateway-default.js +22 -0
  262. package/dist/linux/network-interface-default.d.ts +2 -0
  263. package/dist/linux/network-interface-default.js +46 -0
  264. package/dist/linux/network-interfaces.d.ts +3 -0
  265. package/dist/linux/network-interfaces.js +353 -0
  266. package/dist/linux/network-stats.d.ts +2 -0
  267. package/dist/linux/network-stats.js +99 -0
  268. package/dist/linux/npm.d.ts +1 -0
  269. package/dist/linux/npm.js +5 -0
  270. package/dist/linux/npu.d.ts +2 -0
  271. package/dist/linux/npu.js +77 -0
  272. package/dist/linux/os-info.d.ts +1 -0
  273. package/dist/linux/os-info.js +104 -0
  274. package/dist/linux/pci.d.ts +2 -0
  275. package/dist/linux/pci.js +56 -0
  276. package/dist/linux/printer.d.ts +2 -0
  277. package/dist/linux/printer.js +80 -0
  278. package/dist/linux/process-load.d.ts +2 -0
  279. package/dist/linux/process-load.js +164 -0
  280. package/dist/linux/processes.d.ts +2 -0
  281. package/dist/linux/processes.js +358 -0
  282. package/dist/linux/services.d.ts +2 -0
  283. package/dist/linux/services.js +222 -0
  284. package/dist/linux/software.d.ts +2 -0
  285. package/dist/linux/software.js +110 -0
  286. package/dist/linux/system.d.ts +1 -0
  287. package/dist/linux/system.js +186 -0
  288. package/dist/linux/thunderbolt.d.ts +2 -0
  289. package/dist/linux/thunderbolt.js +51 -0
  290. package/dist/linux/time.d.ts +6 -0
  291. package/dist/linux/time.js +28 -0
  292. package/dist/linux/usb.d.ts +2 -0
  293. package/dist/linux/usb.js +62 -0
  294. package/dist/linux/users.d.ts +2 -0
  295. package/dist/linux/users.js +102 -0
  296. package/dist/linux/uuid.d.ts +2 -0
  297. package/dist/linux/uuid.js +44 -0
  298. package/dist/linux/wifi-connections.d.ts +2 -0
  299. package/dist/linux/wifi-connections.js +196 -0
  300. package/dist/linux/wifi-interfaces.d.ts +2 -0
  301. package/dist/linux/wifi-interfaces.js +96 -0
  302. package/dist/linux/wifi-networks.d.ts +2 -0
  303. package/dist/linux/wifi-networks.js +176 -0
  304. package/dist/mem-layout.d.ts +1 -0
  305. package/dist/mem-layout.js +17 -0
  306. package/dist/mem.d.ts +1 -0
  307. package/dist/mem.js +19 -0
  308. package/dist/mouse.d.ts +1 -0
  309. package/dist/mouse.js +17 -0
  310. package/dist/network-connections.d.ts +1 -0
  311. package/dist/network-connections.js +17 -0
  312. package/dist/network-gateway-default.d.ts +1 -0
  313. package/dist/network-gateway-default.js +17 -0
  314. package/dist/network-interface-default.d.ts +1 -0
  315. package/dist/network-interface-default.js +17 -0
  316. package/dist/network-interfaces.d.ts +1 -0
  317. package/dist/network-interfaces.js +18 -0
  318. package/dist/network-stats.d.ts +1 -0
  319. package/dist/network-stats.js +19 -0
  320. package/dist/npm.d.ts +2 -0
  321. package/dist/npm.js +22 -0
  322. package/dist/npu.d.ts +1 -0
  323. package/dist/npu.js +17 -0
  324. package/dist/observe.d.ts +5 -0
  325. package/dist/observe.js +16 -0
  326. package/dist/os-info.d.ts +1 -0
  327. package/dist/os-info.js +21 -0
  328. package/dist/pci.d.ts +1 -0
  329. package/dist/pci.js +17 -0
  330. package/dist/printer.d.ts +1 -0
  331. package/dist/printer.js +17 -0
  332. package/dist/process-load.d.ts +1 -0
  333. package/dist/process-load.js +15 -0
  334. package/dist/processes.d.ts +1 -0
  335. package/dist/processes.js +15 -0
  336. package/dist/services.d.ts +1 -0
  337. package/dist/services.js +15 -0
  338. package/dist/shell.d.ts +1 -0
  339. package/dist/shell.js +16 -0
  340. package/dist/software.d.ts +1 -0
  341. package/dist/software.js +17 -0
  342. package/dist/sun/index.d.ts +17 -0
  343. package/dist/sun/index.js +43 -0
  344. package/dist/sun/inet-latency.d.ts +1 -0
  345. package/dist/sun/inet-latency.js +30 -0
  346. package/dist/sun/os-info.d.ts +1 -0
  347. package/dist/sun/os-info.js +26 -0
  348. package/dist/sun/users.d.ts +2 -0
  349. package/dist/sun/users.js +13 -0
  350. package/dist/system.d.ts +1 -0
  351. package/dist/system.js +17 -0
  352. package/dist/thunderbolt.d.ts +1 -0
  353. package/dist/thunderbolt.js +17 -0
  354. package/dist/time.d.ts +6 -0
  355. package/dist/time.js +28 -0
  356. package/dist/usb.d.ts +1 -0
  357. package/dist/usb.js +17 -0
  358. package/dist/users.d.ts +1 -0
  359. package/dist/users.js +21 -0
  360. package/dist/uuid.d.ts +1 -0
  361. package/dist/uuid.js +19 -0
  362. package/dist/version.d.ts +1 -0
  363. package/dist/version.js +16 -0
  364. package/dist/versions.d.ts +2 -0
  365. package/dist/versions.js +1122 -0
  366. package/dist/virtualbox.d.ts +2 -0
  367. package/dist/virtualbox.js +89 -0
  368. package/dist/wifi-connections.d.ts +1 -0
  369. package/dist/wifi-connections.js +17 -0
  370. package/dist/wifi-interfaces.d.ts +1 -0
  371. package/dist/wifi-interfaces.js +17 -0
  372. package/dist/wifi-networks.d.ts +1 -0
  373. package/dist/wifi-networks.js +17 -0
  374. package/dist/windows/audio.d.ts +2 -0
  375. package/dist/windows/audio.js +23 -0
  376. package/dist/windows/baseboard.d.ts +1 -0
  377. package/dist/windows/baseboard.js +35 -0
  378. package/dist/windows/battery.d.ts +1 -0
  379. package/dist/windows/battery.js +81 -0
  380. package/dist/windows/bios.d.ts +1 -0
  381. package/dist/windows/bios.js +37 -0
  382. package/dist/windows/block-devices.d.ts +2 -0
  383. package/dist/windows/block-devices.js +48 -0
  384. package/dist/windows/bluetooth.d.ts +2 -0
  385. package/dist/windows/bluetooth.js +31 -0
  386. package/dist/windows/camera.d.ts +2 -0
  387. package/dist/windows/camera.js +47 -0
  388. package/dist/windows/chassis.d.ts +1 -0
  389. package/dist/windows/chassis.js +29 -0
  390. package/dist/windows/cpu-cache.d.ts +2 -0
  391. package/dist/windows/cpu-cache.js +59 -0
  392. package/dist/windows/cpu-flags.d.ts +1 -0
  393. package/dist/windows/cpu-flags.js +61 -0
  394. package/dist/windows/cpu-temperature.d.ts +1 -0
  395. package/dist/windows/cpu-temperature.js +32 -0
  396. package/dist/windows/cpu.d.ts +1 -0
  397. package/dist/windows/cpu.js +96 -0
  398. package/dist/windows/disk-layout.d.ts +2 -0
  399. package/dist/windows/disk-layout.js +112 -0
  400. package/dist/windows/disks-io.d.ts +2 -0
  401. package/dist/windows/disks-io.js +43 -0
  402. package/dist/windows/displays.d.ts +2 -0
  403. package/dist/windows/displays.js +213 -0
  404. package/dist/windows/fs-open-files.d.ts +2 -0
  405. package/dist/windows/fs-open-files.js +22 -0
  406. package/dist/windows/fs-size.d.ts +2 -0
  407. package/dist/windows/fs-size.js +47 -0
  408. package/dist/windows/fs-stats.d.ts +2 -0
  409. package/dist/windows/fs-stats.js +37 -0
  410. package/dist/windows/gpu.d.ts +2 -0
  411. package/dist/windows/gpu.js +128 -0
  412. package/dist/windows/index.d.ts +56 -0
  413. package/dist/windows/index.js +122 -0
  414. package/dist/windows/inet-latency.d.ts +1 -0
  415. package/dist/windows/inet-latency.js +34 -0
  416. package/dist/windows/keyboard.d.ts +2 -0
  417. package/dist/windows/keyboard.js +47 -0
  418. package/dist/windows/mem-layout.d.ts +2 -0
  419. package/dist/windows/mem-layout.js +39 -0
  420. package/dist/windows/mem.d.ts +2 -0
  421. package/dist/windows/mem.js +33 -0
  422. package/dist/windows/mouse.d.ts +2 -0
  423. package/dist/windows/mouse.js +64 -0
  424. package/dist/windows/network-connections.d.ts +2 -0
  425. package/dist/windows/network-connections.js +93 -0
  426. package/dist/windows/network-gateway-default.d.ts +1 -0
  427. package/dist/windows/network-gateway-default.js +36 -0
  428. package/dist/windows/network-interface-default.d.ts +2 -0
  429. package/dist/windows/network-interface-default.js +56 -0
  430. package/dist/windows/network-interfaces.d.ts +2 -0
  431. package/dist/windows/network-interfaces.js +346 -0
  432. package/dist/windows/network-stats.d.ts +2 -0
  433. package/dist/windows/network-stats.js +135 -0
  434. package/dist/windows/npm.d.ts +1 -0
  435. package/dist/windows/npm.js +5 -0
  436. package/dist/windows/npu.d.ts +2 -0
  437. package/dist/windows/npu.js +29 -0
  438. package/dist/windows/os-info.d.ts +1 -0
  439. package/dist/windows/os-info.js +65 -0
  440. package/dist/windows/pci.d.ts +2 -0
  441. package/dist/windows/pci.js +33 -0
  442. package/dist/windows/printer.d.ts +2 -0
  443. package/dist/windows/printer.js +36 -0
  444. package/dist/windows/process-load.d.ts +2 -0
  445. package/dist/windows/process-load.js +121 -0
  446. package/dist/windows/processes.d.ts +9 -0
  447. package/dist/windows/processes.js +139 -0
  448. package/dist/windows/services.d.ts +2 -0
  449. package/dist/windows/services.js +83 -0
  450. package/dist/windows/shell.d.ts +1 -0
  451. package/dist/windows/shell.js +19 -0
  452. package/dist/windows/software.d.ts +2 -0
  453. package/dist/windows/software.js +53 -0
  454. package/dist/windows/system.d.ts +1 -0
  455. package/dist/windows/system.js +98 -0
  456. package/dist/windows/thunderbolt.d.ts +2 -0
  457. package/dist/windows/thunderbolt.js +34 -0
  458. package/dist/windows/usb.d.ts +2 -0
  459. package/dist/windows/usb.js +37 -0
  460. package/dist/windows/users.d.ts +2 -0
  461. package/dist/windows/users.js +151 -0
  462. package/dist/windows/uuid.d.ts +2 -0
  463. package/dist/windows/uuid.js +28 -0
  464. package/dist/windows/wifi-connections.d.ts +2 -0
  465. package/dist/windows/wifi-connections.js +56 -0
  466. package/dist/windows/wifi-interfaces.d.ts +2 -0
  467. package/dist/windows/wifi-interfaces.js +45 -0
  468. package/dist/windows/wifi-networks.d.ts +2 -0
  469. package/dist/windows/wifi-networks.js +50 -0
  470. package/package.json +78 -12
  471. package/lib/audio.js +0 -277
  472. package/lib/battery.js +0 -334
  473. package/lib/bluetooth.js +0 -315
  474. package/lib/bluetoothVendors.js +0 -1138
  475. package/lib/cli.js +0 -100
  476. package/lib/cpu.js +0 -2285
  477. package/lib/docker.js +0 -791
  478. package/lib/dockerSocket.js +0 -117
  479. package/lib/filesystem.js +0 -1832
  480. package/lib/graphics.js +0 -1321
  481. package/lib/index.d.ts +0 -1051
  482. package/lib/index.js +0 -520
  483. package/lib/internet.js +0 -259
  484. package/lib/memory.js +0 -622
  485. package/lib/network.js +0 -2008
  486. package/lib/osinfo.js +0 -1321
  487. package/lib/printer.js +0 -209
  488. package/lib/processes.js +0 -1459
  489. package/lib/system.js +0 -855
  490. package/lib/usb.js +0 -309
  491. package/lib/users.js +0 -412
  492. package/lib/util.js +0 -2824
  493. package/lib/virtualbox.js +0 -116
  494. package/lib/wifi.js +0 -839
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pci = void 0;
4
+ const exec_1 = require("../common/exec");
5
+ const common_1 = require("../common");
6
+ const defaults_1 = require("../common/defaults");
7
+ const const_1 = require("../common/const");
8
+ const splitId = (value) => {
9
+ const match = value.match(/^(.*?)\s*\[([0-9a-fA-F]{4})\]\s*$/);
10
+ if (match) {
11
+ return { name: match[1].trim(), id: match[2].toLowerCase() };
12
+ }
13
+ return { name: value.trim(), id: '' };
14
+ };
15
+ const parsePci = (stdout) => {
16
+ const result = [];
17
+ stdout.split(/\n\s*\n/).forEach((block) => {
18
+ const lines = block.split('\n');
19
+ const slot = (0, common_1.getValue)(lines, 'Slot', ':', true);
20
+ if (!slot) {
21
+ return;
22
+ }
23
+ const cls = splitId((0, common_1.getValue)(lines, 'Class', ':', true));
24
+ const vendor = splitId((0, common_1.getValue)(lines, 'Vendor', ':', true));
25
+ const device = splitId((0, common_1.getValue)(lines, 'Device', ':', true));
26
+ const svendor = splitId((0, common_1.getValue)(lines, 'SVendor', ':', true));
27
+ const sdevice = splitId((0, common_1.getValue)(lines, 'SDevice', ':', true));
28
+ const slotParts = slot.split(':');
29
+ result.push({
30
+ ...(0, common_1.cloneObj)(defaults_1.initPciData),
31
+ slot,
32
+ bus: slotParts.length >= 3 ? slotParts[1] : slotParts[0],
33
+ type: cls.name,
34
+ vendor: vendor.name,
35
+ vendorId: vendor.id,
36
+ model: device.name,
37
+ deviceId: device.id,
38
+ subVendorId: svendor.id,
39
+ subDeviceId: sdevice.id,
40
+ revision: (0, common_1.getValue)(lines, 'Rev', ':', true),
41
+ driver: (0, common_1.getValue)(lines, 'Driver', ':', true)
42
+ });
43
+ });
44
+ return result;
45
+ };
46
+ const pci = async () => {
47
+ await (0, common_1.nextTick)();
48
+ try {
49
+ const { stdout } = await (0, exec_1.exec)('lspci -vmmnnk 2>/dev/null', const_1.execOptsLinux);
50
+ return parsePci(stdout.toString());
51
+ }
52
+ catch {
53
+ return [];
54
+ }
55
+ };
56
+ exports.pci = pci;
@@ -0,0 +1,2 @@
1
+ import { PrinterData } from '../common/types';
2
+ export declare const printer: () => Promise<PrinterData[]>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printer = void 0;
4
+ const exec_1 = require("./../common/exec");
5
+ const common_1 = require("../common");
6
+ const const_1 = require("../common/const");
7
+ const parseLinuxCupsHeader = (lines) => {
8
+ const result = {};
9
+ if (lines && lines.length && lines[0]) {
10
+ if (lines[0].indexOf(' CUPS v') > 0) {
11
+ const parts = lines[0].split(' CUPS v');
12
+ result.cupsVersion = parts[1];
13
+ }
14
+ }
15
+ return result;
16
+ };
17
+ const parseLinuxCupsPrinter = (lines) => {
18
+ const printerId = (0, common_1.getValue)(lines, 'PrinterId', ' ');
19
+ return {
20
+ id: printerId ? parseInt(printerId, 10) : null,
21
+ name: (0, common_1.getValue)(lines, 'Info', ' '),
22
+ model: lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '',
23
+ uri: (0, common_1.getValue)(lines, 'DeviceURI', ' '),
24
+ uuid: (0, common_1.getValue)(lines, 'UUID', ' '),
25
+ status: (0, common_1.getValue)(lines, 'State', ' '),
26
+ local: (0, common_1.getValue)(lines, 'Location', ' ').toLowerCase().startsWith('local'),
27
+ default: null,
28
+ shared: (0, common_1.getValue)(lines, 'Shared', ' ').toLowerCase().startsWith('yes'),
29
+ engine: null,
30
+ engineVersion: null
31
+ };
32
+ };
33
+ const parseLinuxLpstatPrinter = (lines, id) => {
34
+ return {
35
+ id: id,
36
+ name: (0, common_1.getValue)(lines, 'Description', ':', true),
37
+ model: lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '',
38
+ uri: null,
39
+ uuid: null,
40
+ status: lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown') : null,
41
+ local: (0, common_1.getValue)(lines, 'Location', ':', true).toLowerCase().startsWith('local'),
42
+ default: null,
43
+ shared: (0, common_1.getValue)(lines, 'Shared', ' ').toLowerCase().startsWith('yes'),
44
+ engine: null,
45
+ engineVersion: null
46
+ };
47
+ };
48
+ const printer = async () => {
49
+ await (0, common_1.nextTick)();
50
+ const result = [];
51
+ let { stdout } = await (0, exec_1.execSave)('cat /etc/cups/printers.conf 2>/dev/null');
52
+ const parts = stdout.toString().split('<Printer ');
53
+ const printerHeader = parseLinuxCupsHeader(parts[0].split('\n'));
54
+ for (let i = 1; i < parts.length; i++) {
55
+ const printers = parseLinuxCupsPrinter(parts[i].split('\n'));
56
+ if (printers.name) {
57
+ printers.engine = 'CUPS';
58
+ printers.engineVersion = printerHeader.cupsVersion;
59
+ result.push(printers);
60
+ }
61
+ }
62
+ if (result.length === 0) {
63
+ if (const_1.LINUX) {
64
+ ({ stdout } = await (0, exec_1.execSave)('export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL'));
65
+ const parts = ('\n' + stdout.toString()).split('\nprinter ');
66
+ for (let i = 1; i < parts.length; i++) {
67
+ const printers = parseLinuxLpstatPrinter(parts[i].split('\n'), i);
68
+ result.push(printers);
69
+ }
70
+ return result;
71
+ }
72
+ else {
73
+ return result;
74
+ }
75
+ }
76
+ else {
77
+ return result;
78
+ }
79
+ };
80
+ exports.printer = printer;
@@ -0,0 +1,2 @@
1
+ import { ProcessLoadData } from '../common/types';
2
+ export declare const processLoad: (proc: string) => Promise<ProcessLoadData[]>;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processLoad = void 0;
4
+ const exec_1 = require("../common/exec");
5
+ const const_1 = require("../common/const");
6
+ const common_1 = require("../common");
7
+ const security_1 = require("../common/security");
8
+ const parse_1 = require("../common/parse");
9
+ const _process_cpu = {
10
+ all: 0,
11
+ all_utime: 0,
12
+ all_stime: 0,
13
+ list: {},
14
+ ms: 0,
15
+ result: {}
16
+ };
17
+ const processLoad = async (proc) => {
18
+ await (0, common_1.nextTick)();
19
+ const result = [];
20
+ if (!(0, security_1.isPrototypePolluted)()) {
21
+ let stdout = '';
22
+ const processes = (0, security_1.sanitizeServiceString)(proc);
23
+ if (processes.length) {
24
+ const args = ['-axo', 'pid,ppid,pcpu,pmem,comm'];
25
+ stdout = await (0, exec_1.execSecure)('ps', args);
26
+ if (stdout) {
27
+ const procStats = [];
28
+ const lines = stdout.split('\n').filter((line) => {
29
+ if (processes.length === 1 && processes[0] === '*') {
30
+ return true;
31
+ }
32
+ if (line.toLowerCase().indexOf('grep') !== -1) {
33
+ return false;
34
+ }
35
+ let found = false;
36
+ processes.forEach((item) => {
37
+ found = found || line.toLowerCase().indexOf(item.toLowerCase()) >= 0;
38
+ });
39
+ return found;
40
+ });
41
+ if (processes.length === 1 && processes[0] === '*') {
42
+ lines.shift();
43
+ }
44
+ lines.forEach(function (line) {
45
+ const data = line.trim().replace(/ +/g, ' ').split(' ');
46
+ if (data.length > 4) {
47
+ procStats.push({
48
+ name: data[4].substring(data[4].lastIndexOf('/') + 1),
49
+ pid: parseInt(data[0]) || 0,
50
+ ppid: parseInt(data[1]) || 0,
51
+ cpu: parseFloat(data[2].replace(',', '.')),
52
+ mem: parseFloat(data[3].replace(',', '.'))
53
+ });
54
+ }
55
+ });
56
+ procStats.forEach(function (item) {
57
+ let listPos = -1;
58
+ let inList = false;
59
+ let name = '';
60
+ for (let j = 0; j < result.length; j++) {
61
+ if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
62
+ listPos = j;
63
+ }
64
+ }
65
+ processes.forEach((proc) => {
66
+ if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
67
+ inList = true;
68
+ name = proc;
69
+ }
70
+ });
71
+ if ((processes.length === 1 && processes[0] === '*') || inList) {
72
+ if (listPos < 0) {
73
+ result.push({
74
+ proc: name,
75
+ pid: item.pid,
76
+ pids: [item.pid],
77
+ cpu: item.cpu,
78
+ mem: item.mem
79
+ });
80
+ }
81
+ else {
82
+ if (item.ppid < 10) {
83
+ result[listPos].pid = item.pid;
84
+ }
85
+ result[listPos].pids.push(item.pid);
86
+ result[listPos].cpu += item.cpu;
87
+ result[listPos].mem += item.mem;
88
+ }
89
+ }
90
+ });
91
+ if (processes.length !== 1 || processes[0] !== '*') {
92
+ const processesMissing = processes.filter((name) => {
93
+ return (procStats.filter(function (item) {
94
+ return item.name.toLowerCase().indexOf(name) >= 0;
95
+ }).length === 0);
96
+ });
97
+ processesMissing.forEach((procName) => {
98
+ result.push({
99
+ proc: procName,
100
+ pid: null,
101
+ pids: [],
102
+ cpu: 0,
103
+ mem: 0
104
+ });
105
+ });
106
+ }
107
+ if (const_1.LINUX) {
108
+ result.forEach(function (item) {
109
+ item.cpu = 0;
110
+ });
111
+ let cmd = 'cat /proc/stat | grep "cpu "';
112
+ for (const i in result) {
113
+ for (const j in result[i].pids) {
114
+ cmd += ';cat /proc/' + result[i].pids[j] + '/stat';
115
+ }
116
+ }
117
+ ({ stdout } = await (0, exec_1.exec)(cmd, const_1.execOptsLinux));
118
+ let curr_processes = stdout.toString().split('\n');
119
+ const all = (0, parse_1.parseProcStat)(curr_processes[0]);
120
+ curr_processes = curr_processes.slice(1);
121
+ const list_new = {};
122
+ curr_processes.forEach((element) => {
123
+ const resultProcess = (0, parse_1.calcProcStatLinux)(element, all, _process_cpu);
124
+ if (resultProcess.pid) {
125
+ let resultItemId = -1;
126
+ for (let i = 0; i < result.length; i++) {
127
+ if (result[i].pids.indexOf(resultProcess.pid) >= 0) {
128
+ resultItemId = i;
129
+ }
130
+ }
131
+ if (resultItemId >= 0) {
132
+ result[resultItemId].cpu += resultProcess.cpuu + resultProcess.cpus;
133
+ }
134
+ list_new[resultProcess.pid] = {
135
+ cpuu: resultProcess.cpuu,
136
+ cpus: resultProcess.cpus,
137
+ utime: resultProcess.utime,
138
+ stime: resultProcess.stime,
139
+ cutime: resultProcess.cutime,
140
+ cstime: resultProcess.cstime
141
+ };
142
+ }
143
+ });
144
+ result.forEach(function (item) {
145
+ item.cpu = Math.round(item.cpu * 100) / 100;
146
+ });
147
+ _process_cpu.all = all;
148
+ _process_cpu.list = Object.assign({}, list_new);
149
+ _process_cpu.ms = Date.now();
150
+ _process_cpu.result = Object.assign({}, result);
151
+ return result;
152
+ }
153
+ else {
154
+ return result;
155
+ }
156
+ }
157
+ else {
158
+ return result;
159
+ }
160
+ }
161
+ }
162
+ return result;
163
+ };
164
+ exports.processLoad = processLoad;
@@ -0,0 +1,2 @@
1
+ import type { ProcessesData } from '../common/types';
2
+ export declare const processes: () => Promise<ProcessesData>;
@@ -0,0 +1,358 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processes = void 0;
4
+ const node_os_1 = require("node:os");
5
+ const node_path_1 = require("node:path");
6
+ const common_1 = require("../common");
7
+ const const_1 = require("../common/const");
8
+ const datetime_1 = require("../common/datetime");
9
+ const defaults_1 = require("../common/defaults");
10
+ const exec_1 = require("../common/exec");
11
+ const files_1 = require("../common/files");
12
+ const index_1 = require("../common/index");
13
+ const parse_1 = require("../common/parse");
14
+ const _processes_cpu = {
15
+ all: 0,
16
+ all_utime: 0,
17
+ all_stime: 0,
18
+ list: {},
19
+ ms: 0,
20
+ result: {}
21
+ };
22
+ const getName = (command) => {
23
+ command = command || '';
24
+ let result = command.split(' ')[0];
25
+ if (result.endsWith(':')) {
26
+ result = result.substring(0, result.length - 1);
27
+ }
28
+ if (!result.startsWith('[')) {
29
+ const parts = result.split('/');
30
+ if (isNaN((0, common_1.toInt)(parts[parts.length - 1]))) {
31
+ result = parts[parts.length - 1];
32
+ }
33
+ else {
34
+ result = parts[0];
35
+ }
36
+ }
37
+ return result;
38
+ };
39
+ const parseLine = async (line, parsedhead) => {
40
+ if (parsedhead.length < 13) {
41
+ return null;
42
+ }
43
+ let offset = 0;
44
+ let offset2 = 0;
45
+ const checkColumn = (i) => {
46
+ offset = offset2;
47
+ if (parsedhead[i]) {
48
+ offset2 = line.substring(parsedhead[i].to + offset, 10000).indexOf(' ');
49
+ }
50
+ else {
51
+ offset2 = 10000;
52
+ }
53
+ };
54
+ checkColumn(0);
55
+ const pid = (0, common_1.toInt)(line.substring(parsedhead[0].from + offset, parsedhead[0].to + offset2));
56
+ checkColumn(1);
57
+ const ppid = (0, common_1.toInt)(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2));
58
+ checkColumn(2);
59
+ const cpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.'));
60
+ checkColumn(3);
61
+ const mem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.'));
62
+ checkColumn(4);
63
+ const priority = (0, common_1.toInt)(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2));
64
+ checkColumn(5);
65
+ const vsz = (0, common_1.toInt)(line.substring(parsedhead[5].from + offset, parsedhead[5].to + offset2));
66
+ checkColumn(6);
67
+ const rss = (0, common_1.toInt)(line.substring(parsedhead[6].from + offset, parsedhead[6].to + offset2));
68
+ checkColumn(7);
69
+ const nice = (0, common_1.toInt)(line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2)) || 0;
70
+ checkColumn(8);
71
+ const started = !const_1.SUNOS
72
+ ? (0, datetime_1.parseElapsedTime)(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim())
73
+ : (0, datetime_1.parseTimeUnix)(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim());
74
+ checkColumn(9);
75
+ let state = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim();
76
+ state =
77
+ state[0] === 'R'
78
+ ? 'running'
79
+ : state[0] === 'S'
80
+ ? 'sleeping'
81
+ : state[0] === 'T'
82
+ ? 'stopped'
83
+ : state[0] === 'W'
84
+ ? 'paging'
85
+ : state[0] === 'X'
86
+ ? 'dead'
87
+ : state[0] === 'Z'
88
+ ? 'zombie'
89
+ : state[0] === 'D' || state[0] === 'U'
90
+ ? 'blocked'
91
+ : 'unknown';
92
+ checkColumn(10);
93
+ let tty = line.substring(parsedhead[10].from + offset, parsedhead[10].to + offset2).trim();
94
+ if (tty === '?' || tty === '??') {
95
+ tty = '';
96
+ }
97
+ checkColumn(11);
98
+ const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim();
99
+ checkColumn(12);
100
+ let cmdPath = '';
101
+ let command = '';
102
+ let params = '';
103
+ let fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim();
104
+ if (fullcommand.endsWith(']')) {
105
+ fullcommand = fullcommand.slice(0, -1);
106
+ }
107
+ if (fullcommand.startsWith('[')) {
108
+ command = fullcommand.substring(1);
109
+ }
110
+ else {
111
+ const p1 = fullcommand.indexOf('(');
112
+ const p2 = fullcommand.indexOf(')');
113
+ const p3 = fullcommand.indexOf('/');
114
+ const p4 = fullcommand.indexOf(':');
115
+ if (p1 < p2 && p1 < p3 && p3 < p2) {
116
+ command = fullcommand.split(' ')[0];
117
+ command = command.replace(/:/g, '');
118
+ }
119
+ else {
120
+ if (p4 > 0 && (p3 === -1 || p3 > 3)) {
121
+ command = fullcommand.split(' ')[0];
122
+ command = command.replace(/:/g, '');
123
+ }
124
+ else {
125
+ let firstParamPos = fullcommand.indexOf(' -');
126
+ let firstParamPathPos = fullcommand.indexOf(' /');
127
+ firstParamPos = firstParamPos >= 0 ? firstParamPos : 10000;
128
+ firstParamPathPos = firstParamPathPos >= 0 ? firstParamPathPos : 10000;
129
+ const firstPos = Math.min(firstParamPos, firstParamPathPos);
130
+ let tmpCommand = fullcommand.substring(0, firstPos);
131
+ const tmpParams = fullcommand.substring(firstPos);
132
+ const lastSlashPos = tmpCommand.lastIndexOf('/');
133
+ if (lastSlashPos >= 0) {
134
+ cmdPath = tmpCommand.substring(0, lastSlashPos);
135
+ tmpCommand = tmpCommand.substring(lastSlashPos + 1);
136
+ }
137
+ if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) {
138
+ const parts = tmpCommand.split(' ');
139
+ if (await (0, files_1.fileExists)((0, node_path_1.join)(cmdPath, parts[0]))) {
140
+ command = parts.shift() || '';
141
+ params = (parts.join(' ') + ' ' + tmpParams).trim();
142
+ }
143
+ else {
144
+ command = tmpCommand.trim();
145
+ params = tmpParams.trim();
146
+ }
147
+ }
148
+ else {
149
+ command = tmpCommand.trim();
150
+ params = tmpParams.trim();
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return {
156
+ pid: pid,
157
+ parentPid: ppid,
158
+ name: const_1.LINUX ? getName(command) : command,
159
+ cpu: cpu,
160
+ cpuu: 0,
161
+ cpus: 0,
162
+ mem: mem,
163
+ priority: priority,
164
+ memVsz: vsz,
165
+ memRss: rss,
166
+ nice: nice,
167
+ started: started,
168
+ state: state,
169
+ tty: tty,
170
+ user: user,
171
+ command: command,
172
+ params: params,
173
+ path: cmdPath
174
+ };
175
+ };
176
+ const parseProcesses = async (lines, parsedhead) => {
177
+ const result = [];
178
+ if (lines.length > 1) {
179
+ lines = lines.splice(1);
180
+ for (const line of lines) {
181
+ if (line.trim() !== '') {
182
+ const parsed = await parseLine(line, parsedhead);
183
+ if (parsed) {
184
+ result.push(parsed);
185
+ }
186
+ }
187
+ }
188
+ }
189
+ return result;
190
+ };
191
+ const parseProcesses2 = (lines) => {
192
+ function formatDateTime(time) {
193
+ const month = ('0' + (time.getMonth() + 1).toString()).slice(-2);
194
+ const year = time.getFullYear().toString();
195
+ const day = ('0' + time.getDate().toString()).slice(-2);
196
+ const hours = ('0' + time.getHours().toString()).slice(-2);
197
+ const mins = ('0' + time.getMinutes().toString()).slice(-2);
198
+ const secs = ('0' + time.getSeconds().toString()).slice(-2);
199
+ return year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs;
200
+ }
201
+ const parseElapsed = (etime) => {
202
+ let started = '';
203
+ if (etime.indexOf('d') >= 0) {
204
+ const elapsed_parts = etime.split('d');
205
+ started = formatDateTime(new Date(Date.now() - ((0, common_1.toInt)(elapsed_parts[0]) * 24 + (0, common_1.toInt)(elapsed_parts[1]) * 1) * 60 * 60 * 1000));
206
+ }
207
+ else if (etime.indexOf('h') >= 0) {
208
+ const elapsed_parts = etime.split('h');
209
+ started = formatDateTime(new Date(Date.now() - ((0, common_1.toInt)(elapsed_parts[0]) * 60 + (0, common_1.toInt)(elapsed_parts[1]) * 1) * 60 * 1000));
210
+ }
211
+ else if (etime.indexOf(':') >= 0) {
212
+ const elapsed_parts = etime.split(':');
213
+ started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? ((0, common_1.toInt)(elapsed_parts[0]) * 60 + (0, common_1.toInt)(elapsed_parts[1])) * 1000 : (0, common_1.toInt)(elapsed_parts[0]) * 1000)));
214
+ }
215
+ return started;
216
+ };
217
+ const result = [];
218
+ lines.forEach((line) => {
219
+ if (line.trim() !== '') {
220
+ line = line.trim().replace(/ +/g, ' ').replace(/,+/g, '.');
221
+ const parts = line.split(' ');
222
+ const command = parts.slice(9).join(' ');
223
+ const pmem = parseFloat(((1.0 * (0, common_1.toInt)(parts[3]) * 1024) / (0, node_os_1.totalmem)()).toFixed(1));
224
+ const started = parseElapsed(parts[5]);
225
+ result.push({
226
+ pid: (0, common_1.toInt)(parts[0]),
227
+ parentPid: (0, common_1.toInt)(parts[1]),
228
+ name: getName(command),
229
+ cpu: 0,
230
+ cpuu: 0,
231
+ cpus: 0,
232
+ mem: pmem,
233
+ priority: 0,
234
+ memVsz: (0, common_1.toInt)(parts[2]),
235
+ memRss: (0, common_1.toInt)(parts[3]),
236
+ nice: (0, common_1.toInt)(parts[4]),
237
+ started: started,
238
+ state: parts[6] === 'R'
239
+ ? 'running'
240
+ : parts[6] === 'S'
241
+ ? 'sleeping'
242
+ : parts[6] === 'T'
243
+ ? 'stopped'
244
+ : parts[6] === 'W'
245
+ ? 'paging'
246
+ : parts[6] === 'X'
247
+ ? 'dead'
248
+ : parts[6] === 'Z'
249
+ ? 'zombie'
250
+ : parts[6] === 'D' || parts[6] === 'U'
251
+ ? 'blocked'
252
+ : 'unknown',
253
+ tty: parts[7],
254
+ user: parts[8],
255
+ command: command,
256
+ params: '',
257
+ path: ''
258
+ });
259
+ }
260
+ });
261
+ return result;
262
+ };
263
+ const processes = async () => {
264
+ await (0, common_1.nextTick)();
265
+ const result = (0, index_1.cloneObj)(defaults_1.initProcesses);
266
+ let cmd = '';
267
+ let stdout = '';
268
+ if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) {
269
+ try {
270
+ if (const_1.LINUX || const_1.ANDROID) {
271
+ cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL';
272
+ }
273
+ if (const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD) {
274
+ cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL';
275
+ }
276
+ if (const_1.DARWIN) {
277
+ cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r';
278
+ }
279
+ if (const_1.SUNOS) {
280
+ cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm';
281
+ }
282
+ ({ stdout } = await (0, exec_1.exec)(cmd, const_1.execOptsLinux));
283
+ if (stdout.trim()) {
284
+ const lines = stdout.trim().split('\n');
285
+ const parsedhead = (0, parse_1.parseHead)(lines[0], 8);
286
+ result.list = (await parseProcesses(lines, parsedhead)).slice();
287
+ result.all = result.list.length;
288
+ result.running = result.list.filter((e) => e.state === 'running').length;
289
+ result.blocked = result.list.filter((e) => e.state === 'blocked').length;
290
+ result.sleeping = result.list.filter((e) => e.state === 'sleeping').length;
291
+ if (const_1.LINUX) {
292
+ cmd = 'cat /proc/stat | grep "cpu "';
293
+ result.list.forEach((element) => {
294
+ cmd += ';cat /proc/' + element.pid + '/stat';
295
+ });
296
+ ({ stdout } = await (0, exec_1.exec)(cmd, const_1.execOptsLinux));
297
+ let curr_processes = stdout.toString().split('\n');
298
+ const all = (0, parse_1.parseProcStat)(curr_processes[0]);
299
+ curr_processes = curr_processes.slice(1);
300
+ const list_new = {};
301
+ curr_processes.forEach((element) => {
302
+ const resultProcess = (0, parse_1.calcProcStatLinux)(element, all, _processes_cpu);
303
+ if (resultProcess.pid) {
304
+ const listPos = result.list.map((e) => e.pid).indexOf(resultProcess.pid);
305
+ if (listPos >= 0) {
306
+ result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus;
307
+ result.list[listPos].cpuu = resultProcess.cpuu;
308
+ result.list[listPos].cpus = resultProcess.cpus;
309
+ }
310
+ list_new[resultProcess.pid] = {
311
+ cpuu: resultProcess.cpuu,
312
+ cpus: resultProcess.cpus,
313
+ utime: resultProcess.utime,
314
+ stime: resultProcess.stime,
315
+ cutime: resultProcess.cutime,
316
+ cstime: resultProcess.cstime
317
+ };
318
+ }
319
+ });
320
+ _processes_cpu.all = all;
321
+ _processes_cpu.list = Object.assign({}, list_new);
322
+ _processes_cpu.ms = Date.now();
323
+ _processes_cpu.result = Object.assign({}, result);
324
+ return result;
325
+ }
326
+ else {
327
+ return result;
328
+ }
329
+ }
330
+ }
331
+ catch { }
332
+ try {
333
+ cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm';
334
+ if (const_1.SUNOS) {
335
+ cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm';
336
+ }
337
+ ({ stdout } = await (0, exec_1.exec)(cmd, const_1.execOptsLinux));
338
+ if (stdout.trim()) {
339
+ const lines = stdout.toString().split('\n').splice(1);
340
+ result.list = parseProcesses2(lines).slice();
341
+ result.all = result.list.length;
342
+ result.running = result.list.filter((e) => e.state === 'running').length;
343
+ result.blocked = result.list.filter((e) => e.state === 'blocked').length;
344
+ result.sleeping = result.list.filter((e) => e.state === 'sleeping').length;
345
+ return result;
346
+ }
347
+ else {
348
+ return result;
349
+ }
350
+ }
351
+ catch { }
352
+ return result;
353
+ }
354
+ else {
355
+ return _processes_cpu.result;
356
+ }
357
+ };
358
+ exports.processes = processes;
@@ -0,0 +1,2 @@
1
+ import { ServicesData } from '../common/types';
2
+ export declare const services: (srv: string) => Promise<ServicesData[]>;