alicezetion 1.9.6 → 1.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. package/.cache/replit/modules/nodejs-20.res +1 -0
  2. package/.cache/replit/modules/replit.res +1 -0
  3. package/.cache/typescript/5.4/node_modules/.package-lock.json +137 -0
  4. package/.cache/typescript/5.4/node_modules/@types/bluebird/LICENSE +21 -0
  5. package/.cache/typescript/5.4/node_modules/@types/bluebird/README.md +15 -0
  6. package/.cache/typescript/5.4/node_modules/@types/bluebird/index.d.ts +1365 -0
  7. package/.cache/typescript/5.4/node_modules/@types/bluebird/package.json +25 -0
  8. package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
  9. package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
  10. package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
  11. package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
  12. package/.cache/typescript/5.4/node_modules/@types/cheerio/LICENSE +21 -0
  13. package/.cache/typescript/5.4/node_modules/@types/cheerio/README.md +15 -0
  14. package/.cache/typescript/5.4/node_modules/@types/cheerio/index.d.ts +318 -0
  15. package/.cache/typescript/5.4/node_modules/@types/cheerio/package.json +71 -0
  16. package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
  17. package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
  18. package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
  19. package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
  20. package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
  21. package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
  22. package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
  23. package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
  24. package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
  25. package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
  26. package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
  27. package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
  28. package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  29. package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +476 -0
  30. package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
  31. package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
  32. package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
  33. package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +931 -0
  34. package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
  35. package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
  36. package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +412 -0
  37. package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
  38. package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
  39. package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
  40. package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
  41. package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
  42. package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
  43. package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
  44. package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
  45. package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
  46. package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
  47. package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
  48. package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
  49. package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
  50. package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
  51. package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
  52. package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
  53. package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
  54. package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
  55. package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
  56. package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
  57. package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
  58. package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
  59. package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
  60. package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
  61. package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
  62. package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
  63. package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
  64. package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
  65. package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
  66. package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
  67. package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
  68. package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
  69. package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
  70. package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
  71. package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
  72. package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +694 -0
  73. package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
  74. package/.cache/typescript/5.4/node_modules/@types/npmlog/LICENSE +21 -0
  75. package/.cache/typescript/5.4/node_modules/@types/npmlog/README.md +15 -0
  76. package/.cache/typescript/5.4/node_modules/@types/npmlog/index.d.ts +84 -0
  77. package/.cache/typescript/5.4/node_modules/@types/npmlog/package.json +32 -0
  78. package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
  79. package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
  80. package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
  81. package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
  82. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
  83. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
  84. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
  85. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
  86. package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
  87. package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
  88. package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
  89. package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
  90. package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
  91. package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
  92. package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
  93. package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
  94. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  95. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
  96. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
  97. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  98. package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
  99. package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
  100. package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
  101. package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
  102. package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
  103. package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
  104. package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
  105. package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
  106. package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
  107. package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
  108. package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
  109. package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
  110. package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
  111. package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
  112. package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
  113. package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
  114. package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  115. package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
  116. package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
  117. package/.cache/typescript/5.4/node_modules/form-data/README.md +350 -0
  118. package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +350 -0
  119. package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +51 -0
  120. package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
  121. package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +483 -0
  122. package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
  123. package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
  124. package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
  125. package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
  126. package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
  127. package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
  128. package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
  129. package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
  130. package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
  131. package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
  132. package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
  133. package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
  134. package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
  135. package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
  136. package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
  137. package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
  138. package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
  139. package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
  140. package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
  141. package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
  142. package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
  143. package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
  144. package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
  145. package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
  146. package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
  147. package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  148. package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
  149. package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
  150. package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
  151. package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
  152. package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
  153. package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
  154. package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  155. package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
  156. package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
  157. package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
  158. package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
  159. package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
  160. package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
  161. package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
  162. package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
  163. package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  164. package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
  165. package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
  166. package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
  167. package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
  168. package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
  169. package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
  170. package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
  171. package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
  172. package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
  173. package/.cache/typescript/5.4/package-lock.json +149 -0
  174. package/.cache/typescript/5.4/package.json +1 -0
  175. package/index.js +290 -70
  176. package/leiamnash/addExternalModule.js +15 -0
  177. package/leiamnash/addUserToGroup.js +77 -0
  178. package/leiamnash/changeAdminStatus.js +47 -0
  179. package/leiamnash/changeArchivedStatus.js +41 -0
  180. package/{src → leiamnash}/changeAvatar.js +3 -2
  181. package/leiamnash/changeBio.js +64 -0
  182. package/leiamnash/changeBlockedStatus.js +36 -0
  183. package/leiamnash/changeGroupImage.js +105 -0
  184. package/leiamnash/changeNickname.js +43 -0
  185. package/leiamnash/changeThreadColor.js +61 -0
  186. package/leiamnash/changeThreadEmoji.js +41 -0
  187. package/{src → leiamnash}/chat.js +4 -29
  188. package/leiamnash/createNewGroup.js +70 -0
  189. package/leiamnash/createPoll.js +59 -0
  190. package/leiamnash/deleteMessage.js +44 -0
  191. package/leiamnash/deleteThread.js +42 -0
  192. package/leiamnash/editMessage.js +62 -0
  193. package/leiamnash/forwardAttachment.js +47 -0
  194. package/leiamnash/forwardMessage.js +0 -0
  195. package/leiamnash/getCurrentUserID.js +7 -0
  196. package/leiamnash/getEmojiUrl.js +27 -0
  197. package/leiamnash/getFriendsList.js +73 -0
  198. package/leiamnash/getInfoVideo.js +134 -0
  199. package/leiamnash/getThreadHistory.js +537 -0
  200. package/leiamnash/getThreadHistoryDeprecated.js +71 -0
  201. package/leiamnash/getThreadInfo.js +171 -0
  202. package/leiamnash/getThreadInfoDeprecated.js +56 -0
  203. package/leiamnash/getThreadList.js +213 -0
  204. package/leiamnash/getThreadListDeprecated.js +46 -0
  205. package/leiamnash/getThreadPictures.js +59 -0
  206. package/leiamnash/getUserID.js +61 -0
  207. package/leiamnash/getUserInfo.js +66 -0
  208. package/leiamnash/handleFriendRequest.js +46 -0
  209. package/leiamnash/handleMessageRequest.js +47 -0
  210. package/leiamnash/httpGet.js +47 -0
  211. package/leiamnash/httpPost.js +47 -0
  212. package/leiamnash/httpPostFormData.js +42 -0
  213. package/leiamnash/listenMqtt.js +843 -0
  214. package/leiamnash/logout.js +68 -0
  215. package/leiamnash/markAsDelivered.js +47 -0
  216. package/leiamnash/markAsRead.js +70 -0
  217. package/leiamnash/markAsReadAll.js +40 -0
  218. package/leiamnash/markAsSeen.js +48 -0
  219. package/leiamnash/muteThread.js +45 -0
  220. package/leiamnash/pinMessage.js +58 -0
  221. package/leiamnash/react.js +109 -0
  222. package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
  223. package/leiamnash/removeUserFromGroup.js +45 -0
  224. package/leiamnash/resolvePhotoUrl.js +36 -0
  225. package/leiamnash/searchForThread.js +42 -0
  226. package/leiamnash/seen.js +40 -0
  227. package/leiamnash/sendMessage.js +315 -0
  228. package/leiamnash/sendTypingIndicator.js +70 -0
  229. package/leiamnash/setMessageReaction.js +103 -0
  230. package/leiamnash/setPostReaction.js +63 -0
  231. package/leiamnash/setTitle.js +70 -0
  232. package/leiamnash/threadColors.js +41 -0
  233. package/leiamnash/token.js +112 -0
  234. package/leiamnash/unfriend.js +42 -0
  235. package/leiamnash/unsendMessage.js +39 -0
  236. package/{src → leiamnash}/uploadAttachment.js +2 -1
  237. package/package.json +3 -2
  238. package/utils.js +1345 -1382
  239. package/.cache/replit/modules/nodejs-20:v28-20240213-3f08513.res +0 -1
  240. package/.cache/replit/modules/replit:v5-20240209-9e3a339.res +0 -1
  241. package/.replit +0 -1
  242. package/src/addExternalModule.js +0 -19
  243. package/src/addUserToGroup.js +0 -113
  244. package/src/changeAdminStatus.js +0 -79
  245. package/src/changeArchivedStatus.js +0 -55
  246. package/src/changeBio.js +0 -77
  247. package/src/changeBlockedStatus.js +0 -47
  248. package/src/changeGroupImage.js +0 -132
  249. package/src/changeNickname.js +0 -59
  250. package/src/changeThreadColor.js +0 -65
  251. package/src/changeThreadEmoji.js +0 -55
  252. package/src/createNewGroup.js +0 -86
  253. package/src/createPoll.js +0 -71
  254. package/src/deleteMessage.js +0 -56
  255. package/src/deleteThread.js +0 -56
  256. package/src/edit.js +0 -66
  257. package/src/forwardAttachment.js +0 -60
  258. package/src/getCurrentUserID.js +0 -7
  259. package/src/getEmojiUrl.js +0 -29
  260. package/src/getFriendsList.js +0 -83
  261. package/src/getThreadHistory.js +0 -666
  262. package/src/getThreadInfo.js +0 -232
  263. package/src/getThreadList.js +0 -241
  264. package/src/getThreadPictures.js +0 -79
  265. package/src/getUserID.js +0 -66
  266. package/src/getUserInfo.js +0 -74
  267. package/src/handleFriendRequest.js +0 -61
  268. package/src/handleMessageRequest.js +0 -65
  269. package/src/httpGet.js +0 -57
  270. package/src/httpPost.js +0 -57
  271. package/src/httpPostFormData.js +0 -63
  272. package/src/listenMqtt.js +0 -854
  273. package/src/logout.js +0 -75
  274. package/src/markAsDelivered.js +0 -58
  275. package/src/markAsRead.js +0 -80
  276. package/src/markAsReadAll.js +0 -50
  277. package/src/markAsSeen.js +0 -59
  278. package/src/muteThread.js +0 -52
  279. package/src/react.js +0 -121
  280. package/src/removeUserFromGroup.js +0 -79
  281. package/src/resolvePhotoUrl.js +0 -45
  282. package/src/searchForThread.js +0 -53
  283. package/src/seen.js +0 -50
  284. package/src/sendMessage.js +0 -477
  285. package/src/sendTypingIndicator.js +0 -103
  286. package/src/setMessageReaction.js +0 -121
  287. package/src/setPostReaction.js +0 -109
  288. package/src/setTitle.js +0 -86
  289. package/src/threadColors.js +0 -131
  290. package/src/unfriend.js +0 -52
  291. package/src/unsendMessage.js +0 -49
  292. /package/{src → leiamnash}/getMessage.js +0 -0
@@ -0,0 +1,1754 @@
1
+ declare module "process" {
2
+ import * as net from "node:net";
3
+ import * as os from "node:os";
4
+ import * as tty from "node:tty";
5
+ import { Worker } from "node:worker_threads";
6
+ global {
7
+ var process: NodeJS.Process;
8
+ namespace NodeJS {
9
+ // this namespace merge is here because these are specifically used
10
+ // as the type for process.stdin, process.stdout, and process.stderr.
11
+ // they can't live in tty.d.ts because we need to disambiguate the imported name.
12
+ interface ReadStream extends tty.ReadStream {}
13
+ interface WriteStream extends tty.WriteStream {}
14
+ interface MemoryUsageFn {
15
+ /**
16
+ * The `process.memoryUsage()` method iterate over each page to gather informations about memory
17
+ * usage which can be slow depending on the program memory allocations.
18
+ */
19
+ (): MemoryUsage;
20
+ /**
21
+ * method returns an integer representing the Resident Set Size (RSS) in bytes.
22
+ */
23
+ rss(): number;
24
+ }
25
+ interface MemoryUsage {
26
+ /**
27
+ * Resident Set Size, is the amount of space occupied in the main memory device (that is a subset of the total allocated memory) for the
28
+ * process, including all C++ and JavaScript objects and code.
29
+ */
30
+ rss: number;
31
+ /**
32
+ * Refers to V8's memory usage.
33
+ */
34
+ heapTotal: number;
35
+ /**
36
+ * Refers to V8's memory usage.
37
+ */
38
+ heapUsed: number;
39
+ external: number;
40
+ /**
41
+ * Refers to memory allocated for `ArrayBuffer`s and `SharedArrayBuffer`s, including all Node.js Buffers. This is also included
42
+ * in the external value. When Node.js is used as an embedded library, this value may be `0` because allocations for `ArrayBuffer`s
43
+ * may not be tracked in that case.
44
+ */
45
+ arrayBuffers: number;
46
+ }
47
+ interface CpuUsage {
48
+ user: number;
49
+ system: number;
50
+ }
51
+ interface ProcessRelease {
52
+ name: string;
53
+ sourceUrl?: string | undefined;
54
+ headersUrl?: string | undefined;
55
+ libUrl?: string | undefined;
56
+ lts?: string | undefined;
57
+ }
58
+ interface ProcessVersions extends Dict<string> {
59
+ http_parser: string;
60
+ node: string;
61
+ v8: string;
62
+ ares: string;
63
+ uv: string;
64
+ zlib: string;
65
+ modules: string;
66
+ openssl: string;
67
+ }
68
+ type Platform =
69
+ | "aix"
70
+ | "android"
71
+ | "darwin"
72
+ | "freebsd"
73
+ | "haiku"
74
+ | "linux"
75
+ | "openbsd"
76
+ | "sunos"
77
+ | "win32"
78
+ | "cygwin"
79
+ | "netbsd";
80
+ type Architecture =
81
+ | "arm"
82
+ | "arm64"
83
+ | "ia32"
84
+ | "loong64"
85
+ | "mips"
86
+ | "mipsel"
87
+ | "ppc"
88
+ | "ppc64"
89
+ | "riscv64"
90
+ | "s390"
91
+ | "s390x"
92
+ | "x64";
93
+ type Signals =
94
+ | "SIGABRT"
95
+ | "SIGALRM"
96
+ | "SIGBUS"
97
+ | "SIGCHLD"
98
+ | "SIGCONT"
99
+ | "SIGFPE"
100
+ | "SIGHUP"
101
+ | "SIGILL"
102
+ | "SIGINT"
103
+ | "SIGIO"
104
+ | "SIGIOT"
105
+ | "SIGKILL"
106
+ | "SIGPIPE"
107
+ | "SIGPOLL"
108
+ | "SIGPROF"
109
+ | "SIGPWR"
110
+ | "SIGQUIT"
111
+ | "SIGSEGV"
112
+ | "SIGSTKFLT"
113
+ | "SIGSTOP"
114
+ | "SIGSYS"
115
+ | "SIGTERM"
116
+ | "SIGTRAP"
117
+ | "SIGTSTP"
118
+ | "SIGTTIN"
119
+ | "SIGTTOU"
120
+ | "SIGUNUSED"
121
+ | "SIGURG"
122
+ | "SIGUSR1"
123
+ | "SIGUSR2"
124
+ | "SIGVTALRM"
125
+ | "SIGWINCH"
126
+ | "SIGXCPU"
127
+ | "SIGXFSZ"
128
+ | "SIGBREAK"
129
+ | "SIGLOST"
130
+ | "SIGINFO";
131
+ type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
132
+ type MultipleResolveType = "resolve" | "reject";
133
+ type BeforeExitListener = (code: number) => void;
134
+ type DisconnectListener = () => void;
135
+ type ExitListener = (code: number) => void;
136
+ type RejectionHandledListener = (promise: Promise<unknown>) => void;
137
+ type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
138
+ /**
139
+ * Most of the time the unhandledRejection will be an Error, but this should not be relied upon
140
+ * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
141
+ */
142
+ type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
143
+ type WarningListener = (warning: Error) => void;
144
+ type MessageListener = (message: unknown, sendHandle: unknown) => void;
145
+ type SignalsListener = (signal: Signals) => void;
146
+ type MultipleResolveListener = (
147
+ type: MultipleResolveType,
148
+ promise: Promise<unknown>,
149
+ value: unknown,
150
+ ) => void;
151
+ type WorkerListener = (worker: Worker) => void;
152
+ interface Socket extends ReadWriteStream {
153
+ isTTY?: true | undefined;
154
+ }
155
+ // Alias for compatibility
156
+ interface ProcessEnv extends Dict<string> {
157
+ /**
158
+ * Can be used to change the default timezone at runtime
159
+ */
160
+ TZ?: string;
161
+ }
162
+ interface HRTime {
163
+ (time?: [number, number]): [number, number];
164
+ /**
165
+ * The `bigint` version of the `{@link hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
166
+ *
167
+ * Unlike `{@link hrtime()}`, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
168
+ * ```js
169
+ * import { hrtime } from 'node:process';
170
+ *
171
+ * const start = hrtime.bigint();
172
+ * // 191051479007711n
173
+ *
174
+ * setTimeout(() => {
175
+ * const end = hrtime.bigint();
176
+ * // 191052633396993n
177
+ *
178
+ * console.log(`Benchmark took ${end - start} nanoseconds`);
179
+ * // Benchmark took 1154389282 nanoseconds
180
+ * }, 1000);
181
+ * ```
182
+ */
183
+ bigint(): bigint;
184
+ }
185
+ interface ProcessPermission {
186
+ /**
187
+ * Verifies that the process is able to access the given scope and reference.
188
+ * If no reference is provided, a global scope is assumed, for instance, `process.permission.has('fs.read')`
189
+ * will check if the process has ALL file system read permissions.
190
+ *
191
+ * The reference has a meaning based on the provided scope. For example, the reference when the scope is File System means files and folders.
192
+ *
193
+ * The available scopes are:
194
+ *
195
+ * * `fs` - All File System
196
+ * * `fs.read` - File System read operations
197
+ * * `fs.write` - File System write operations
198
+ * * `child` - Child process spawning operations
199
+ * * `worker` - Worker thread spawning operation
200
+ *
201
+ * ```js
202
+ * // Check if the process has permission to read the README file
203
+ * process.permission.has('fs.read', './README.md');
204
+ * // Check if the process has read permission operations
205
+ * process.permission.has('fs.read');
206
+ * ```
207
+ * @since v20.0.0
208
+ */
209
+ has(scope: string, reference?: string): boolean;
210
+ }
211
+ interface ProcessReport {
212
+ /**
213
+ * Directory where the report is written.
214
+ * working directory of the Node.js process.
215
+ * @default '' indicating that reports are written to the current
216
+ */
217
+ directory: string;
218
+ /**
219
+ * Filename where the report is written.
220
+ * The default value is the empty string.
221
+ * @default '' the output filename will be comprised of a timestamp,
222
+ * PID, and sequence number.
223
+ */
224
+ filename: string;
225
+ /**
226
+ * Returns a JSON-formatted diagnostic report for the running process.
227
+ * The report's JavaScript stack trace is taken from err, if present.
228
+ */
229
+ getReport(err?: Error): string;
230
+ /**
231
+ * If true, a diagnostic report is generated on fatal errors,
232
+ * such as out of memory errors or failed C++ assertions.
233
+ * @default false
234
+ */
235
+ reportOnFatalError: boolean;
236
+ /**
237
+ * If true, a diagnostic report is generated when the process
238
+ * receives the signal specified by process.report.signal.
239
+ * @default false
240
+ */
241
+ reportOnSignal: boolean;
242
+ /**
243
+ * If true, a diagnostic report is generated on uncaught exception.
244
+ * @default false
245
+ */
246
+ reportOnUncaughtException: boolean;
247
+ /**
248
+ * The signal used to trigger the creation of a diagnostic report.
249
+ * @default 'SIGUSR2'
250
+ */
251
+ signal: Signals;
252
+ /**
253
+ * Writes a diagnostic report to a file. If filename is not provided, the default filename
254
+ * includes the date, time, PID, and a sequence number.
255
+ * The report's JavaScript stack trace is taken from err, if present.
256
+ *
257
+ * @param fileName Name of the file where the report is written.
258
+ * This should be a relative path, that will be appended to the directory specified in
259
+ * `process.report.directory`, or the current working directory of the Node.js process,
260
+ * if unspecified.
261
+ * @param error A custom error used for reporting the JavaScript stack.
262
+ * @return Filename of the generated report.
263
+ */
264
+ writeReport(fileName?: string): string;
265
+ writeReport(error?: Error): string;
266
+ writeReport(fileName?: string, err?: Error): string;
267
+ }
268
+ interface ResourceUsage {
269
+ fsRead: number;
270
+ fsWrite: number;
271
+ involuntaryContextSwitches: number;
272
+ ipcReceived: number;
273
+ ipcSent: number;
274
+ majorPageFault: number;
275
+ maxRSS: number;
276
+ minorPageFault: number;
277
+ sharedMemorySize: number;
278
+ signalsCount: number;
279
+ swappedOut: number;
280
+ systemCPUTime: number;
281
+ unsharedDataSize: number;
282
+ unsharedStackSize: number;
283
+ userCPUTime: number;
284
+ voluntaryContextSwitches: number;
285
+ }
286
+ interface EmitWarningOptions {
287
+ /**
288
+ * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted.
289
+ *
290
+ * @default 'Warning'
291
+ */
292
+ type?: string | undefined;
293
+ /**
294
+ * A unique identifier for the warning instance being emitted.
295
+ */
296
+ code?: string | undefined;
297
+ /**
298
+ * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
299
+ *
300
+ * @default process.emitWarning
301
+ */
302
+ ctor?: Function | undefined;
303
+ /**
304
+ * Additional text to include with the error.
305
+ */
306
+ detail?: string | undefined;
307
+ }
308
+ interface ProcessConfig {
309
+ readonly target_defaults: {
310
+ readonly cflags: any[];
311
+ readonly default_configuration: string;
312
+ readonly defines: string[];
313
+ readonly include_dirs: string[];
314
+ readonly libraries: string[];
315
+ };
316
+ readonly variables: {
317
+ readonly clang: number;
318
+ readonly host_arch: string;
319
+ readonly node_install_npm: boolean;
320
+ readonly node_install_waf: boolean;
321
+ readonly node_prefix: string;
322
+ readonly node_shared_openssl: boolean;
323
+ readonly node_shared_v8: boolean;
324
+ readonly node_shared_zlib: boolean;
325
+ readonly node_use_dtrace: boolean;
326
+ readonly node_use_etw: boolean;
327
+ readonly node_use_openssl: boolean;
328
+ readonly target_arch: string;
329
+ readonly v8_no_strict_aliasing: number;
330
+ readonly v8_use_snapshot: boolean;
331
+ readonly visibility: string;
332
+ };
333
+ }
334
+ interface Process extends EventEmitter {
335
+ /**
336
+ * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is
337
+ * a `Writable` stream.
338
+ *
339
+ * For example, to copy `process.stdin` to `process.stdout`:
340
+ *
341
+ * ```js
342
+ * import { stdin, stdout } from 'node:process';
343
+ *
344
+ * stdin.pipe(stdout);
345
+ * ```
346
+ *
347
+ * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
348
+ */
349
+ stdout: WriteStream & {
350
+ fd: 1;
351
+ };
352
+ /**
353
+ * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is
354
+ * a `Writable` stream.
355
+ *
356
+ * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
357
+ */
358
+ stderr: WriteStream & {
359
+ fd: 2;
360
+ };
361
+ /**
362
+ * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is
363
+ * a `Readable` stream.
364
+ *
365
+ * For details of how to read from `stdin` see `readable.read()`.
366
+ *
367
+ * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that
368
+ * is compatible with scripts written for Node.js prior to v0.10\.
369
+ * For more information see `Stream compatibility`.
370
+ *
371
+ * In "old" streams mode the `stdin` stream is paused by default, so one
372
+ * must call `process.stdin.resume()` to read from it. Note also that calling `process.stdin.resume()` itself would switch stream to "old" mode.
373
+ */
374
+ stdin: ReadStream & {
375
+ fd: 0;
376
+ };
377
+ /**
378
+ * The `process.argv` property returns an array containing the command-line
379
+ * arguments passed when the Node.js process was launched. The first element will
380
+ * be {@link execPath}. See `process.argv0` if access to the original value
381
+ * of `argv[0]` is needed. The second element will be the path to the JavaScript
382
+ * file being executed. The remaining elements will be any additional command-line
383
+ * arguments.
384
+ *
385
+ * For example, assuming the following script for `process-args.js`:
386
+ *
387
+ * ```js
388
+ * import { argv } from 'node:process';
389
+ *
390
+ * // print process.argv
391
+ * argv.forEach((val, index) => {
392
+ * console.log(`${index}: ${val}`);
393
+ * });
394
+ * ```
395
+ *
396
+ * Launching the Node.js process as:
397
+ *
398
+ * ```bash
399
+ * node process-args.js one two=three four
400
+ * ```
401
+ *
402
+ * Would generate the output:
403
+ *
404
+ * ```text
405
+ * 0: /usr/local/bin/node
406
+ * 1: /Users/mjr/work/node/process-args.js
407
+ * 2: one
408
+ * 3: two=three
409
+ * 4: four
410
+ * ```
411
+ * @since v0.1.27
412
+ */
413
+ argv: string[];
414
+ /**
415
+ * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts.
416
+ *
417
+ * ```console
418
+ * $ bash -c 'exec -a customArgv0 ./node'
419
+ * > process.argv[0]
420
+ * '/Volumes/code/external/node/out/Release/node'
421
+ * > process.argv0
422
+ * 'customArgv0'
423
+ * ```
424
+ * @since v6.4.0
425
+ */
426
+ argv0: string;
427
+ /**
428
+ * The `process.execArgv` property returns the set of Node.js-specific command-line
429
+ * options passed when the Node.js process was launched. These options do not
430
+ * appear in the array returned by the {@link argv} property, and do not
431
+ * include the Node.js executable, the name of the script, or any options following
432
+ * the script name. These options are useful in order to spawn child processes with
433
+ * the same execution environment as the parent.
434
+ *
435
+ * ```bash
436
+ * node --icu-data-dir=./foo --require ./bar.js script.js --version
437
+ * ```
438
+ *
439
+ * Results in `process.execArgv`:
440
+ *
441
+ * ```js
442
+ * ["--icu-data-dir=./foo", "--require", "./bar.js"]
443
+ * ```
444
+ *
445
+ * And `process.argv`:
446
+ *
447
+ * ```js
448
+ * ['/usr/local/bin/node', 'script.js', '--version']
449
+ * ```
450
+ *
451
+ * Refer to `Worker constructor` for the detailed behavior of worker
452
+ * threads with this property.
453
+ * @since v0.7.7
454
+ */
455
+ execArgv: string[];
456
+ /**
457
+ * The `process.execPath` property returns the absolute pathname of the executable
458
+ * that started the Node.js process. Symbolic links, if any, are resolved.
459
+ *
460
+ * ```js
461
+ * '/usr/local/bin/node'
462
+ * ```
463
+ * @since v0.1.100
464
+ */
465
+ execPath: string;
466
+ /**
467
+ * The `process.abort()` method causes the Node.js process to exit immediately and
468
+ * generate a core file.
469
+ *
470
+ * This feature is not available in `Worker` threads.
471
+ * @since v0.7.0
472
+ */
473
+ abort(): never;
474
+ /**
475
+ * The `process.chdir()` method changes the current working directory of the
476
+ * Node.js process or throws an exception if doing so fails (for instance, if
477
+ * the specified `directory` does not exist).
478
+ *
479
+ * ```js
480
+ * import { chdir, cwd } from 'node:process';
481
+ *
482
+ * console.log(`Starting directory: ${cwd()}`);
483
+ * try {
484
+ * chdir('/tmp');
485
+ * console.log(`New directory: ${cwd()}`);
486
+ * } catch (err) {
487
+ * console.error(`chdir: ${err}`);
488
+ * }
489
+ * ```
490
+ *
491
+ * This feature is not available in `Worker` threads.
492
+ * @since v0.1.17
493
+ */
494
+ chdir(directory: string): void;
495
+ /**
496
+ * The `process.cwd()` method returns the current working directory of the Node.js
497
+ * process.
498
+ *
499
+ * ```js
500
+ * import { cwd } from 'node:process';
501
+ *
502
+ * console.log(`Current directory: ${cwd()}`);
503
+ * ```
504
+ * @since v0.1.8
505
+ */
506
+ cwd(): string;
507
+ /**
508
+ * The port used by the Node.js debugger when enabled.
509
+ *
510
+ * ```js
511
+ * import process from 'node:process';
512
+ *
513
+ * process.debugPort = 5858;
514
+ * ```
515
+ * @since v0.7.2
516
+ */
517
+ debugPort: number;
518
+ /**
519
+ * The `process.dlopen()` method allows dynamically loading shared objects. It is primarily used by `require()` to load C++ Addons, and
520
+ * should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`
521
+ * unless there are specific reasons such as custom dlopen flags or loading from ES modules.
522
+ *
523
+ * The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v20.x/api/os.html#dlopen-constants)`
524
+ * documentation for details.
525
+ *
526
+ * An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon
527
+ * are then accessible via `module.exports`.
528
+ *
529
+ * The example below shows how to load a C++ Addon, named `local.node`, that exports a `foo` function. All the symbols are loaded before the call returns, by passing the `RTLD_NOW` constant.
530
+ * In this example the constant is assumed to be available.
531
+ *
532
+ * ```js
533
+ * import { dlopen } from 'node:process';
534
+ * import { constants } from 'node:os';
535
+ * import { fileURLToPath } from 'node:url';
536
+ *
537
+ * const module = { exports: {} };
538
+ * dlopen(module, fileURLToPath(new URL('local.node', import.meta.url)),
539
+ * constants.dlopen.RTLD_NOW);
540
+ * module.exports.foo();
541
+ * ```
542
+ */
543
+ dlopen(module: object, filename: string, flags?: number): void;
544
+ /**
545
+ * The `process.emitWarning()` method can be used to emit custom or application
546
+ * specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
547
+ *
548
+ * ```js
549
+ * import { emitWarning } from 'node:process';
550
+ *
551
+ * // Emit a warning using a string.
552
+ * emitWarning('Something happened!');
553
+ * // Emits: (node: 56338) Warning: Something happened!
554
+ * ```
555
+ *
556
+ * ```js
557
+ * import { emitWarning } from 'node:process';
558
+ *
559
+ * // Emit a warning using a string and a type.
560
+ * emitWarning('Something Happened!', 'CustomWarning');
561
+ * // Emits: (node:56338) CustomWarning: Something Happened!
562
+ * ```
563
+ *
564
+ * ```js
565
+ * import { emitWarning } from 'node:process';
566
+ *
567
+ * emitWarning('Something happened!', 'CustomWarning', 'WARN001');
568
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
569
+ * ```js
570
+ *
571
+ * In each of the previous examples, an `Error` object is generated internally by `process.emitWarning()` and passed through to the `'warning'` handler.
572
+ *
573
+ * ```js
574
+ * import process from 'node:process';
575
+ *
576
+ * process.on('warning', (warning) => {
577
+ * console.warn(warning.name); // 'Warning'
578
+ * console.warn(warning.message); // 'Something happened!'
579
+ * console.warn(warning.code); // 'MY_WARNING'
580
+ * console.warn(warning.stack); // Stack trace
581
+ * console.warn(warning.detail); // 'This is some additional information'
582
+ * });
583
+ * ```
584
+ *
585
+ * If `warning` is passed as an `Error` object, it will be passed through to the `'warning'` event handler
586
+ * unmodified (and the optional `type`, `code` and `ctor` arguments will be ignored):
587
+ *
588
+ * ```js
589
+ * import { emitWarning } from 'node:process';
590
+ *
591
+ * // Emit a warning using an Error object.
592
+ * const myWarning = new Error('Something happened!');
593
+ * // Use the Error name property to specify the type name
594
+ * myWarning.name = 'CustomWarning';
595
+ * myWarning.code = 'WARN001';
596
+ *
597
+ * emitWarning(myWarning);
598
+ * // Emits: (node:56338) [WARN001] CustomWarning: Something happened!
599
+ * ```
600
+ *
601
+ * A `TypeError` is thrown if `warning` is anything other than a string or `Error` object.
602
+ *
603
+ * While process warnings use `Error` objects, the process warning mechanism is not a replacement for normal error handling mechanisms.
604
+ *
605
+ * The following additional handling is implemented if the warning `type` is `'DeprecationWarning'`:
606
+ * * If the `--throw-deprecation` command-line flag is used, the deprecation warning is thrown as an exception rather than being emitted as an event.
607
+ * * If the `--no-deprecation` command-line flag is used, the deprecation warning is suppressed.
608
+ * * If the `--trace-deprecation` command-line flag is used, the deprecation warning is printed to `stderr` along with the full stack trace.
609
+ * @since v8.0.0
610
+ * @param warning The warning to emit.
611
+ */
612
+ emitWarning(warning: string | Error, ctor?: Function): void;
613
+ emitWarning(warning: string | Error, type?: string, ctor?: Function): void;
614
+ emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void;
615
+ emitWarning(warning: string | Error, options?: EmitWarningOptions): void;
616
+ /**
617
+ * The `process.env` property returns an object containing the user environment.
618
+ * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html).
619
+ *
620
+ * An example of this object looks like:
621
+ *
622
+ * ```js
623
+ * {
624
+ * TERM: 'xterm-256color',
625
+ * SHELL: '/usr/local/bin/bash',
626
+ * USER: 'maciej',
627
+ * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
628
+ * PWD: '/Users/maciej',
629
+ * EDITOR: 'vim',
630
+ * SHLVL: '1',
631
+ * HOME: '/Users/maciej',
632
+ * LOGNAME: 'maciej',
633
+ * _: '/usr/local/bin/node'
634
+ * }
635
+ * ```
636
+ *
637
+ * It is possible to modify this object, but such modifications will not be
638
+ * reflected outside the Node.js process, or (unless explicitly requested)
639
+ * to other `Worker` threads.
640
+ * In other words, the following example would not work:
641
+ *
642
+ * ```bash
643
+ * node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
644
+ * ```
645
+ *
646
+ * While the following will:
647
+ *
648
+ * ```js
649
+ * import { env } from 'node:process';
650
+ *
651
+ * env.foo = 'bar';
652
+ * console.log(env.foo);
653
+ * ```
654
+ *
655
+ * Assigning a property on `process.env` will implicitly convert the value
656
+ * to a string. **This behavior is deprecated.** Future versions of Node.js may
657
+ * throw an error when the value is not a string, number, or boolean.
658
+ *
659
+ * ```js
660
+ * import { env } from 'node:process';
661
+ *
662
+ * env.test = null;
663
+ * console.log(env.test);
664
+ * // => 'null'
665
+ * env.test = undefined;
666
+ * console.log(env.test);
667
+ * // => 'undefined'
668
+ * ```
669
+ *
670
+ * Use `delete` to delete a property from `process.env`.
671
+ *
672
+ * ```js
673
+ * import { env } from 'node:process';
674
+ *
675
+ * env.TEST = 1;
676
+ * delete env.TEST;
677
+ * console.log(env.TEST);
678
+ * // => undefined
679
+ * ```
680
+ *
681
+ * On Windows operating systems, environment variables are case-insensitive.
682
+ *
683
+ * ```js
684
+ * import { env } from 'node:process';
685
+ *
686
+ * env.TEST = 1;
687
+ * console.log(env.test);
688
+ * // => 1
689
+ * ```
690
+ *
691
+ * Unless explicitly specified when creating a `Worker` instance,
692
+ * each `Worker` thread has its own copy of `process.env`, based on its
693
+ * parent thread's `process.env`, or whatever was specified as the `env` option
694
+ * to the `Worker` constructor. Changes to `process.env` will not be visible
695
+ * across `Worker` threads, and only the main thread can make changes that
696
+ * are visible to the operating system or to native add-ons. On Windows, a copy of `process.env` on a `Worker` instance operates in a case-sensitive manner
697
+ * unlike the main thread.
698
+ * @since v0.1.27
699
+ */
700
+ env: ProcessEnv;
701
+ /**
702
+ * The `process.exit()` method instructs Node.js to terminate the process
703
+ * synchronously with an exit status of `code`. If `code` is omitted, exit uses
704
+ * either the 'success' code `0` or the value of `process.exitCode` if it has been
705
+ * set. Node.js will not terminate until all the `'exit'` event listeners are
706
+ * called.
707
+ *
708
+ * To exit with a 'failure' code:
709
+ *
710
+ * ```js
711
+ * import { exit } from 'node:process';
712
+ *
713
+ * exit(1);
714
+ * ```
715
+ *
716
+ * The shell that executed Node.js should see the exit code as `1`.
717
+ *
718
+ * Calling `process.exit()` will force the process to exit as quickly as possible
719
+ * even if there are still asynchronous operations pending that have not yet
720
+ * completed fully, including I/O operations to `process.stdout` and `process.stderr`.
721
+ *
722
+ * In most situations, it is not actually necessary to call `process.exit()` explicitly. The Node.js process will exit on its own _if there is no additional_
723
+ * _work pending_ in the event loop. The `process.exitCode` property can be set to
724
+ * tell the process which exit code to use when the process exits gracefully.
725
+ *
726
+ * For instance, the following example illustrates a _misuse_ of the `process.exit()` method that could lead to data printed to stdout being
727
+ * truncated and lost:
728
+ *
729
+ * ```js
730
+ * import { exit } from 'node:process';
731
+ *
732
+ * // This is an example of what *not* to do:
733
+ * if (someConditionNotMet()) {
734
+ * printUsageToStdout();
735
+ * exit(1);
736
+ * }
737
+ * ```
738
+ *
739
+ * The reason this is problematic is because writes to `process.stdout` in Node.js
740
+ * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
741
+ * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
742
+ *
743
+ * Rather than calling `process.exit()` directly, the code _should_ set the `process.exitCode` and allow the process to exit naturally by avoiding
744
+ * scheduling any additional work for the event loop:
745
+ *
746
+ * ```js
747
+ * import process from 'node:process';
748
+ *
749
+ * // How to properly set the exit code while letting
750
+ * // the process exit gracefully.
751
+ * if (someConditionNotMet()) {
752
+ * printUsageToStdout();
753
+ * process.exitCode = 1;
754
+ * }
755
+ * ```
756
+ *
757
+ * If it is necessary to terminate the Node.js process due to an error condition,
758
+ * throwing an _uncaught_ error and allowing the process to terminate accordingly
759
+ * is safer than calling `process.exit()`.
760
+ *
761
+ * In `Worker` threads, this function stops the current thread rather
762
+ * than the current process.
763
+ * @since v0.1.13
764
+ * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
765
+ */
766
+ exit(code?: number | string | null | undefined): never;
767
+ /**
768
+ * A number which will be the process exit code, when the process either
769
+ * exits gracefully, or is exited via {@link exit} without specifying
770
+ * a code.
771
+ *
772
+ * Specifying a code to {@link exit} will override any
773
+ * previous setting of `process.exitCode`.
774
+ * @default undefined
775
+ * @since v0.11.8
776
+ */
777
+ exitCode?: number | string | number | undefined;
778
+ /**
779
+ * The `process.getActiveResourcesInfo()` method returns an array of strings containing
780
+ * the types of the active resources that are currently keeping the event loop alive.
781
+ *
782
+ * ```js
783
+ * import { getActiveResourcesInfo } from 'node:process';
784
+ * import { setTimeout } from 'node:timers';
785
+
786
+ * console.log('Before:', getActiveResourcesInfo());
787
+ * setTimeout(() => {}, 1000);
788
+ * console.log('After:', getActiveResourcesInfo());
789
+ * // Prints:
790
+ * // Before: [ 'TTYWrap', 'TTYWrap', 'TTYWrap' ]
791
+ * // After: [ 'TTYWrap', 'TTYWrap', 'TTYWrap', 'Timeout' ]
792
+ * ```
793
+ * @since v17.3.0, v16.14.0
794
+ */
795
+ getActiveResourcesInfo(): string[];
796
+ /**
797
+ * The `process.getgid()` method returns the numerical group identity of the
798
+ * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
799
+ *
800
+ * ```js
801
+ * import process from 'node:process';
802
+ *
803
+ * if (process.getgid) {
804
+ * console.log(`Current gid: ${process.getgid()}`);
805
+ * }
806
+ * ```
807
+ *
808
+ * This function is only available on POSIX platforms (i.e. not Windows or
809
+ * Android).
810
+ * @since v0.1.31
811
+ */
812
+ getgid?: () => number;
813
+ /**
814
+ * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
815
+ * numeric ID or a group name
816
+ * string. If a group name is specified, this method blocks while resolving the
817
+ * associated numeric ID.
818
+ *
819
+ * ```js
820
+ * import process from 'node:process';
821
+ *
822
+ * if (process.getgid &#x26;&#x26; process.setgid) {
823
+ * console.log(`Current gid: ${process.getgid()}`);
824
+ * try {
825
+ * process.setgid(501);
826
+ * console.log(`New gid: ${process.getgid()}`);
827
+ * } catch (err) {
828
+ * console.log(`Failed to set gid: ${err}`);
829
+ * }
830
+ * }
831
+ * ```
832
+ *
833
+ * This function is only available on POSIX platforms (i.e. not Windows or
834
+ * Android).
835
+ * This feature is not available in `Worker` threads.
836
+ * @since v0.1.31
837
+ * @param id The group name or ID
838
+ */
839
+ setgid?: (id: number | string) => void;
840
+ /**
841
+ * The `process.getuid()` method returns the numeric user identity of the process.
842
+ * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
843
+ *
844
+ * ```js
845
+ * import process from 'node:process';
846
+ *
847
+ * if (process.getuid) {
848
+ * console.log(`Current uid: ${process.getuid()}`);
849
+ * }
850
+ * ```
851
+ *
852
+ * This function is only available on POSIX platforms (i.e. not Windows or
853
+ * Android).
854
+ * @since v0.1.28
855
+ */
856
+ getuid?: () => number;
857
+ /**
858
+ * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
859
+ * numeric ID or a username string.
860
+ * If a username is specified, the method blocks while resolving the associated
861
+ * numeric ID.
862
+ *
863
+ * ```js
864
+ * import process from 'node:process';
865
+ *
866
+ * if (process.getuid &#x26;&#x26; process.setuid) {
867
+ * console.log(`Current uid: ${process.getuid()}`);
868
+ * try {
869
+ * process.setuid(501);
870
+ * console.log(`New uid: ${process.getuid()}`);
871
+ * } catch (err) {
872
+ * console.log(`Failed to set uid: ${err}`);
873
+ * }
874
+ * }
875
+ * ```
876
+ *
877
+ * This function is only available on POSIX platforms (i.e. not Windows or
878
+ * Android).
879
+ * This feature is not available in `Worker` threads.
880
+ * @since v0.1.28
881
+ */
882
+ setuid?: (id: number | string) => void;
883
+ /**
884
+ * The `process.geteuid()` method returns the numerical effective user identity of
885
+ * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
886
+ *
887
+ * ```js
888
+ * import process from 'node:process';
889
+ *
890
+ * if (process.geteuid) {
891
+ * console.log(`Current uid: ${process.geteuid()}`);
892
+ * }
893
+ * ```
894
+ *
895
+ * This function is only available on POSIX platforms (i.e. not Windows or
896
+ * Android).
897
+ * @since v2.0.0
898
+ */
899
+ geteuid?: () => number;
900
+ /**
901
+ * The `process.seteuid()` method sets the effective user identity of the process.
902
+ * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
903
+ * string. If a username is specified, the method blocks while resolving the
904
+ * associated numeric ID.
905
+ *
906
+ * ```js
907
+ * import process from 'node:process';
908
+ *
909
+ * if (process.geteuid &#x26;&#x26; process.seteuid) {
910
+ * console.log(`Current uid: ${process.geteuid()}`);
911
+ * try {
912
+ * process.seteuid(501);
913
+ * console.log(`New uid: ${process.geteuid()}`);
914
+ * } catch (err) {
915
+ * console.log(`Failed to set uid: ${err}`);
916
+ * }
917
+ * }
918
+ * ```
919
+ *
920
+ * This function is only available on POSIX platforms (i.e. not Windows or
921
+ * Android).
922
+ * This feature is not available in `Worker` threads.
923
+ * @since v2.0.0
924
+ * @param id A user name or ID
925
+ */
926
+ seteuid?: (id: number | string) => void;
927
+ /**
928
+ * The `process.getegid()` method returns the numerical effective group identity
929
+ * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
930
+ *
931
+ * ```js
932
+ * import process from 'node:process';
933
+ *
934
+ * if (process.getegid) {
935
+ * console.log(`Current gid: ${process.getegid()}`);
936
+ * }
937
+ * ```
938
+ *
939
+ * This function is only available on POSIX platforms (i.e. not Windows or
940
+ * Android).
941
+ * @since v2.0.0
942
+ */
943
+ getegid?: () => number;
944
+ /**
945
+ * The `process.setegid()` method sets the effective group identity of the process.
946
+ * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
947
+ * name string. If a group name is specified, this method blocks while resolving
948
+ * the associated a numeric ID.
949
+ *
950
+ * ```js
951
+ * import process from 'node:process';
952
+ *
953
+ * if (process.getegid &#x26;&#x26; process.setegid) {
954
+ * console.log(`Current gid: ${process.getegid()}`);
955
+ * try {
956
+ * process.setegid(501);
957
+ * console.log(`New gid: ${process.getegid()}`);
958
+ * } catch (err) {
959
+ * console.log(`Failed to set gid: ${err}`);
960
+ * }
961
+ * }
962
+ * ```
963
+ *
964
+ * This function is only available on POSIX platforms (i.e. not Windows or
965
+ * Android).
966
+ * This feature is not available in `Worker` threads.
967
+ * @since v2.0.0
968
+ * @param id A group name or ID
969
+ */
970
+ setegid?: (id: number | string) => void;
971
+ /**
972
+ * The `process.getgroups()` method returns an array with the supplementary group
973
+ * IDs. POSIX leaves it unspecified if the effective group ID is included but
974
+ * Node.js ensures it always is.
975
+ *
976
+ * ```js
977
+ * import process from 'node:process';
978
+ *
979
+ * if (process.getgroups) {
980
+ * console.log(process.getgroups()); // [ 16, 21, 297 ]
981
+ * }
982
+ * ```
983
+ *
984
+ * This function is only available on POSIX platforms (i.e. not Windows or
985
+ * Android).
986
+ * @since v0.9.4
987
+ */
988
+ getgroups?: () => number[];
989
+ /**
990
+ * The `process.setgroups()` method sets the supplementary group IDs for the
991
+ * Node.js process. This is a privileged operation that requires the Node.js
992
+ * process to have `root` or the `CAP_SETGID` capability.
993
+ *
994
+ * The `groups` array can contain numeric group IDs, group names, or both.
995
+ *
996
+ * ```js
997
+ * import process from 'node:process';
998
+ *
999
+ * if (process.getgroups &#x26;&#x26; process.setgroups) {
1000
+ * try {
1001
+ * process.setgroups([501]);
1002
+ * console.log(process.getgroups()); // new groups
1003
+ * } catch (err) {
1004
+ * console.log(`Failed to set groups: ${err}`);
1005
+ * }
1006
+ * }
1007
+ * ```
1008
+ *
1009
+ * This function is only available on POSIX platforms (i.e. not Windows or
1010
+ * Android).
1011
+ * This feature is not available in `Worker` threads.
1012
+ * @since v0.9.4
1013
+ */
1014
+ setgroups?: (groups: ReadonlyArray<string | number>) => void;
1015
+ /**
1016
+ * The `process.setUncaughtExceptionCaptureCallback()` function sets a function
1017
+ * that will be invoked when an uncaught exception occurs, which will receive the
1018
+ * exception value itself as its first argument.
1019
+ *
1020
+ * If such a function is set, the `'uncaughtException'` event will
1021
+ * not be emitted. If `--abort-on-uncaught-exception` was passed from the
1022
+ * command line or set through `v8.setFlagsFromString()`, the process will
1023
+ * not abort. Actions configured to take place on exceptions such as report
1024
+ * generations will be affected too
1025
+ *
1026
+ * To unset the capture function, `process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this
1027
+ * method with a non-`null` argument while another capture function is set will
1028
+ * throw an error.
1029
+ *
1030
+ * Using this function is mutually exclusive with using the deprecated `domain` built-in module.
1031
+ * @since v9.3.0
1032
+ */
1033
+ setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
1034
+ /**
1035
+ * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}.
1036
+ * @since v9.3.0
1037
+ */
1038
+ hasUncaughtExceptionCaptureCallback(): boolean;
1039
+ /**
1040
+ * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled.
1041
+ * @since v20.7.0
1042
+ * @experimental
1043
+ */
1044
+ readonly sourceMapsEnabled: boolean;
1045
+ /**
1046
+ * This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for
1047
+ * stack traces.
1048
+ *
1049
+ * It provides same features as launching Node.js process with commandline options `--enable-source-maps`.
1050
+ *
1051
+ * Only source maps in JavaScript files that are loaded after source maps has been
1052
+ * enabled will be parsed and loaded.
1053
+ * @since v16.6.0, v14.18.0
1054
+ * @experimental
1055
+ */
1056
+ setSourceMapsEnabled(value: boolean): void;
1057
+ /**
1058
+ * The `process.version` property contains the Node.js version string.
1059
+ *
1060
+ * ```js
1061
+ * import { version } from 'node:process';
1062
+ *
1063
+ * console.log(`Version: ${version}`);
1064
+ * // Version: v14.8.0
1065
+ * ```
1066
+ *
1067
+ * To get the version string without the prepended _v_, use`process.versions.node`.
1068
+ * @since v0.1.3
1069
+ */
1070
+ readonly version: string;
1071
+ /**
1072
+ * The `process.versions` property returns an object listing the version strings of
1073
+ * Node.js and its dependencies. `process.versions.modules` indicates the current
1074
+ * ABI version, which is increased whenever a C++ API changes. Node.js will refuse
1075
+ * to load modules that were compiled against a different module ABI version.
1076
+ *
1077
+ * ```js
1078
+ * import { versions } from 'node:process';
1079
+ *
1080
+ * console.log(versions);
1081
+ * ```
1082
+ *
1083
+ * Will generate an object similar to:
1084
+ *
1085
+ * ```console
1086
+ * { node: '20.2.0',
1087
+ * acorn: '8.8.2',
1088
+ * ada: '2.4.0',
1089
+ * ares: '1.19.0',
1090
+ * base64: '0.5.0',
1091
+ * brotli: '1.0.9',
1092
+ * cjs_module_lexer: '1.2.2',
1093
+ * cldr: '43.0',
1094
+ * icu: '73.1',
1095
+ * llhttp: '8.1.0',
1096
+ * modules: '115',
1097
+ * napi: '8',
1098
+ * nghttp2: '1.52.0',
1099
+ * nghttp3: '0.7.0',
1100
+ * ngtcp2: '0.8.1',
1101
+ * openssl: '3.0.8+quic',
1102
+ * simdutf: '3.2.9',
1103
+ * tz: '2023c',
1104
+ * undici: '5.22.0',
1105
+ * unicode: '15.0',
1106
+ * uv: '1.44.2',
1107
+ * uvwasi: '0.0.16',
1108
+ * v8: '11.3.244.8-node.9',
1109
+ * zlib: '1.2.13' }
1110
+ * ```
1111
+ * @since v0.2.0
1112
+ */
1113
+ readonly versions: ProcessVersions;
1114
+ /**
1115
+ * The `process.config` property returns a frozen `Object` containing the
1116
+ * JavaScript representation of the configure options used to compile the current
1117
+ * Node.js executable. This is the same as the `config.gypi` file that was produced
1118
+ * when running the `./configure` script.
1119
+ *
1120
+ * An example of the possible output looks like:
1121
+ *
1122
+ * ```js
1123
+ * {
1124
+ * target_defaults:
1125
+ * { cflags: [],
1126
+ * default_configuration: 'Release',
1127
+ * defines: [],
1128
+ * include_dirs: [],
1129
+ * libraries: [] },
1130
+ * variables:
1131
+ * {
1132
+ * host_arch: 'x64',
1133
+ * napi_build_version: 5,
1134
+ * node_install_npm: 'true',
1135
+ * node_prefix: '',
1136
+ * node_shared_cares: 'false',
1137
+ * node_shared_http_parser: 'false',
1138
+ * node_shared_libuv: 'false',
1139
+ * node_shared_zlib: 'false',
1140
+ * node_use_openssl: 'true',
1141
+ * node_shared_openssl: 'false',
1142
+ * strict_aliasing: 'true',
1143
+ * target_arch: 'x64',
1144
+ * v8_use_snapshot: 1
1145
+ * }
1146
+ * }
1147
+ * ```
1148
+ * @since v0.7.7
1149
+ */
1150
+ readonly config: ProcessConfig;
1151
+ /**
1152
+ * The `process.kill()` method sends the `signal` to the process identified by`pid`.
1153
+ *
1154
+ * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information.
1155
+ *
1156
+ * This method will throw an error if the target `pid` does not exist. As a special
1157
+ * case, a signal of `0` can be used to test for the existence of a process.
1158
+ * Windows platforms will throw an error if the `pid` is used to kill a process
1159
+ * group.
1160
+ *
1161
+ * Even though the name of this function is `process.kill()`, it is really just a
1162
+ * signal sender, like the `kill` system call. The signal sent may do something
1163
+ * other than kill the target process.
1164
+ *
1165
+ * ```js
1166
+ * import process, { kill } from 'node:process';
1167
+ *
1168
+ * process.on('SIGHUP', () => {
1169
+ * console.log('Got SIGHUP signal.');
1170
+ * });
1171
+ *
1172
+ * setTimeout(() => {
1173
+ * console.log('Exiting.');
1174
+ * process.exit(0);
1175
+ * }, 100);
1176
+ *
1177
+ * kill(process.pid, 'SIGHUP');
1178
+ * ```
1179
+ *
1180
+ * When `SIGUSR1` is received by a Node.js process, Node.js will start the
1181
+ * debugger. See `Signal Events`.
1182
+ * @since v0.0.6
1183
+ * @param pid A process ID
1184
+ * @param [signal='SIGTERM'] The signal to send, either as a string or number.
1185
+ */
1186
+ kill(pid: number, signal?: string | number): true;
1187
+ /**
1188
+ * Loads the environment configuration from a `.env` file into `process.env`. If
1189
+ * the file is not found, error will be thrown.
1190
+ *
1191
+ * To load a specific .env file by specifying its path, use the following code:
1192
+ *
1193
+ * ```js
1194
+ * import { loadEnvFile } from 'node:process';
1195
+ *
1196
+ * loadEnvFile('./development.env')
1197
+ * ```
1198
+ * @since v20.12.0
1199
+ * @param path The path to the .env file
1200
+ */
1201
+ loadEnvFile(path?: string | URL | Buffer): void;
1202
+ /**
1203
+ * The `process.pid` property returns the PID of the process.
1204
+ *
1205
+ * ```js
1206
+ * import { pid } from 'node:process';
1207
+ *
1208
+ * console.log(`This process is pid ${pid}`);
1209
+ * ```
1210
+ * @since v0.1.15
1211
+ */
1212
+ readonly pid: number;
1213
+ /**
1214
+ * The `process.ppid` property returns the PID of the parent of the
1215
+ * current process.
1216
+ *
1217
+ * ```js
1218
+ * import { ppid } from 'node:process';
1219
+ *
1220
+ * console.log(`The parent process is pid ${ppid}`);
1221
+ * ```
1222
+ * @since v9.2.0, v8.10.0, v6.13.0
1223
+ */
1224
+ readonly ppid: number;
1225
+ /**
1226
+ * The `process.title` property returns the current process title (i.e. returns
1227
+ * the current value of `ps`). Assigning a new value to `process.title` modifies
1228
+ * the current value of `ps`.
1229
+ *
1230
+ * When a new value is assigned, different platforms will impose different maximum
1231
+ * length restrictions on the title. Usually such restrictions are quite limited.
1232
+ * For instance, on Linux and macOS, `process.title` is limited to the size of the
1233
+ * binary name plus the length of the command-line arguments because setting the `process.title` overwrites the `argv` memory of the process. Node.js v0.8
1234
+ * allowed for longer process title strings by also overwriting the `environ` memory but that was potentially insecure and confusing in some (rather obscure)
1235
+ * cases.
1236
+ *
1237
+ * Assigning a value to `process.title` might not result in an accurate label
1238
+ * within process manager applications such as macOS Activity Monitor or Windows
1239
+ * Services Manager.
1240
+ * @since v0.1.104
1241
+ */
1242
+ title: string;
1243
+ /**
1244
+ * The operating system CPU architecture for which the Node.js binary was compiled.
1245
+ * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
1246
+ *
1247
+ * ```js
1248
+ * import { arch } from 'node:process';
1249
+ *
1250
+ * console.log(`This processor architecture is ${arch}`);
1251
+ * ```
1252
+ * @since v0.5.0
1253
+ */
1254
+ readonly arch: Architecture;
1255
+ /**
1256
+ * The `process.platform` property returns a string identifying the operating
1257
+ * system platform for which the Node.js binary was compiled.
1258
+ *
1259
+ * Currently possible values are:
1260
+ *
1261
+ * * `'aix'`
1262
+ * * `'darwin'`
1263
+ * * `'freebsd'`
1264
+ * * `'linux'`
1265
+ * * `'openbsd'`
1266
+ * * `'sunos'`
1267
+ * * `'win32'`
1268
+ *
1269
+ * ```js
1270
+ * import { platform } from 'node:process';
1271
+ *
1272
+ * console.log(`This platform is ${platform}`);
1273
+ * ```
1274
+ *
1275
+ * The value `'android'` may also be returned if the Node.js is built on the
1276
+ * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
1277
+ * @since v0.1.16
1278
+ */
1279
+ readonly platform: Platform;
1280
+ /**
1281
+ * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at
1282
+ * runtime, `require.main` may still refer to the original main module in
1283
+ * modules that were required before the change occurred. Generally, it's
1284
+ * safe to assume that the two refer to the same module.
1285
+ *
1286
+ * As with `require.main`, `process.mainModule` will be `undefined` if there
1287
+ * is no entry script.
1288
+ * @since v0.1.17
1289
+ * @deprecated Since v14.0.0 - Use `main` instead.
1290
+ */
1291
+ mainModule?: Module | undefined;
1292
+ memoryUsage: MemoryUsageFn;
1293
+ /**
1294
+ * Gets the amount of memory available to the process (in bytes) based on
1295
+ * limits imposed by the OS. If there is no such constraint, or the constraint
1296
+ * is unknown, `0` is returned.
1297
+ *
1298
+ * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
1299
+ * information.
1300
+ * @since v19.6.0, v18.15.0
1301
+ * @experimental
1302
+ */
1303
+ constrainedMemory(): number;
1304
+ /**
1305
+ * Gets the amount of free memory that is still available to the process (in bytes).
1306
+ * See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v20.x/api/process.html#processavailablememory) for more information.
1307
+ * @experimental
1308
+ * @since v20.13.0
1309
+ */
1310
+ availableMemory(): number;
1311
+ /**
1312
+ * The `process.cpuUsage()` method returns the user and system CPU time usage of
1313
+ * the current process, in an object with properties `user` and `system`, whose
1314
+ * values are microsecond values (millionth of a second). These values measure time
1315
+ * spent in user and system code respectively, and may end up being greater than
1316
+ * actual elapsed time if multiple CPU cores are performing work for this process.
1317
+ *
1318
+ * The result of a previous call to `process.cpuUsage()` can be passed as the
1319
+ * argument to the function, to get a diff reading.
1320
+ *
1321
+ * ```js
1322
+ * import { cpuUsage } from 'node:process';
1323
+ *
1324
+ * const startUsage = cpuUsage();
1325
+ * // { user: 38579, system: 6986 }
1326
+ *
1327
+ * // spin the CPU for 500 milliseconds
1328
+ * const now = Date.now();
1329
+ * while (Date.now() - now < 500);
1330
+ *
1331
+ * console.log(cpuUsage(startUsage));
1332
+ * // { user: 514883, system: 11226 }
1333
+ * ```
1334
+ * @since v6.1.0
1335
+ * @param previousValue A previous return value from calling `process.cpuUsage()`
1336
+ */
1337
+ cpuUsage(previousValue?: CpuUsage): CpuUsage;
1338
+ /**
1339
+ * `process.nextTick()` adds `callback` to the "next tick queue". This queue is
1340
+ * fully drained after the current operation on the JavaScript stack runs to
1341
+ * completion and before the event loop is allowed to continue. It's possible to
1342
+ * create an infinite loop if one were to recursively call `process.nextTick()`.
1343
+ * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
1344
+ *
1345
+ * ```js
1346
+ * import { nextTick } from 'node:process';
1347
+ *
1348
+ * console.log('start');
1349
+ * nextTick(() => {
1350
+ * console.log('nextTick callback');
1351
+ * });
1352
+ * console.log('scheduled');
1353
+ * // Output:
1354
+ * // start
1355
+ * // scheduled
1356
+ * // nextTick callback
1357
+ * ```
1358
+ *
1359
+ * This is important when developing APIs in order to give users the opportunity
1360
+ * to assign event handlers _after_ an object has been constructed but before any
1361
+ * I/O has occurred:
1362
+ *
1363
+ * ```js
1364
+ * import { nextTick } from 'node:process';
1365
+ *
1366
+ * function MyThing(options) {
1367
+ * this.setupOptions(options);
1368
+ *
1369
+ * nextTick(() => {
1370
+ * this.startDoingStuff();
1371
+ * });
1372
+ * }
1373
+ *
1374
+ * const thing = new MyThing();
1375
+ * thing.getReadyForStuff();
1376
+ *
1377
+ * // thing.startDoingStuff() gets called now, not before.
1378
+ * ```
1379
+ *
1380
+ * It is very important for APIs to be either 100% synchronous or 100%
1381
+ * asynchronous. Consider this example:
1382
+ *
1383
+ * ```js
1384
+ * // WARNING! DO NOT USE! BAD UNSAFE HAZARD!
1385
+ * function maybeSync(arg, cb) {
1386
+ * if (arg) {
1387
+ * cb();
1388
+ * return;
1389
+ * }
1390
+ *
1391
+ * fs.stat('file', cb);
1392
+ * }
1393
+ * ```
1394
+ *
1395
+ * This API is hazardous because in the following case:
1396
+ *
1397
+ * ```js
1398
+ * const maybeTrue = Math.random() > 0.5;
1399
+ *
1400
+ * maybeSync(maybeTrue, () => {
1401
+ * foo();
1402
+ * });
1403
+ *
1404
+ * bar();
1405
+ * ```
1406
+ *
1407
+ * It is not clear whether `foo()` or `bar()` will be called first.
1408
+ *
1409
+ * The following approach is much better:
1410
+ *
1411
+ * ```js
1412
+ * import { nextTick } from 'node:process';
1413
+ *
1414
+ * function definitelyAsync(arg, cb) {
1415
+ * if (arg) {
1416
+ * nextTick(cb);
1417
+ * return;
1418
+ * }
1419
+ *
1420
+ * fs.stat('file', cb);
1421
+ * }
1422
+ * ```
1423
+ * @since v0.1.26
1424
+ * @param args Additional arguments to pass when invoking the `callback`
1425
+ */
1426
+ nextTick(callback: Function, ...args: any[]): void;
1427
+ /**
1428
+ * This API is available through the [--experimental-permission](https://nodejs.org/api/cli.html#--experimental-permission) flag.
1429
+ *
1430
+ * `process.permission` is an object whose methods are used to manage permissions for the current process.
1431
+ * Additional documentation is available in the [Permission Model](https://nodejs.org/api/permissions.html#permission-model).
1432
+ * @since v20.0.0
1433
+ */
1434
+ permission: ProcessPermission;
1435
+ /**
1436
+ * The `process.release` property returns an `Object` containing metadata related
1437
+ * to the current release, including URLs for the source tarball and headers-only
1438
+ * tarball.
1439
+ *
1440
+ * `process.release` contains the following properties:
1441
+ *
1442
+ * ```js
1443
+ * {
1444
+ * name: 'node',
1445
+ * lts: 'Hydrogen',
1446
+ * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
1447
+ * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
1448
+ * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
1449
+ * }
1450
+ * ```
1451
+ *
1452
+ * In custom builds from non-release versions of the source tree, only the `name` property may be present. The additional properties should not be
1453
+ * relied upon to exist.
1454
+ * @since v3.0.0
1455
+ */
1456
+ readonly release: ProcessRelease;
1457
+ features: {
1458
+ inspector: boolean;
1459
+ debug: boolean;
1460
+ uv: boolean;
1461
+ ipv6: boolean;
1462
+ tls_alpn: boolean;
1463
+ tls_sni: boolean;
1464
+ tls_ocsp: boolean;
1465
+ tls: boolean;
1466
+ };
1467
+ /**
1468
+ * `process.umask()` returns the Node.js process's file mode creation mask. Child
1469
+ * processes inherit the mask from the parent process.
1470
+ * @since v0.1.19
1471
+ * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential
1472
+ * security vulnerability. There is no safe, cross-platform alternative API.
1473
+ */
1474
+ umask(): number;
1475
+ /**
1476
+ * Can only be set if not in worker thread.
1477
+ */
1478
+ umask(mask: string | number): number;
1479
+ /**
1480
+ * The `process.uptime()` method returns the number of seconds the current Node.js
1481
+ * process has been running.
1482
+ *
1483
+ * The return value includes fractions of a second. Use `Math.floor()` to get whole
1484
+ * seconds.
1485
+ * @since v0.5.0
1486
+ */
1487
+ uptime(): number;
1488
+ hrtime: HRTime;
1489
+ /**
1490
+ * If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel.
1491
+ * If no IPC channel exists, this property is undefined.
1492
+ * @since v7.1.0
1493
+ */
1494
+ channel?: {
1495
+ /**
1496
+ * This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
1497
+ * @since v7.1.0
1498
+ */
1499
+ ref(): void;
1500
+ /**
1501
+ * This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
1502
+ * @since v7.1.0
1503
+ */
1504
+ unref(): void;
1505
+ };
1506
+ /**
1507
+ * If Node.js is spawned with an IPC channel, the `process.send()` method can be
1508
+ * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
1509
+ *
1510
+ * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
1511
+ *
1512
+ * The message goes through serialization and parsing. The resulting message might
1513
+ * not be the same as what is originally sent.
1514
+ * @since v0.5.9
1515
+ * @param options used to parameterize the sending of certain types of handles. `options` supports the following properties:
1516
+ */
1517
+ send?(
1518
+ message: any,
1519
+ sendHandle?: any,
1520
+ options?: {
1521
+ keepOpen?: boolean | undefined;
1522
+ },
1523
+ callback?: (error: Error | null) => void,
1524
+ ): boolean;
1525
+ /**
1526
+ * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
1527
+ * IPC channel to the parent process, allowing the child process to exit gracefully
1528
+ * once there are no other connections keeping it alive.
1529
+ *
1530
+ * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process.
1531
+ *
1532
+ * If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`.
1533
+ * @since v0.7.2
1534
+ */
1535
+ disconnect(): void;
1536
+ /**
1537
+ * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return `true` so long as the IPC
1538
+ * channel is connected and will return `false` after `process.disconnect()` is called.
1539
+ *
1540
+ * Once `process.connected` is `false`, it is no longer possible to send messages
1541
+ * over the IPC channel using `process.send()`.
1542
+ * @since v0.7.2
1543
+ */
1544
+ connected: boolean;
1545
+ /**
1546
+ * The `process.allowedNodeEnvironmentFlags` property is a special,
1547
+ * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable.
1548
+ *
1549
+ * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides `Set.prototype.has` to recognize several different possible flag
1550
+ * representations. `process.allowedNodeEnvironmentFlags.has()` will
1551
+ * return `true` in the following cases:
1552
+ *
1553
+ * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g., `inspect-brk` for `--inspect-brk`, or `r` for `-r`.
1554
+ * * Flags passed through to V8 (as listed in `--v8-options`) may replace
1555
+ * one or more _non-leading_ dashes for an underscore, or vice-versa;
1556
+ * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`,
1557
+ * etc.
1558
+ * * Flags may contain one or more equals (`=`) characters; all
1559
+ * characters after and including the first equals will be ignored;
1560
+ * e.g., `--stack-trace-limit=100`.
1561
+ * * Flags _must_ be allowable within `NODE_OPTIONS`.
1562
+ *
1563
+ * When iterating over `process.allowedNodeEnvironmentFlags`, flags will
1564
+ * appear only _once_; each will begin with one or more dashes. Flags
1565
+ * passed through to V8 will contain underscores instead of non-leading
1566
+ * dashes:
1567
+ *
1568
+ * ```js
1569
+ * import { allowedNodeEnvironmentFlags } from 'node:process';
1570
+ *
1571
+ * allowedNodeEnvironmentFlags.forEach((flag) => {
1572
+ * // -r
1573
+ * // --inspect-brk
1574
+ * // --abort_on_uncaught_exception
1575
+ * // ...
1576
+ * });
1577
+ * ```
1578
+ *
1579
+ * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail
1580
+ * silently.
1581
+ *
1582
+ * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will
1583
+ * contain what _would have_ been allowable.
1584
+ * @since v10.10.0
1585
+ */
1586
+ allowedNodeEnvironmentFlags: ReadonlySet<string>;
1587
+ /**
1588
+ * `process.report` is an object whose methods are used to generate diagnostic
1589
+ * reports for the current process. Additional documentation is available in the `report documentation`.
1590
+ * @since v11.8.0
1591
+ */
1592
+ report?: ProcessReport | undefined;
1593
+ /**
1594
+ * ```js
1595
+ * import { resourceUsage } from 'node:process';
1596
+ *
1597
+ * console.log(resourceUsage());
1598
+ * /*
1599
+ * Will output:
1600
+ * {
1601
+ * userCPUTime: 82872,
1602
+ * systemCPUTime: 4143,
1603
+ * maxRSS: 33164,
1604
+ * sharedMemorySize: 0,
1605
+ * unsharedDataSize: 0,
1606
+ * unsharedStackSize: 0,
1607
+ * minorPageFault: 2469,
1608
+ * majorPageFault: 0,
1609
+ * swappedOut: 0,
1610
+ * fsRead: 0,
1611
+ * fsWrite: 8,
1612
+ * ipcSent: 0,
1613
+ * ipcReceived: 0,
1614
+ * signalsCount: 0,
1615
+ * voluntaryContextSwitches: 79,
1616
+ * involuntaryContextSwitches: 1
1617
+ * }
1618
+ *
1619
+ * ```
1620
+ * @since v12.6.0
1621
+ * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t].
1622
+ */
1623
+ resourceUsage(): ResourceUsage;
1624
+ /**
1625
+ * The initial value of `process.throwDeprecation` indicates whether the `--throw-deprecation` flag is set on the current Node.js process. `process.throwDeprecation`
1626
+ * is mutable, so whether or not deprecation warnings result in errors may be altered at runtime. See the documentation for the 'warning' event and the emitWarning()
1627
+ * method for more information.
1628
+ *
1629
+ * ```bash
1630
+ * $ node --throw-deprecation -p "process.throwDeprecation"
1631
+ * true
1632
+ * $ node -p "process.throwDeprecation"
1633
+ * undefined
1634
+ * $ node
1635
+ * > process.emitWarning('test', 'DeprecationWarning');
1636
+ * undefined
1637
+ * > (node:26598) DeprecationWarning: test
1638
+ * > process.throwDeprecation = true;
1639
+ * true
1640
+ * > process.emitWarning('test', 'DeprecationWarning');
1641
+ * Thrown:
1642
+ * [DeprecationWarning: test] { name: 'DeprecationWarning' }
1643
+ * ```
1644
+ * @since v0.9.12
1645
+ */
1646
+ throwDeprecation: boolean;
1647
+ /**
1648
+ * The `process.traceDeprecation` property indicates whether the `--trace-deprecation` flag is set on the current Node.js process. See the
1649
+ * documentation for the `'warning' event` and the `emitWarning() method` for more information about this
1650
+ * flag's behavior.
1651
+ * @since v0.8.0
1652
+ */
1653
+ traceDeprecation: boolean;
1654
+ /* EventEmitter */
1655
+ addListener(event: "beforeExit", listener: BeforeExitListener): this;
1656
+ addListener(event: "disconnect", listener: DisconnectListener): this;
1657
+ addListener(event: "exit", listener: ExitListener): this;
1658
+ addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1659
+ addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1660
+ addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1661
+ addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1662
+ addListener(event: "warning", listener: WarningListener): this;
1663
+ addListener(event: "message", listener: MessageListener): this;
1664
+ addListener(event: Signals, listener: SignalsListener): this;
1665
+ addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1666
+ addListener(event: "worker", listener: WorkerListener): this;
1667
+ emit(event: "beforeExit", code: number): boolean;
1668
+ emit(event: "disconnect"): boolean;
1669
+ emit(event: "exit", code: number): boolean;
1670
+ emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
1671
+ emit(event: "uncaughtException", error: Error): boolean;
1672
+ emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
1673
+ emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
1674
+ emit(event: "warning", warning: Error): boolean;
1675
+ emit(event: "message", message: unknown, sendHandle: unknown): this;
1676
+ emit(event: Signals, signal?: Signals): boolean;
1677
+ emit(
1678
+ event: "multipleResolves",
1679
+ type: MultipleResolveType,
1680
+ promise: Promise<unknown>,
1681
+ value: unknown,
1682
+ ): this;
1683
+ emit(event: "worker", listener: WorkerListener): this;
1684
+ on(event: "beforeExit", listener: BeforeExitListener): this;
1685
+ on(event: "disconnect", listener: DisconnectListener): this;
1686
+ on(event: "exit", listener: ExitListener): this;
1687
+ on(event: "rejectionHandled", listener: RejectionHandledListener): this;
1688
+ on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1689
+ on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1690
+ on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1691
+ on(event: "warning", listener: WarningListener): this;
1692
+ on(event: "message", listener: MessageListener): this;
1693
+ on(event: Signals, listener: SignalsListener): this;
1694
+ on(event: "multipleResolves", listener: MultipleResolveListener): this;
1695
+ on(event: "worker", listener: WorkerListener): this;
1696
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
1697
+ once(event: "beforeExit", listener: BeforeExitListener): this;
1698
+ once(event: "disconnect", listener: DisconnectListener): this;
1699
+ once(event: "exit", listener: ExitListener): this;
1700
+ once(event: "rejectionHandled", listener: RejectionHandledListener): this;
1701
+ once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1702
+ once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1703
+ once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1704
+ once(event: "warning", listener: WarningListener): this;
1705
+ once(event: "message", listener: MessageListener): this;
1706
+ once(event: Signals, listener: SignalsListener): this;
1707
+ once(event: "multipleResolves", listener: MultipleResolveListener): this;
1708
+ once(event: "worker", listener: WorkerListener): this;
1709
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
1710
+ prependListener(event: "beforeExit", listener: BeforeExitListener): this;
1711
+ prependListener(event: "disconnect", listener: DisconnectListener): this;
1712
+ prependListener(event: "exit", listener: ExitListener): this;
1713
+ prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1714
+ prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1715
+ prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1716
+ prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1717
+ prependListener(event: "warning", listener: WarningListener): this;
1718
+ prependListener(event: "message", listener: MessageListener): this;
1719
+ prependListener(event: Signals, listener: SignalsListener): this;
1720
+ prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1721
+ prependListener(event: "worker", listener: WorkerListener): this;
1722
+ prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
1723
+ prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
1724
+ prependOnceListener(event: "exit", listener: ExitListener): this;
1725
+ prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
1726
+ prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
1727
+ prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
1728
+ prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
1729
+ prependOnceListener(event: "warning", listener: WarningListener): this;
1730
+ prependOnceListener(event: "message", listener: MessageListener): this;
1731
+ prependOnceListener(event: Signals, listener: SignalsListener): this;
1732
+ prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
1733
+ prependOnceListener(event: "worker", listener: WorkerListener): this;
1734
+ listeners(event: "beforeExit"): BeforeExitListener[];
1735
+ listeners(event: "disconnect"): DisconnectListener[];
1736
+ listeners(event: "exit"): ExitListener[];
1737
+ listeners(event: "rejectionHandled"): RejectionHandledListener[];
1738
+ listeners(event: "uncaughtException"): UncaughtExceptionListener[];
1739
+ listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
1740
+ listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
1741
+ listeners(event: "warning"): WarningListener[];
1742
+ listeners(event: "message"): MessageListener[];
1743
+ listeners(event: Signals): SignalsListener[];
1744
+ listeners(event: "multipleResolves"): MultipleResolveListener[];
1745
+ listeners(event: "worker"): WorkerListener[];
1746
+ }
1747
+ }
1748
+ }
1749
+ export = process;
1750
+ }
1751
+ declare module "node:process" {
1752
+ import process = require("process");
1753
+ export = process;
1754
+ }