rahad-all-downloader 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  2. package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
  3. package/.cache/replit/__replit_disk_meta.json +1 -0
  4. package/.cache/replit/modules/nodejs-20.res +1 -0
  5. package/.cache/replit/modules/replit.res +1 -0
  6. package/.cache/replit/modules.stamp +0 -0
  7. package/.cache/replit/nix/env.json +1 -0
  8. package/.cache/typescript/5.0/node_modules/.package-lock.json +12 -0
  9. package/.cache/typescript/5.0/node_modules/types-registry/README.md +2 -0
  10. package/.cache/typescript/5.0/node_modules/types-registry/index.json +1 -0
  11. package/.cache/typescript/5.0/node_modules/types-registry/package.json +20 -0
  12. package/.cache/typescript/5.0/package-lock.json +17 -0
  13. package/.cache/typescript/5.0/package.json +1 -0
  14. package/.cache/typescript/5.3/node_modules/.package-lock.json +99 -0
  15. package/.cache/typescript/5.3/node_modules/@types/node/LICENSE +21 -0
  16. package/.cache/typescript/5.3/node_modules/@types/node/README.md +15 -0
  17. package/.cache/typescript/5.3/node_modules/@types/node/assert/strict.d.ts +8 -0
  18. package/.cache/typescript/5.3/node_modules/@types/node/assert.d.ts +996 -0
  19. package/.cache/typescript/5.3/node_modules/@types/node/async_hooks.d.ts +539 -0
  20. package/.cache/typescript/5.3/node_modules/@types/node/buffer.d.ts +2362 -0
  21. package/.cache/typescript/5.3/node_modules/@types/node/child_process.d.ts +1540 -0
  22. package/.cache/typescript/5.3/node_modules/@types/node/cluster.d.ts +432 -0
  23. package/.cache/typescript/5.3/node_modules/@types/node/console.d.ts +415 -0
  24. package/.cache/typescript/5.3/node_modules/@types/node/constants.d.ts +19 -0
  25. package/.cache/typescript/5.3/node_modules/@types/node/crypto.d.ts +4456 -0
  26. package/.cache/typescript/5.3/node_modules/@types/node/dgram.d.ts +586 -0
  27. package/.cache/typescript/5.3/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
  28. package/.cache/typescript/5.3/node_modules/@types/node/dns/promises.d.ts +425 -0
  29. package/.cache/typescript/5.3/node_modules/@types/node/dns.d.ts +809 -0
  30. package/.cache/typescript/5.3/node_modules/@types/node/dom-events.d.ts +122 -0
  31. package/.cache/typescript/5.3/node_modules/@types/node/domain.d.ts +170 -0
  32. package/.cache/typescript/5.3/node_modules/@types/node/events.d.ts +879 -0
  33. package/.cache/typescript/5.3/node_modules/@types/node/fs/promises.d.ts +1239 -0
  34. package/.cache/typescript/5.3/node_modules/@types/node/fs.d.ts +4291 -0
  35. package/.cache/typescript/5.3/node_modules/@types/node/globals.d.ts +385 -0
  36. package/.cache/typescript/5.3/node_modules/@types/node/globals.global.d.ts +1 -0
  37. package/.cache/typescript/5.3/node_modules/@types/node/http.d.ts +1888 -0
  38. package/.cache/typescript/5.3/node_modules/@types/node/http2.d.ts +2382 -0
  39. package/.cache/typescript/5.3/node_modules/@types/node/https.d.ts +550 -0
  40. package/.cache/typescript/5.3/node_modules/@types/node/index.d.ts +88 -0
  41. package/.cache/typescript/5.3/node_modules/@types/node/inspector.d.ts +2747 -0
  42. package/.cache/typescript/5.3/node_modules/@types/node/module.d.ts +301 -0
  43. package/.cache/typescript/5.3/node_modules/@types/node/net.d.ts +949 -0
  44. package/.cache/typescript/5.3/node_modules/@types/node/os.d.ts +478 -0
  45. package/.cache/typescript/5.3/node_modules/@types/node/package.json +230 -0
  46. package/.cache/typescript/5.3/node_modules/@types/node/path.d.ts +191 -0
  47. package/.cache/typescript/5.3/node_modules/@types/node/perf_hooks.d.ts +639 -0
  48. package/.cache/typescript/5.3/node_modules/@types/node/process.d.ts +1539 -0
  49. package/.cache/typescript/5.3/node_modules/@types/node/punycode.d.ts +117 -0
  50. package/.cache/typescript/5.3/node_modules/@types/node/querystring.d.ts +141 -0
  51. package/.cache/typescript/5.3/node_modules/@types/node/readline/promises.d.ts +150 -0
  52. package/.cache/typescript/5.3/node_modules/@types/node/readline.d.ts +539 -0
  53. package/.cache/typescript/5.3/node_modules/@types/node/repl.d.ts +430 -0
  54. package/.cache/typescript/5.3/node_modules/@types/node/stream/consumers.d.ts +12 -0
  55. package/.cache/typescript/5.3/node_modules/@types/node/stream/promises.d.ts +83 -0
  56. package/.cache/typescript/5.3/node_modules/@types/node/stream/web.d.ts +350 -0
  57. package/.cache/typescript/5.3/node_modules/@types/node/stream.d.ts +1701 -0
  58. package/.cache/typescript/5.3/node_modules/@types/node/string_decoder.d.ts +67 -0
  59. package/.cache/typescript/5.3/node_modules/@types/node/test.d.ts +1382 -0
  60. package/.cache/typescript/5.3/node_modules/@types/node/timers/promises.d.ts +93 -0
  61. package/.cache/typescript/5.3/node_modules/@types/node/timers.d.ts +240 -0
  62. package/.cache/typescript/5.3/node_modules/@types/node/tls.d.ts +1210 -0
  63. package/.cache/typescript/5.3/node_modules/@types/node/trace_events.d.ts +182 -0
  64. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  65. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
  66. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
  67. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
  68. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
  69. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
  70. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/console.d.ts +415 -0
  71. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
  72. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/crypto.d.ts +4455 -0
  73. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dgram.d.ts +586 -0
  74. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
  75. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
  76. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
  77. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
  78. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  79. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/events.d.ts +879 -0
  80. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
  81. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs.d.ts +4291 -0
  82. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.d.ts +385 -0
  83. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  84. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http.d.ts +1888 -0
  85. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
  86. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/https.d.ts +550 -0
  87. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  88. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
  89. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/module.d.ts +301 -0
  90. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/net.d.ts +949 -0
  91. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/os.d.ts +478 -0
  92. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  93. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +639 -0
  94. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/process.d.ts +1539 -0
  95. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  96. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
  97. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
  98. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
  99. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
  100. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  101. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
  102. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/web.d.ts +350 -0
  103. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
  104. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  105. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/test.d.ts +1382 -0
  106. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  107. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
  108. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
  109. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  110. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  111. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/url.d.ts +927 -0
  112. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
  113. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  114. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
  115. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  116. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
  117. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  118. package/.cache/typescript/5.3/node_modules/@types/node/tty.d.ts +208 -0
  119. package/.cache/typescript/5.3/node_modules/@types/node/url.d.ts +927 -0
  120. package/.cache/typescript/5.3/node_modules/@types/node/util.d.ts +2183 -0
  121. package/.cache/typescript/5.3/node_modules/@types/node/v8.d.ts +635 -0
  122. package/.cache/typescript/5.3/node_modules/@types/node/vm.d.ts +903 -0
  123. package/.cache/typescript/5.3/node_modules/@types/node/wasi.d.ts +158 -0
  124. package/.cache/typescript/5.3/node_modules/@types/node/worker_threads.d.ts +691 -0
  125. package/.cache/typescript/5.3/node_modules/@types/node/zlib.d.ts +517 -0
  126. package/.cache/typescript/5.3/node_modules/@types/node-fetch/LICENSE +21 -0
  127. package/.cache/typescript/5.3/node_modules/@types/node-fetch/README.md +15 -0
  128. package/.cache/typescript/5.3/node_modules/@types/node-fetch/externals.d.ts +32 -0
  129. package/.cache/typescript/5.3/node_modules/@types/node-fetch/index.d.ts +214 -0
  130. package/.cache/typescript/5.3/node_modules/@types/node-fetch/package.json +83 -0
  131. package/.cache/typescript/5.3/node_modules/asynckit/LICENSE +21 -0
  132. package/.cache/typescript/5.3/node_modules/asynckit/README.md +233 -0
  133. package/.cache/typescript/5.3/node_modules/asynckit/bench.js +76 -0
  134. package/.cache/typescript/5.3/node_modules/asynckit/index.js +6 -0
  135. package/.cache/typescript/5.3/node_modules/asynckit/lib/abort.js +29 -0
  136. package/.cache/typescript/5.3/node_modules/asynckit/lib/async.js +34 -0
  137. package/.cache/typescript/5.3/node_modules/asynckit/lib/defer.js +26 -0
  138. package/.cache/typescript/5.3/node_modules/asynckit/lib/iterate.js +75 -0
  139. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  140. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_parallel.js +25 -0
  141. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial.js +25 -0
  142. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  143. package/.cache/typescript/5.3/node_modules/asynckit/lib/state.js +37 -0
  144. package/.cache/typescript/5.3/node_modules/asynckit/lib/streamify.js +141 -0
  145. package/.cache/typescript/5.3/node_modules/asynckit/lib/terminator.js +29 -0
  146. package/.cache/typescript/5.3/node_modules/asynckit/package.json +63 -0
  147. package/.cache/typescript/5.3/node_modules/asynckit/parallel.js +43 -0
  148. package/.cache/typescript/5.3/node_modules/asynckit/serial.js +17 -0
  149. package/.cache/typescript/5.3/node_modules/asynckit/serialOrdered.js +75 -0
  150. package/.cache/typescript/5.3/node_modules/asynckit/stream.js +21 -0
  151. package/.cache/typescript/5.3/node_modules/combined-stream/License +19 -0
  152. package/.cache/typescript/5.3/node_modules/combined-stream/Readme.md +138 -0
  153. package/.cache/typescript/5.3/node_modules/combined-stream/lib/combined_stream.js +208 -0
  154. package/.cache/typescript/5.3/node_modules/combined-stream/package.json +25 -0
  155. package/.cache/typescript/5.3/node_modules/combined-stream/yarn.lock +17 -0
  156. package/.cache/typescript/5.3/node_modules/delayed-stream/License +19 -0
  157. package/.cache/typescript/5.3/node_modules/delayed-stream/Makefile +7 -0
  158. package/.cache/typescript/5.3/node_modules/delayed-stream/Readme.md +141 -0
  159. package/.cache/typescript/5.3/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  160. package/.cache/typescript/5.3/node_modules/delayed-stream/package.json +27 -0
  161. package/.cache/typescript/5.3/node_modules/form-data/License +19 -0
  162. package/.cache/typescript/5.3/node_modules/form-data/README.md.bak +358 -0
  163. package/.cache/typescript/5.3/node_modules/form-data/Readme.md +358 -0
  164. package/.cache/typescript/5.3/node_modules/form-data/index.d.ts +62 -0
  165. package/.cache/typescript/5.3/node_modules/form-data/lib/browser.js +2 -0
  166. package/.cache/typescript/5.3/node_modules/form-data/lib/form_data.js +501 -0
  167. package/.cache/typescript/5.3/node_modules/form-data/lib/populate.js +10 -0
  168. package/.cache/typescript/5.3/node_modules/form-data/package.json +68 -0
  169. package/.cache/typescript/5.3/node_modules/mime-db/HISTORY.md +507 -0
  170. package/.cache/typescript/5.3/node_modules/mime-db/LICENSE +23 -0
  171. package/.cache/typescript/5.3/node_modules/mime-db/README.md +100 -0
  172. package/.cache/typescript/5.3/node_modules/mime-db/db.json +8519 -0
  173. package/.cache/typescript/5.3/node_modules/mime-db/index.js +12 -0
  174. package/.cache/typescript/5.3/node_modules/mime-db/package.json +60 -0
  175. package/.cache/typescript/5.3/node_modules/mime-types/HISTORY.md +397 -0
  176. package/.cache/typescript/5.3/node_modules/mime-types/LICENSE +23 -0
  177. package/.cache/typescript/5.3/node_modules/mime-types/README.md +113 -0
  178. package/.cache/typescript/5.3/node_modules/mime-types/index.js +188 -0
  179. package/.cache/typescript/5.3/node_modules/mime-types/package.json +44 -0
  180. package/.cache/typescript/5.3/node_modules/types-registry/README.md +2 -0
  181. package/.cache/typescript/5.3/node_modules/types-registry/index.json +1 -0
  182. package/.cache/typescript/5.3/node_modules/types-registry/package.json +20 -0
  183. package/.cache/typescript/5.3/node_modules/undici-types/README.md +6 -0
  184. package/.cache/typescript/5.3/node_modules/undici-types/agent.d.ts +31 -0
  185. package/.cache/typescript/5.3/node_modules/undici-types/api.d.ts +43 -0
  186. package/.cache/typescript/5.3/node_modules/undici-types/balanced-pool.d.ts +18 -0
  187. package/.cache/typescript/5.3/node_modules/undici-types/cache.d.ts +36 -0
  188. package/.cache/typescript/5.3/node_modules/undici-types/client.d.ts +97 -0
  189. package/.cache/typescript/5.3/node_modules/undici-types/connector.d.ts +34 -0
  190. package/.cache/typescript/5.3/node_modules/undici-types/content-type.d.ts +21 -0
  191. package/.cache/typescript/5.3/node_modules/undici-types/cookies.d.ts +28 -0
  192. package/.cache/typescript/5.3/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  193. package/.cache/typescript/5.3/node_modules/undici-types/dispatcher.d.ts +241 -0
  194. package/.cache/typescript/5.3/node_modules/undici-types/errors.d.ts +128 -0
  195. package/.cache/typescript/5.3/node_modules/undici-types/fetch.d.ts +209 -0
  196. package/.cache/typescript/5.3/node_modules/undici-types/file.d.ts +39 -0
  197. package/.cache/typescript/5.3/node_modules/undici-types/filereader.d.ts +54 -0
  198. package/.cache/typescript/5.3/node_modules/undici-types/formdata.d.ts +108 -0
  199. package/.cache/typescript/5.3/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  200. package/.cache/typescript/5.3/node_modules/undici-types/global-origin.d.ts +7 -0
  201. package/.cache/typescript/5.3/node_modules/undici-types/handlers.d.ts +9 -0
  202. package/.cache/typescript/5.3/node_modules/undici-types/header.d.ts +4 -0
  203. package/.cache/typescript/5.3/node_modules/undici-types/index.d.ts +63 -0
  204. package/.cache/typescript/5.3/node_modules/undici-types/interceptors.d.ts +5 -0
  205. package/.cache/typescript/5.3/node_modules/undici-types/mock-agent.d.ts +50 -0
  206. package/.cache/typescript/5.3/node_modules/undici-types/mock-client.d.ts +25 -0
  207. package/.cache/typescript/5.3/node_modules/undici-types/mock-errors.d.ts +12 -0
  208. package/.cache/typescript/5.3/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  209. package/.cache/typescript/5.3/node_modules/undici-types/mock-pool.d.ts +25 -0
  210. package/.cache/typescript/5.3/node_modules/undici-types/package.json +55 -0
  211. package/.cache/typescript/5.3/node_modules/undici-types/patch.d.ts +71 -0
  212. package/.cache/typescript/5.3/node_modules/undici-types/pool-stats.d.ts +19 -0
  213. package/.cache/typescript/5.3/node_modules/undici-types/pool.d.ts +28 -0
  214. package/.cache/typescript/5.3/node_modules/undici-types/proxy-agent.d.ts +30 -0
  215. package/.cache/typescript/5.3/node_modules/undici-types/readable.d.ts +61 -0
  216. package/.cache/typescript/5.3/node_modules/undici-types/webidl.d.ts +220 -0
  217. package/.cache/typescript/5.3/node_modules/undici-types/websocket.d.ts +131 -0
  218. package/.cache/typescript/5.3/package-lock.json +107 -0
  219. package/.cache/typescript/5.3/package.json +1 -0
  220. package/.cache/typescript/5.4/node_modules/.package-lock.json +115 -0
  221. package/.cache/typescript/5.4/node_modules/@types/body-parser/LICENSE +21 -0
  222. package/.cache/typescript/5.4/node_modules/@types/body-parser/README.md +15 -0
  223. package/.cache/typescript/5.4/node_modules/@types/body-parser/index.d.ts +95 -0
  224. package/.cache/typescript/5.4/node_modules/@types/body-parser/package.json +58 -0
  225. package/.cache/typescript/5.4/node_modules/@types/connect/LICENSE +21 -0
  226. package/.cache/typescript/5.4/node_modules/@types/connect/README.md +15 -0
  227. package/.cache/typescript/5.4/node_modules/@types/connect/index.d.ts +91 -0
  228. package/.cache/typescript/5.4/node_modules/@types/connect/package.json +32 -0
  229. package/.cache/typescript/5.4/node_modules/@types/express/LICENSE +21 -0
  230. package/.cache/typescript/5.4/node_modules/@types/express/README.md +15 -0
  231. package/.cache/typescript/5.4/node_modules/@types/express/index.d.ts +128 -0
  232. package/.cache/typescript/5.4/node_modules/@types/express/package.json +45 -0
  233. package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/LICENSE +21 -0
  234. package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/README.md +15 -0
  235. package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/index.d.ts +1295 -0
  236. package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/package.json +50 -0
  237. package/.cache/typescript/5.4/node_modules/@types/http-errors/LICENSE +21 -0
  238. package/.cache/typescript/5.4/node_modules/@types/http-errors/README.md +15 -0
  239. package/.cache/typescript/5.4/node_modules/@types/http-errors/index.d.ts +77 -0
  240. package/.cache/typescript/5.4/node_modules/@types/http-errors/package.json +30 -0
  241. package/.cache/typescript/5.4/node_modules/@types/mime/LICENSE +21 -0
  242. package/.cache/typescript/5.4/node_modules/@types/mime/Mime.d.ts +10 -0
  243. package/.cache/typescript/5.4/node_modules/@types/mime/README.md +15 -0
  244. package/.cache/typescript/5.4/node_modules/@types/mime/index.d.ts +31 -0
  245. package/.cache/typescript/5.4/node_modules/@types/mime/lite.d.ts +7 -0
  246. package/.cache/typescript/5.4/node_modules/@types/mime/package.json +30 -0
  247. package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
  248. package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
  249. package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
  250. package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
  251. package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
  252. package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
  253. package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
  254. package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
  255. package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
  256. package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
  257. package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
  258. package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
  259. package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  260. package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +474 -0
  261. package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
  262. package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
  263. package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
  264. package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +909 -0
  265. package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
  266. package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
  267. package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +411 -0
  268. package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
  269. package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
  270. package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
  271. package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
  272. package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
  273. package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
  274. package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
  275. package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
  276. package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
  277. package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
  278. package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
  279. package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
  280. package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
  281. package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
  282. package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
  283. package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
  284. package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
  285. package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
  286. package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
  287. package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
  288. package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
  289. package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
  290. package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
  291. package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
  292. package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
  293. package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
  294. package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
  295. package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
  296. package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
  297. package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
  298. package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
  299. package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
  300. package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
  301. package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
  302. package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
  303. package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +691 -0
  304. package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
  305. package/.cache/typescript/5.4/node_modules/@types/qs/LICENSE +21 -0
  306. package/.cache/typescript/5.4/node_modules/@types/qs/README.md +15 -0
  307. package/.cache/typescript/5.4/node_modules/@types/qs/index.d.ts +79 -0
  308. package/.cache/typescript/5.4/node_modules/@types/qs/package.json +65 -0
  309. package/.cache/typescript/5.4/node_modules/@types/range-parser/LICENSE +21 -0
  310. package/.cache/typescript/5.4/node_modules/@types/range-parser/README.md +53 -0
  311. package/.cache/typescript/5.4/node_modules/@types/range-parser/index.d.ts +34 -0
  312. package/.cache/typescript/5.4/node_modules/@types/range-parser/package.json +25 -0
  313. package/.cache/typescript/5.4/node_modules/@types/send/LICENSE +21 -0
  314. package/.cache/typescript/5.4/node_modules/@types/send/README.md +15 -0
  315. package/.cache/typescript/5.4/node_modules/@types/send/index.d.ts +225 -0
  316. package/.cache/typescript/5.4/node_modules/@types/send/package.json +33 -0
  317. package/.cache/typescript/5.4/node_modules/@types/serve-static/LICENSE +21 -0
  318. package/.cache/typescript/5.4/node_modules/@types/serve-static/README.md +15 -0
  319. package/.cache/typescript/5.4/node_modules/@types/serve-static/index.d.ts +107 -0
  320. package/.cache/typescript/5.4/node_modules/@types/serve-static/package.json +39 -0
  321. package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
  322. package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
  323. package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
  324. package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
  325. package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
  326. package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
  327. package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
  328. package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
  329. package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
  330. package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
  331. package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
  332. package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
  333. package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  334. package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
  335. package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
  336. package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
  337. package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
  338. package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
  339. package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
  340. package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  341. package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
  342. package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
  343. package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
  344. package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
  345. package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
  346. package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
  347. package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
  348. package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
  349. package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  350. package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
  351. package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
  352. package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
  353. package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
  354. package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
  355. package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
  356. package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
  357. package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
  358. package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
  359. package/.cache/typescript/5.4/package-lock.json +124 -0
  360. package/.cache/typescript/5.4/package.json +1 -0
  361. package/.replit +21 -0
  362. package/.upm/store.json +1 -0
  363. package/README.md +71 -0
  364. package/index.js +1 -0
  365. package/package.json +40 -0
  366. package/replit.nix +3 -0
@@ -0,0 +1,1707 @@
1
+ /**
2
+ * A stream is an abstract interface for working with streaming data in Node.js.
3
+ * The `node:stream` module provides an API for implementing the stream interface.
4
+ *
5
+ * There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v20.x/api/http.html#class-httpincomingmessage)
6
+ * and [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) are both stream instances.
7
+ *
8
+ * Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v20.x/api/events.html#class-eventemitter).
9
+ *
10
+ * To access the `node:stream` module:
11
+ *
12
+ * ```js
13
+ * const stream = require('node:stream');
14
+ * ```
15
+ *
16
+ * The `node:stream` module is useful for creating new types of stream instances.
17
+ * It is usually not necessary to use the `node:stream` module to consume streams.
18
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/stream.js)
19
+ */
20
+ declare module "stream" {
21
+ import { Abortable, EventEmitter } from "node:events";
22
+ import { Blob as NodeBlob } from "node:buffer";
23
+ import * as streamPromises from "node:stream/promises";
24
+ import * as streamConsumers from "node:stream/consumers";
25
+ import * as streamWeb from "node:stream/web";
26
+
27
+ type ComposeFnParam = (source: any) => void;
28
+
29
+ class internal extends EventEmitter {
30
+ pipe<T extends NodeJS.WritableStream>(
31
+ destination: T,
32
+ options?: {
33
+ end?: boolean | undefined;
34
+ },
35
+ ): T;
36
+ compose<T extends NodeJS.ReadableStream>(
37
+ stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,
38
+ options?: { signal: AbortSignal },
39
+ ): T;
40
+ }
41
+ import Stream = internal.Stream;
42
+ import Readable = internal.Readable;
43
+ import ReadableOptions = internal.ReadableOptions;
44
+ interface ArrayOptions {
45
+ /**
46
+ * The maximum concurrent invocations of `fn` to call on the stream at once.
47
+ * @default 1
48
+ */
49
+ concurrency?: number;
50
+ /** Allows destroying the stream if the signal is aborted. */
51
+ signal?: AbortSignal;
52
+ }
53
+ class ReadableBase extends Stream implements NodeJS.ReadableStream {
54
+ /**
55
+ * A utility method for creating Readable Streams out of iterators.
56
+ * @since v12.3.0, v10.17.0
57
+ * @param iterable Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed.
58
+ * @param options Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`.
59
+ */
60
+ static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
61
+ /**
62
+ * Returns whether the stream has been read from or cancelled.
63
+ * @since v16.8.0
64
+ */
65
+ static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
66
+ /**
67
+ * Returns whether the stream was destroyed or errored before emitting `'end'`.
68
+ * @since v16.8.0
69
+ * @experimental
70
+ */
71
+ readonly readableAborted: boolean;
72
+ /**
73
+ * Is `true` if it is safe to call {@link read}, which means
74
+ * the stream has not been destroyed or emitted `'error'` or `'end'`.
75
+ * @since v11.4.0
76
+ */
77
+ readable: boolean;
78
+ /**
79
+ * Returns whether `'data'` has been emitted.
80
+ * @since v16.7.0, v14.18.0
81
+ * @experimental
82
+ */
83
+ readonly readableDidRead: boolean;
84
+ /**
85
+ * Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the {@link setEncoding} method.
86
+ * @since v12.7.0
87
+ */
88
+ readonly readableEncoding: BufferEncoding | null;
89
+ /**
90
+ * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v20.x/api/stream.html#event-end) event is emitted.
91
+ * @since v12.9.0
92
+ */
93
+ readonly readableEnded: boolean;
94
+ /**
95
+ * This property reflects the current state of a `Readable` stream as described
96
+ * in the [Three states](https://nodejs.org/docs/latest-v20.x/api/stream.html#three-states) section.
97
+ * @since v9.4.0
98
+ */
99
+ readonly readableFlowing: boolean | null;
100
+ /**
101
+ * Returns the value of `highWaterMark` passed when creating this `Readable`.
102
+ * @since v9.3.0
103
+ */
104
+ readonly readableHighWaterMark: number;
105
+ /**
106
+ * This property contains the number of bytes (or objects) in the queue
107
+ * ready to be read. The value provides introspection data regarding
108
+ * the status of the `highWaterMark`.
109
+ * @since v9.4.0
110
+ */
111
+ readonly readableLength: number;
112
+ /**
113
+ * Getter for the property `objectMode` of a given `Readable` stream.
114
+ * @since v12.3.0
115
+ */
116
+ readonly readableObjectMode: boolean;
117
+ /**
118
+ * Is `true` after `readable.destroy()` has been called.
119
+ * @since v8.0.0
120
+ */
121
+ destroyed: boolean;
122
+ /**
123
+ * Is `true` after `'close'` has been emitted.
124
+ * @since v18.0.0
125
+ */
126
+ readonly closed: boolean;
127
+ /**
128
+ * Returns error if the stream has been destroyed with an error.
129
+ * @since v18.0.0
130
+ */
131
+ readonly errored: Error | null;
132
+ constructor(opts?: ReadableOptions);
133
+ _construct?(callback: (error?: Error | null) => void): void;
134
+ _read(size: number): void;
135
+ /**
136
+ * The `readable.read()` method reads data out of the internal buffer and
137
+ * returns it. If no data is available to be read, `null` is returned. By default,
138
+ * the data is returned as a `Buffer` object unless an encoding has been
139
+ * specified using the `readable.setEncoding()` method or the stream is operating
140
+ * in object mode.
141
+ *
142
+ * The optional `size` argument specifies a specific number of bytes to read. If
143
+ * `size` bytes are not available to be read, `null` will be returned _unless_ the
144
+ * stream has ended, in which case all of the data remaining in the internal buffer
145
+ * will be returned.
146
+ *
147
+ * If the `size` argument is not specified, all of the data contained in the
148
+ * internal buffer will be returned.
149
+ *
150
+ * The `size` argument must be less than or equal to 1 GiB.
151
+ *
152
+ * The `readable.read()` method should only be called on `Readable` streams
153
+ * operating in paused mode. In flowing mode, `readable.read()` is called
154
+ * automatically until the internal buffer is fully drained.
155
+ *
156
+ * ```js
157
+ * const readable = getReadableStreamSomehow();
158
+ *
159
+ * // 'readable' may be triggered multiple times as data is buffered in
160
+ * readable.on('readable', () => {
161
+ * let chunk;
162
+ * console.log('Stream is readable (new data received in buffer)');
163
+ * // Use a loop to make sure we read all currently available data
164
+ * while (null !== (chunk = readable.read())) {
165
+ * console.log(`Read ${chunk.length} bytes of data...`);
166
+ * }
167
+ * });
168
+ *
169
+ * // 'end' will be triggered once when there is no more data available
170
+ * readable.on('end', () => {
171
+ * console.log('Reached end of stream.');
172
+ * });
173
+ * ```
174
+ *
175
+ * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks
176
+ * are not concatenated. A `while` loop is necessary to consume all data
177
+ * currently in the buffer. When reading a large file `.read()` may return `null`,
178
+ * having consumed all buffered content so far, but there is still more data to
179
+ * come not yet buffered. In this case a new `'readable'` event will be emitted
180
+ * when there is more data in the buffer. Finally the `'end'` event will be
181
+ * emitted when there is no more data to come.
182
+ *
183
+ * Therefore to read a file's whole contents from a `readable`, it is necessary
184
+ * to collect chunks across multiple `'readable'` events:
185
+ *
186
+ * ```js
187
+ * const chunks = [];
188
+ *
189
+ * readable.on('readable', () => {
190
+ * let chunk;
191
+ * while (null !== (chunk = readable.read())) {
192
+ * chunks.push(chunk);
193
+ * }
194
+ * });
195
+ *
196
+ * readable.on('end', () => {
197
+ * const content = chunks.join('');
198
+ * });
199
+ * ```
200
+ *
201
+ * A `Readable` stream in object mode will always return a single item from
202
+ * a call to `readable.read(size)`, regardless of the value of the `size` argument.
203
+ *
204
+ * If the `readable.read()` method returns a chunk of data, a `'data'` event will
205
+ * also be emitted.
206
+ *
207
+ * Calling {@link read} after the `'end'` event has
208
+ * been emitted will return `null`. No runtime error will be raised.
209
+ * @since v0.9.4
210
+ * @param size Optional argument to specify how much data to read.
211
+ */
212
+ read(size?: number): any;
213
+ /**
214
+ * The `readable.setEncoding()` method sets the character encoding for
215
+ * data read from the `Readable` stream.
216
+ *
217
+ * By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data
218
+ * to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the
219
+ * output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal
220
+ * string format.
221
+ *
222
+ * The `Readable` stream will properly handle multi-byte characters delivered
223
+ * through the stream that would otherwise become improperly decoded if simply
224
+ * pulled from the stream as `Buffer` objects.
225
+ *
226
+ * ```js
227
+ * const readable = getReadableStreamSomehow();
228
+ * readable.setEncoding('utf8');
229
+ * readable.on('data', (chunk) => {
230
+ * assert.equal(typeof chunk, 'string');
231
+ * console.log('Got %d characters of string data:', chunk.length);
232
+ * });
233
+ * ```
234
+ * @since v0.9.4
235
+ * @param encoding The encoding to use.
236
+ */
237
+ setEncoding(encoding: BufferEncoding): this;
238
+ /**
239
+ * The `readable.pause()` method will cause a stream in flowing mode to stop
240
+ * emitting `'data'` events, switching out of flowing mode. Any data that
241
+ * becomes available will remain in the internal buffer.
242
+ *
243
+ * ```js
244
+ * const readable = getReadableStreamSomehow();
245
+ * readable.on('data', (chunk) => {
246
+ * console.log(`Received ${chunk.length} bytes of data.`);
247
+ * readable.pause();
248
+ * console.log('There will be no additional data for 1 second.');
249
+ * setTimeout(() => {
250
+ * console.log('Now data will start flowing again.');
251
+ * readable.resume();
252
+ * }, 1000);
253
+ * });
254
+ * ```
255
+ *
256
+ * The `readable.pause()` method has no effect if there is a `'readable'` event listener.
257
+ * @since v0.9.4
258
+ */
259
+ pause(): this;
260
+ /**
261
+ * The `readable.resume()` method causes an explicitly paused `Readable` stream to
262
+ * resume emitting `'data'` events, switching the stream into flowing mode.
263
+ *
264
+ * The `readable.resume()` method can be used to fully consume the data from a
265
+ * stream without actually processing any of that data:
266
+ *
267
+ * ```js
268
+ * getReadableStreamSomehow()
269
+ * .resume()
270
+ * .on('end', () => {
271
+ * console.log('Reached the end, but did not read anything.');
272
+ * });
273
+ * ```
274
+ *
275
+ * The `readable.resume()` method has no effect if there is a `'readable'` event listener.
276
+ * @since v0.9.4
277
+ */
278
+ resume(): this;
279
+ /**
280
+ * The `readable.isPaused()` method returns the current operating state of the `Readable`.
281
+ * This is used primarily by the mechanism that underlies the `readable.pipe()` method.
282
+ * In most typical cases, there will be no reason to use this method directly.
283
+ *
284
+ * ```js
285
+ * const readable = new stream.Readable();
286
+ *
287
+ * readable.isPaused(); // === false
288
+ * readable.pause();
289
+ * readable.isPaused(); // === true
290
+ * readable.resume();
291
+ * readable.isPaused(); // === false
292
+ * ```
293
+ * @since v0.11.14
294
+ */
295
+ isPaused(): boolean;
296
+ /**
297
+ * The `readable.unpipe()` method detaches a `Writable` stream previously attached
298
+ * using the {@link pipe} method.
299
+ *
300
+ * If the `destination` is not specified, then _all_ pipes are detached.
301
+ *
302
+ * If the `destination` is specified, but no pipe is set up for it, then
303
+ * the method does nothing.
304
+ *
305
+ * ```js
306
+ * const fs = require('node:fs');
307
+ * const readable = getReadableStreamSomehow();
308
+ * const writable = fs.createWriteStream('file.txt');
309
+ * // All the data from readable goes into 'file.txt',
310
+ * // but only for the first second.
311
+ * readable.pipe(writable);
312
+ * setTimeout(() => {
313
+ * console.log('Stop writing to file.txt.');
314
+ * readable.unpipe(writable);
315
+ * console.log('Manually close the file stream.');
316
+ * writable.end();
317
+ * }, 1000);
318
+ * ```
319
+ * @since v0.9.4
320
+ * @param destination Optional specific stream to unpipe
321
+ */
322
+ unpipe(destination?: NodeJS.WritableStream): this;
323
+ /**
324
+ * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the
325
+ * same as `readable.push(null)`, after which no more data can be written. The EOF
326
+ * signal is put at the end of the buffer and any buffered data will still be
327
+ * flushed.
328
+ *
329
+ * The `readable.unshift()` method pushes a chunk of data back into the internal
330
+ * buffer. This is useful in certain situations where a stream is being consumed by
331
+ * code that needs to "un-consume" some amount of data that it has optimistically
332
+ * pulled out of the source, so that the data can be passed on to some other party.
333
+ *
334
+ * The `stream.unshift(chunk)` method cannot be called after the `'end'` event
335
+ * has been emitted or a runtime error will be thrown.
336
+ *
337
+ * Developers using `stream.unshift()` often should consider switching to
338
+ * use of a `Transform` stream instead. See the `API for stream implementers` section for more information.
339
+ *
340
+ * ```js
341
+ * // Pull off a header delimited by \n\n.
342
+ * // Use unshift() if we get too much.
343
+ * // Call the callback with (error, header, stream).
344
+ * const { StringDecoder } = require('node:string_decoder');
345
+ * function parseHeader(stream, callback) {
346
+ * stream.on('error', callback);
347
+ * stream.on('readable', onReadable);
348
+ * const decoder = new StringDecoder('utf8');
349
+ * let header = '';
350
+ * function onReadable() {
351
+ * let chunk;
352
+ * while (null !== (chunk = stream.read())) {
353
+ * const str = decoder.write(chunk);
354
+ * if (str.includes('\n\n')) {
355
+ * // Found the header boundary.
356
+ * const split = str.split(/\n\n/);
357
+ * header += split.shift();
358
+ * const remaining = split.join('\n\n');
359
+ * const buf = Buffer.from(remaining, 'utf8');
360
+ * stream.removeListener('error', callback);
361
+ * // Remove the 'readable' listener before unshifting.
362
+ * stream.removeListener('readable', onReadable);
363
+ * if (buf.length)
364
+ * stream.unshift(buf);
365
+ * // Now the body of the message can be read from the stream.
366
+ * callback(null, header, stream);
367
+ * return;
368
+ * }
369
+ * // Still reading the header.
370
+ * header += str;
371
+ * }
372
+ * }
373
+ * }
374
+ * ```
375
+ *
376
+ * Unlike {@link push}, `stream.unshift(chunk)` will not
377
+ * end the reading process by resetting the internal reading state of the stream.
378
+ * This can cause unexpected results if `readable.unshift()` is called during a
379
+ * read (i.e. from within a {@link _read} implementation on a
380
+ * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately,
381
+ * however it is best to simply avoid calling `readable.unshift()` while in the
382
+ * process of performing a read.
383
+ * @since v0.9.11
384
+ * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must
385
+ * be a {string}, {Buffer}, {TypedArray}, {DataView} or `null`. For object mode streams, `chunk` may be any JavaScript value.
386
+ * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`.
387
+ */
388
+ unshift(chunk: any, encoding?: BufferEncoding): void;
389
+ /**
390
+ * Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See `Compatibility` for more
391
+ * information.)
392
+ *
393
+ * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the `readable.wrap()` method can be used to create a `Readable`
394
+ * stream that uses
395
+ * the old stream as its data source.
396
+ *
397
+ * It will rarely be necessary to use `readable.wrap()` but the method has been
398
+ * provided as a convenience for interacting with older Node.js applications and
399
+ * libraries.
400
+ *
401
+ * ```js
402
+ * const { OldReader } = require('./old-api-module.js');
403
+ * const { Readable } = require('node:stream');
404
+ * const oreader = new OldReader();
405
+ * const myReader = new Readable().wrap(oreader);
406
+ *
407
+ * myReader.on('readable', () => {
408
+ * myReader.read(); // etc.
409
+ * });
410
+ * ```
411
+ * @since v0.9.4
412
+ * @param stream An "old style" readable stream
413
+ */
414
+ wrap(stream: NodeJS.ReadableStream): this;
415
+ push(chunk: any, encoding?: BufferEncoding): boolean;
416
+ /**
417
+ * The iterator created by this method gives users the option to cancel the destruction
418
+ * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
419
+ * or if the iterator should destroy the stream if the stream emitted an error during iteration.
420
+ * @since v16.3.0
421
+ * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
422
+ * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
423
+ * **Default: `true`**.
424
+ */
425
+ iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator<any>;
426
+ /**
427
+ * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
428
+ * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
429
+ * @since v17.4.0, v16.14.0
430
+ * @param fn a function to map over every chunk in the stream. Async or not.
431
+ * @returns a stream mapped with the function *fn*.
432
+ */
433
+ map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
434
+ /**
435
+ * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
436
+ * and if it returns a truthy value, the chunk will be passed to the result stream.
437
+ * If the *fn* function returns a promise - that promise will be `await`ed.
438
+ * @since v17.4.0, v16.14.0
439
+ * @param fn a function to filter chunks from the stream. Async or not.
440
+ * @returns a stream filtered with the predicate *fn*.
441
+ */
442
+ filter(
443
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
444
+ options?: ArrayOptions,
445
+ ): Readable;
446
+ /**
447
+ * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called.
448
+ * If the *fn* function returns a promise - that promise will be `await`ed.
449
+ *
450
+ * This method is different from `for await...of` loops in that it can optionally process chunks concurrently.
451
+ * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option
452
+ * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`.
453
+ * In either case the stream will be destroyed.
454
+ *
455
+ * This method is different from listening to the `'data'` event in that it uses the `readable` event
456
+ * in the underlying machinary and can limit the number of concurrent *fn* calls.
457
+ * @since v17.5.0
458
+ * @param fn a function to call on each chunk of the stream. Async or not.
459
+ * @returns a promise for when the stream has finished.
460
+ */
461
+ forEach(
462
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,
463
+ options?: ArrayOptions,
464
+ ): Promise<void>;
465
+ /**
466
+ * This method allows easily obtaining the contents of a stream.
467
+ *
468
+ * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended
469
+ * for interoperability and convenience, not as the primary way to consume streams.
470
+ * @since v17.5.0
471
+ * @returns a promise containing an array with the contents of the stream.
472
+ */
473
+ toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
474
+ /**
475
+ * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream
476
+ * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk
477
+ * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`.
478
+ * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`.
479
+ * @since v17.5.0
480
+ * @param fn a function to call on each chunk of the stream. Async or not.
481
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.
482
+ */
483
+ some(
484
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
485
+ options?: ArrayOptions,
486
+ ): Promise<boolean>;
487
+ /**
488
+ * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream
489
+ * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy,
490
+ * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value.
491
+ * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`.
492
+ * @since v17.5.0
493
+ * @param fn a function to call on each chunk of the stream. Async or not.
494
+ * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value,
495
+ * or `undefined` if no element was found.
496
+ */
497
+ find<T>(
498
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => data is T,
499
+ options?: ArrayOptions,
500
+ ): Promise<T | undefined>;
501
+ find(
502
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
503
+ options?: ArrayOptions,
504
+ ): Promise<any>;
505
+ /**
506
+ * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream
507
+ * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk
508
+ * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`.
509
+ * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`.
510
+ * @since v17.5.0
511
+ * @param fn a function to call on each chunk of the stream. Async or not.
512
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks.
513
+ */
514
+ every(
515
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
516
+ options?: ArrayOptions,
517
+ ): Promise<boolean>;
518
+ /**
519
+ * This method returns a new stream by applying the given callback to each chunk of the stream
520
+ * and then flattening the result.
521
+ *
522
+ * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams
523
+ * will be merged (flattened) into the returned stream.
524
+ * @since v17.5.0
525
+ * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator.
526
+ * @returns a stream flat-mapped with the function *fn*.
527
+ */
528
+ flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
529
+ /**
530
+ * This method returns a new stream with the first *limit* chunks dropped from the start.
531
+ * @since v17.5.0
532
+ * @param limit the number of chunks to drop from the readable.
533
+ * @returns a stream with *limit* chunks dropped from the start.
534
+ */
535
+ drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
536
+ /**
537
+ * This method returns a new stream with the first *limit* chunks.
538
+ * @since v17.5.0
539
+ * @param limit the number of chunks to take from the readable.
540
+ * @returns a stream with *limit* chunks taken.
541
+ */
542
+ take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
543
+ /**
544
+ * This method returns a new stream with chunks of the underlying stream paired with a counter
545
+ * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced.
546
+ * @since v17.5.0
547
+ * @returns a stream of indexed pairs.
548
+ */
549
+ asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
550
+ /**
551
+ * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation
552
+ * on the previous element. It returns a promise for the final value of the reduction.
553
+ *
554
+ * If no *initial* value is supplied the first chunk of the stream is used as the initial value.
555
+ * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property.
556
+ *
557
+ * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter
558
+ * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method.
559
+ * @since v17.5.0
560
+ * @param fn a reducer function to call over every chunk in the stream. Async or not.
561
+ * @param initial the initial value to use in the reduction.
562
+ * @returns a promise for the final value of the reduction.
563
+ */
564
+ reduce<T = any>(
565
+ fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,
566
+ initial?: undefined,
567
+ options?: Pick<ArrayOptions, "signal">,
568
+ ): Promise<T>;
569
+ reduce<T = any>(
570
+ fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,
571
+ initial: T,
572
+ options?: Pick<ArrayOptions, "signal">,
573
+ ): Promise<T>;
574
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
575
+ /**
576
+ * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable
577
+ * stream will release any internal resources and subsequent calls to `push()` will be ignored.
578
+ *
579
+ * Once `destroy()` has been called any further calls will be a no-op and no
580
+ * further errors except from `_destroy()` may be emitted as `'error'`.
581
+ *
582
+ * Implementors should not override this method, but instead implement `readable._destroy()`.
583
+ * @since v8.0.0
584
+ * @param error Error which will be passed as payload in `'error'` event
585
+ */
586
+ destroy(error?: Error): this;
587
+ /**
588
+ * Event emitter
589
+ * The defined events on documents including:
590
+ * 1. close
591
+ * 2. data
592
+ * 3. end
593
+ * 4. error
594
+ * 5. pause
595
+ * 6. readable
596
+ * 7. resume
597
+ */
598
+ addListener(event: "close", listener: () => void): this;
599
+ addListener(event: "data", listener: (chunk: any) => void): this;
600
+ addListener(event: "end", listener: () => void): this;
601
+ addListener(event: "error", listener: (err: Error) => void): this;
602
+ addListener(event: "pause", listener: () => void): this;
603
+ addListener(event: "readable", listener: () => void): this;
604
+ addListener(event: "resume", listener: () => void): this;
605
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
606
+ emit(event: "close"): boolean;
607
+ emit(event: "data", chunk: any): boolean;
608
+ emit(event: "end"): boolean;
609
+ emit(event: "error", err: Error): boolean;
610
+ emit(event: "pause"): boolean;
611
+ emit(event: "readable"): boolean;
612
+ emit(event: "resume"): boolean;
613
+ emit(event: string | symbol, ...args: any[]): boolean;
614
+ on(event: "close", listener: () => void): this;
615
+ on(event: "data", listener: (chunk: any) => void): this;
616
+ on(event: "end", listener: () => void): this;
617
+ on(event: "error", listener: (err: Error) => void): this;
618
+ on(event: "pause", listener: () => void): this;
619
+ on(event: "readable", listener: () => void): this;
620
+ on(event: "resume", listener: () => void): this;
621
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
622
+ once(event: "close", listener: () => void): this;
623
+ once(event: "data", listener: (chunk: any) => void): this;
624
+ once(event: "end", listener: () => void): this;
625
+ once(event: "error", listener: (err: Error) => void): this;
626
+ once(event: "pause", listener: () => void): this;
627
+ once(event: "readable", listener: () => void): this;
628
+ once(event: "resume", listener: () => void): this;
629
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
630
+ prependListener(event: "close", listener: () => void): this;
631
+ prependListener(event: "data", listener: (chunk: any) => void): this;
632
+ prependListener(event: "end", listener: () => void): this;
633
+ prependListener(event: "error", listener: (err: Error) => void): this;
634
+ prependListener(event: "pause", listener: () => void): this;
635
+ prependListener(event: "readable", listener: () => void): this;
636
+ prependListener(event: "resume", listener: () => void): this;
637
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
638
+ prependOnceListener(event: "close", listener: () => void): this;
639
+ prependOnceListener(event: "data", listener: (chunk: any) => void): this;
640
+ prependOnceListener(event: "end", listener: () => void): this;
641
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
642
+ prependOnceListener(event: "pause", listener: () => void): this;
643
+ prependOnceListener(event: "readable", listener: () => void): this;
644
+ prependOnceListener(event: "resume", listener: () => void): this;
645
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
646
+ removeListener(event: "close", listener: () => void): this;
647
+ removeListener(event: "data", listener: (chunk: any) => void): this;
648
+ removeListener(event: "end", listener: () => void): this;
649
+ removeListener(event: "error", listener: (err: Error) => void): this;
650
+ removeListener(event: "pause", listener: () => void): this;
651
+ removeListener(event: "readable", listener: () => void): this;
652
+ removeListener(event: "resume", listener: () => void): this;
653
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
654
+ [Symbol.asyncIterator](): AsyncIterableIterator<any>;
655
+ /**
656
+ * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.
657
+ * @since v20.4.0
658
+ */
659
+ [Symbol.asyncDispose](): Promise<void>;
660
+ }
661
+ import WritableOptions = internal.WritableOptions;
662
+ class WritableBase extends Stream implements NodeJS.WritableStream {
663
+ /**
664
+ * Is `true` if it is safe to call `writable.write()`, which means
665
+ * the stream has not been destroyed, errored, or ended.
666
+ * @since v11.4.0
667
+ */
668
+ readonly writable: boolean;
669
+ /**
670
+ * Is `true` after `writable.end()` has been called. This property
671
+ * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.
672
+ * @since v12.9.0
673
+ */
674
+ readonly writableEnded: boolean;
675
+ /**
676
+ * Is set to `true` immediately before the `'finish'` event is emitted.
677
+ * @since v12.6.0
678
+ */
679
+ readonly writableFinished: boolean;
680
+ /**
681
+ * Return the value of `highWaterMark` passed when creating this `Writable`.
682
+ * @since v9.3.0
683
+ */
684
+ readonly writableHighWaterMark: number;
685
+ /**
686
+ * This property contains the number of bytes (or objects) in the queue
687
+ * ready to be written. The value provides introspection data regarding
688
+ * the status of the `highWaterMark`.
689
+ * @since v9.4.0
690
+ */
691
+ readonly writableLength: number;
692
+ /**
693
+ * Getter for the property `objectMode` of a given `Writable` stream.
694
+ * @since v12.3.0
695
+ */
696
+ readonly writableObjectMode: boolean;
697
+ /**
698
+ * Number of times `writable.uncork()` needs to be
699
+ * called in order to fully uncork the stream.
700
+ * @since v13.2.0, v12.16.0
701
+ */
702
+ readonly writableCorked: number;
703
+ /**
704
+ * Is `true` after `writable.destroy()` has been called.
705
+ * @since v8.0.0
706
+ */
707
+ destroyed: boolean;
708
+ /**
709
+ * Is `true` after `'close'` has been emitted.
710
+ * @since v18.0.0
711
+ */
712
+ readonly closed: boolean;
713
+ /**
714
+ * Returns error if the stream has been destroyed with an error.
715
+ * @since v18.0.0
716
+ */
717
+ readonly errored: Error | null;
718
+ /**
719
+ * Is `true` if the stream's buffer has been full and stream will emit `'drain'`.
720
+ * @since v15.2.0, v14.17.0
721
+ */
722
+ readonly writableNeedDrain: boolean;
723
+ constructor(opts?: WritableOptions);
724
+ _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
725
+ _writev?(
726
+ chunks: Array<{
727
+ chunk: any;
728
+ encoding: BufferEncoding;
729
+ }>,
730
+ callback: (error?: Error | null) => void,
731
+ ): void;
732
+ _construct?(callback: (error?: Error | null) => void): void;
733
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
734
+ _final(callback: (error?: Error | null) => void): void;
735
+ /**
736
+ * The `writable.write()` method writes some data to the stream, and calls the
737
+ * supplied `callback` once the data has been fully handled. If an error
738
+ * occurs, the `callback` will be called with the error as its
739
+ * first argument. The `callback` is called asynchronously and before `'error'` is
740
+ * emitted.
741
+ *
742
+ * The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`.
743
+ * If `false` is returned, further attempts to write data to the stream should
744
+ * stop until the `'drain'` event is emitted.
745
+ *
746
+ * While a stream is not draining, calls to `write()` will buffer `chunk`, and
747
+ * return false. Once all currently buffered chunks are drained (accepted for
748
+ * delivery by the operating system), the `'drain'` event will be emitted.
749
+ * Once `write()` returns false, do not write more chunks
750
+ * until the `'drain'` event is emitted. While calling `write()` on a stream that
751
+ * is not draining is allowed, Node.js will buffer all written chunks until
752
+ * maximum memory usage occurs, at which point it will abort unconditionally.
753
+ * Even before it aborts, high memory usage will cause poor garbage collector
754
+ * performance and high RSS (which is not typically released back to the system,
755
+ * even after the memory is no longer required). Since TCP sockets may never
756
+ * drain if the remote peer does not read the data, writing a socket that is
757
+ * not draining may lead to a remotely exploitable vulnerability.
758
+ *
759
+ * Writing data while the stream is not draining is particularly
760
+ * problematic for a `Transform`, because the `Transform` streams are paused
761
+ * by default until they are piped or a `'data'` or `'readable'` event handler
762
+ * is added.
763
+ *
764
+ * If the data to be written can be generated or fetched on demand, it is
765
+ * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is
766
+ * possible to respect backpressure and avoid memory issues using the `'drain'` event:
767
+ *
768
+ * ```js
769
+ * function write(data, cb) {
770
+ * if (!stream.write(data)) {
771
+ * stream.once('drain', cb);
772
+ * } else {
773
+ * process.nextTick(cb);
774
+ * }
775
+ * }
776
+ *
777
+ * // Wait for cb to be called before doing any other write.
778
+ * write('hello', () => {
779
+ * console.log('Write completed, do more writes now.');
780
+ * });
781
+ * ```
782
+ *
783
+ * A `Writable` stream in object mode will always ignore the `encoding` argument.
784
+ * @since v0.9.4
785
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
786
+ * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
787
+ * @param [encoding='utf8'] The encoding, if `chunk` is a string.
788
+ * @param callback Callback for when this chunk of data is flushed.
789
+ * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
790
+ */
791
+ write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
792
+ write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
793
+ /**
794
+ * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.
795
+ * @since v0.11.15
796
+ * @param encoding The new default encoding
797
+ */
798
+ setDefaultEncoding(encoding: BufferEncoding): this;
799
+ /**
800
+ * Calling the `writable.end()` method signals that no more data will be written
801
+ * to the `Writable`. The optional `chunk` and `encoding` arguments allow one
802
+ * final additional chunk of data to be written immediately before closing the
803
+ * stream.
804
+ *
805
+ * Calling the {@link write} method after calling {@link end} will raise an error.
806
+ *
807
+ * ```js
808
+ * // Write 'hello, ' and then end with 'world!'.
809
+ * const fs = require('node:fs');
810
+ * const file = fs.createWriteStream('example.txt');
811
+ * file.write('hello, ');
812
+ * file.end('world!');
813
+ * // Writing more now is not allowed!
814
+ * ```
815
+ * @since v0.9.4
816
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
817
+ * {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
818
+ * @param encoding The encoding if `chunk` is a string
819
+ * @param callback Callback for when the stream is finished.
820
+ */
821
+ end(cb?: () => void): this;
822
+ end(chunk: any, cb?: () => void): this;
823
+ end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
824
+ /**
825
+ * The `writable.cork()` method forces all written data to be buffered in memory.
826
+ * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called.
827
+ *
828
+ * The primary intent of `writable.cork()` is to accommodate a situation in which
829
+ * several small chunks are written to the stream in rapid succession. Instead of
830
+ * immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them
831
+ * all to `writable._writev()`, if present. This prevents a head-of-line blocking
832
+ * situation where data is being buffered while waiting for the first small chunk
833
+ * to be processed. However, use of `writable.cork()` without implementing `writable._writev()` may have an adverse effect on throughput.
834
+ *
835
+ * See also: `writable.uncork()`, `writable._writev()`.
836
+ * @since v0.11.2
837
+ */
838
+ cork(): void;
839
+ /**
840
+ * The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
841
+ *
842
+ * When using `writable.cork()` and `writable.uncork()` to manage the buffering
843
+ * of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event
844
+ * loop phase.
845
+ *
846
+ * ```js
847
+ * stream.cork();
848
+ * stream.write('some ');
849
+ * stream.write('data ');
850
+ * process.nextTick(() => stream.uncork());
851
+ * ```
852
+ *
853
+ * If the `writable.cork()` method is called multiple times on a stream, the
854
+ * same number of calls to `writable.uncork()` must be called to flush the buffered
855
+ * data.
856
+ *
857
+ * ```js
858
+ * stream.cork();
859
+ * stream.write('some ');
860
+ * stream.cork();
861
+ * stream.write('data ');
862
+ * process.nextTick(() => {
863
+ * stream.uncork();
864
+ * // The data will not be flushed until uncork() is called a second time.
865
+ * stream.uncork();
866
+ * });
867
+ * ```
868
+ *
869
+ * See also: `writable.cork()`.
870
+ * @since v0.11.2
871
+ */
872
+ uncork(): void;
873
+ /**
874
+ * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable
875
+ * stream has ended and subsequent calls to `write()` or `end()` will result in
876
+ * an `ERR_STREAM_DESTROYED` error.
877
+ * This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.
878
+ * Use `end()` instead of destroy if data should flush before close, or wait for
879
+ * the `'drain'` event before destroying the stream.
880
+ *
881
+ * Once `destroy()` has been called any further calls will be a no-op and no
882
+ * further errors except from `_destroy()` may be emitted as `'error'`.
883
+ *
884
+ * Implementors should not override this method,
885
+ * but instead implement `writable._destroy()`.
886
+ * @since v8.0.0
887
+ * @param error Optional, an error to emit with `'error'` event.
888
+ */
889
+ destroy(error?: Error): this;
890
+ /**
891
+ * Event emitter
892
+ * The defined events on documents including:
893
+ * 1. close
894
+ * 2. drain
895
+ * 3. error
896
+ * 4. finish
897
+ * 5. pipe
898
+ * 6. unpipe
899
+ */
900
+ addListener(event: "close", listener: () => void): this;
901
+ addListener(event: "drain", listener: () => void): this;
902
+ addListener(event: "error", listener: (err: Error) => void): this;
903
+ addListener(event: "finish", listener: () => void): this;
904
+ addListener(event: "pipe", listener: (src: Readable) => void): this;
905
+ addListener(event: "unpipe", listener: (src: Readable) => void): this;
906
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
907
+ emit(event: "close"): boolean;
908
+ emit(event: "drain"): boolean;
909
+ emit(event: "error", err: Error): boolean;
910
+ emit(event: "finish"): boolean;
911
+ emit(event: "pipe", src: Readable): boolean;
912
+ emit(event: "unpipe", src: Readable): boolean;
913
+ emit(event: string | symbol, ...args: any[]): boolean;
914
+ on(event: "close", listener: () => void): this;
915
+ on(event: "drain", listener: () => void): this;
916
+ on(event: "error", listener: (err: Error) => void): this;
917
+ on(event: "finish", listener: () => void): this;
918
+ on(event: "pipe", listener: (src: Readable) => void): this;
919
+ on(event: "unpipe", listener: (src: Readable) => void): this;
920
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
921
+ once(event: "close", listener: () => void): this;
922
+ once(event: "drain", listener: () => void): this;
923
+ once(event: "error", listener: (err: Error) => void): this;
924
+ once(event: "finish", listener: () => void): this;
925
+ once(event: "pipe", listener: (src: Readable) => void): this;
926
+ once(event: "unpipe", listener: (src: Readable) => void): this;
927
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
928
+ prependListener(event: "close", listener: () => void): this;
929
+ prependListener(event: "drain", listener: () => void): this;
930
+ prependListener(event: "error", listener: (err: Error) => void): this;
931
+ prependListener(event: "finish", listener: () => void): this;
932
+ prependListener(event: "pipe", listener: (src: Readable) => void): this;
933
+ prependListener(event: "unpipe", listener: (src: Readable) => void): this;
934
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
935
+ prependOnceListener(event: "close", listener: () => void): this;
936
+ prependOnceListener(event: "drain", listener: () => void): this;
937
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
938
+ prependOnceListener(event: "finish", listener: () => void): this;
939
+ prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
940
+ prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
941
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
942
+ removeListener(event: "close", listener: () => void): this;
943
+ removeListener(event: "drain", listener: () => void): this;
944
+ removeListener(event: "error", listener: (err: Error) => void): this;
945
+ removeListener(event: "finish", listener: () => void): this;
946
+ removeListener(event: "pipe", listener: (src: Readable) => void): this;
947
+ removeListener(event: "unpipe", listener: (src: Readable) => void): this;
948
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
949
+ }
950
+ namespace internal {
951
+ class Stream extends internal {
952
+ constructor(opts?: ReadableOptions);
953
+ }
954
+ interface StreamOptions<T extends Stream> extends Abortable {
955
+ emitClose?: boolean | undefined;
956
+ highWaterMark?: number | undefined;
957
+ objectMode?: boolean | undefined;
958
+ construct?(this: T, callback: (error?: Error | null) => void): void;
959
+ destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void;
960
+ autoDestroy?: boolean | undefined;
961
+ }
962
+ interface ReadableOptions extends StreamOptions<Readable> {
963
+ encoding?: BufferEncoding | undefined;
964
+ read?(this: Readable, size: number): void;
965
+ }
966
+ /**
967
+ * @since v0.9.4
968
+ */
969
+ class Readable extends ReadableBase {
970
+ /**
971
+ * A utility method for creating a `Readable` from a web `ReadableStream`.
972
+ * @since v17.0.0
973
+ * @experimental
974
+ */
975
+ static fromWeb(
976
+ readableStream: streamWeb.ReadableStream,
977
+ options?: Pick<ReadableOptions, "encoding" | "highWaterMark" | "objectMode" | "signal">,
978
+ ): Readable;
979
+ /**
980
+ * A utility method for creating a web `ReadableStream` from a `Readable`.
981
+ * @since v17.0.0
982
+ * @experimental
983
+ */
984
+ static toWeb(streamReadable: Readable): streamWeb.ReadableStream;
985
+ }
986
+ interface WritableOptions extends StreamOptions<Writable> {
987
+ decodeStrings?: boolean | undefined;
988
+ defaultEncoding?: BufferEncoding | undefined;
989
+ write?(
990
+ this: Writable,
991
+ chunk: any,
992
+ encoding: BufferEncoding,
993
+ callback: (error?: Error | null) => void,
994
+ ): void;
995
+ writev?(
996
+ this: Writable,
997
+ chunks: Array<{
998
+ chunk: any;
999
+ encoding: BufferEncoding;
1000
+ }>,
1001
+ callback: (error?: Error | null) => void,
1002
+ ): void;
1003
+ final?(this: Writable, callback: (error?: Error | null) => void): void;
1004
+ }
1005
+ /**
1006
+ * @since v0.9.4
1007
+ */
1008
+ class Writable extends WritableBase {
1009
+ /**
1010
+ * A utility method for creating a `Writable` from a web `WritableStream`.
1011
+ * @since v17.0.0
1012
+ * @experimental
1013
+ */
1014
+ static fromWeb(
1015
+ writableStream: streamWeb.WritableStream,
1016
+ options?: Pick<WritableOptions, "decodeStrings" | "highWaterMark" | "objectMode" | "signal">,
1017
+ ): Writable;
1018
+ /**
1019
+ * A utility method for creating a web `WritableStream` from a `Writable`.
1020
+ * @since v17.0.0
1021
+ * @experimental
1022
+ */
1023
+ static toWeb(streamWritable: Writable): streamWeb.WritableStream;
1024
+ }
1025
+ interface DuplexOptions extends ReadableOptions, WritableOptions {
1026
+ allowHalfOpen?: boolean | undefined;
1027
+ readableObjectMode?: boolean | undefined;
1028
+ writableObjectMode?: boolean | undefined;
1029
+ readableHighWaterMark?: number | undefined;
1030
+ writableHighWaterMark?: number | undefined;
1031
+ writableCorked?: number | undefined;
1032
+ construct?(this: Duplex, callback: (error?: Error | null) => void): void;
1033
+ read?(this: Duplex, size: number): void;
1034
+ write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
1035
+ writev?(
1036
+ this: Duplex,
1037
+ chunks: Array<{
1038
+ chunk: any;
1039
+ encoding: BufferEncoding;
1040
+ }>,
1041
+ callback: (error?: Error | null) => void,
1042
+ ): void;
1043
+ final?(this: Duplex, callback: (error?: Error | null) => void): void;
1044
+ destroy?(this: Duplex, error: Error | null, callback: (error?: Error | null) => void): void;
1045
+ }
1046
+ /**
1047
+ * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
1048
+ *
1049
+ * Examples of `Duplex` streams include:
1050
+ *
1051
+ * * `TCP sockets`
1052
+ * * `zlib streams`
1053
+ * * `crypto streams`
1054
+ * @since v0.9.4
1055
+ */
1056
+ class Duplex extends ReadableBase implements WritableBase {
1057
+ readonly writable: boolean;
1058
+ readonly writableEnded: boolean;
1059
+ readonly writableFinished: boolean;
1060
+ readonly writableHighWaterMark: number;
1061
+ readonly writableLength: number;
1062
+ readonly writableObjectMode: boolean;
1063
+ readonly writableCorked: number;
1064
+ readonly writableNeedDrain: boolean;
1065
+ readonly closed: boolean;
1066
+ readonly errored: Error | null;
1067
+ /**
1068
+ * If `false` then the stream will automatically end the writable side when the
1069
+ * readable side ends. Set initially by the `allowHalfOpen` constructor option,
1070
+ * which defaults to `true`.
1071
+ *
1072
+ * This can be changed manually to change the half-open behavior of an existing
1073
+ * `Duplex` stream instance, but must be changed before the `'end'` event is emitted.
1074
+ * @since v0.9.4
1075
+ */
1076
+ allowHalfOpen: boolean;
1077
+ constructor(opts?: DuplexOptions);
1078
+ /**
1079
+ * A utility method for creating duplex streams.
1080
+ *
1081
+ * - `Stream` converts writable stream into writable `Duplex` and readable stream
1082
+ * to `Duplex`.
1083
+ * - `Blob` converts into readable `Duplex`.
1084
+ * - `string` converts into readable `Duplex`.
1085
+ * - `ArrayBuffer` converts into readable `Duplex`.
1086
+ * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`.
1087
+ * - `AsyncGeneratorFunction` converts into a readable/writable transform
1088
+ * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield
1089
+ * `null`.
1090
+ * - `AsyncFunction` converts into a writable `Duplex`. Must return
1091
+ * either `null` or `undefined`
1092
+ * - `Object ({ writable, readable })` converts `readable` and
1093
+ * `writable` into `Stream` and then combines them into `Duplex` where the
1094
+ * `Duplex` will write to the `writable` and read from the `readable`.
1095
+ * - `Promise` converts into readable `Duplex`. Value `null` is ignored.
1096
+ *
1097
+ * @since v16.8.0
1098
+ */
1099
+ static from(
1100
+ src:
1101
+ | Stream
1102
+ | NodeBlob
1103
+ | ArrayBuffer
1104
+ | string
1105
+ | Iterable<any>
1106
+ | AsyncIterable<any>
1107
+ | AsyncGeneratorFunction
1108
+ | Promise<any>
1109
+ | Object,
1110
+ ): Duplex;
1111
+ _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
1112
+ _writev?(
1113
+ chunks: Array<{
1114
+ chunk: any;
1115
+ encoding: BufferEncoding;
1116
+ }>,
1117
+ callback: (error?: Error | null) => void,
1118
+ ): void;
1119
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
1120
+ _final(callback: (error?: Error | null) => void): void;
1121
+ write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
1122
+ write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
1123
+ setDefaultEncoding(encoding: BufferEncoding): this;
1124
+ end(cb?: () => void): this;
1125
+ end(chunk: any, cb?: () => void): this;
1126
+ end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
1127
+ cork(): void;
1128
+ uncork(): void;
1129
+ /**
1130
+ * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
1131
+ * @since v17.0.0
1132
+ * @experimental
1133
+ */
1134
+ static toWeb(streamDuplex: Duplex): {
1135
+ readable: streamWeb.ReadableStream;
1136
+ writable: streamWeb.WritableStream;
1137
+ };
1138
+ /**
1139
+ * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
1140
+ * @since v17.0.0
1141
+ * @experimental
1142
+ */
1143
+ static fromWeb(
1144
+ duplexStream: {
1145
+ readable: streamWeb.ReadableStream;
1146
+ writable: streamWeb.WritableStream;
1147
+ },
1148
+ options?: Pick<
1149
+ DuplexOptions,
1150
+ "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal"
1151
+ >,
1152
+ ): Duplex;
1153
+ /**
1154
+ * Event emitter
1155
+ * The defined events on documents including:
1156
+ * 1. close
1157
+ * 2. data
1158
+ * 3. drain
1159
+ * 4. end
1160
+ * 5. error
1161
+ * 6. finish
1162
+ * 7. pause
1163
+ * 8. pipe
1164
+ * 9. readable
1165
+ * 10. resume
1166
+ * 11. unpipe
1167
+ */
1168
+ addListener(event: "close", listener: () => void): this;
1169
+ addListener(event: "data", listener: (chunk: any) => void): this;
1170
+ addListener(event: "drain", listener: () => void): this;
1171
+ addListener(event: "end", listener: () => void): this;
1172
+ addListener(event: "error", listener: (err: Error) => void): this;
1173
+ addListener(event: "finish", listener: () => void): this;
1174
+ addListener(event: "pause", listener: () => void): this;
1175
+ addListener(event: "pipe", listener: (src: Readable) => void): this;
1176
+ addListener(event: "readable", listener: () => void): this;
1177
+ addListener(event: "resume", listener: () => void): this;
1178
+ addListener(event: "unpipe", listener: (src: Readable) => void): this;
1179
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1180
+ emit(event: "close"): boolean;
1181
+ emit(event: "data", chunk: any): boolean;
1182
+ emit(event: "drain"): boolean;
1183
+ emit(event: "end"): boolean;
1184
+ emit(event: "error", err: Error): boolean;
1185
+ emit(event: "finish"): boolean;
1186
+ emit(event: "pause"): boolean;
1187
+ emit(event: "pipe", src: Readable): boolean;
1188
+ emit(event: "readable"): boolean;
1189
+ emit(event: "resume"): boolean;
1190
+ emit(event: "unpipe", src: Readable): boolean;
1191
+ emit(event: string | symbol, ...args: any[]): boolean;
1192
+ on(event: "close", listener: () => void): this;
1193
+ on(event: "data", listener: (chunk: any) => void): this;
1194
+ on(event: "drain", listener: () => void): this;
1195
+ on(event: "end", listener: () => void): this;
1196
+ on(event: "error", listener: (err: Error) => void): this;
1197
+ on(event: "finish", listener: () => void): this;
1198
+ on(event: "pause", listener: () => void): this;
1199
+ on(event: "pipe", listener: (src: Readable) => void): this;
1200
+ on(event: "readable", listener: () => void): this;
1201
+ on(event: "resume", listener: () => void): this;
1202
+ on(event: "unpipe", listener: (src: Readable) => void): this;
1203
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
1204
+ once(event: "close", listener: () => void): this;
1205
+ once(event: "data", listener: (chunk: any) => void): this;
1206
+ once(event: "drain", listener: () => void): this;
1207
+ once(event: "end", listener: () => void): this;
1208
+ once(event: "error", listener: (err: Error) => void): this;
1209
+ once(event: "finish", listener: () => void): this;
1210
+ once(event: "pause", listener: () => void): this;
1211
+ once(event: "pipe", listener: (src: Readable) => void): this;
1212
+ once(event: "readable", listener: () => void): this;
1213
+ once(event: "resume", listener: () => void): this;
1214
+ once(event: "unpipe", listener: (src: Readable) => void): this;
1215
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
1216
+ prependListener(event: "close", listener: () => void): this;
1217
+ prependListener(event: "data", listener: (chunk: any) => void): this;
1218
+ prependListener(event: "drain", listener: () => void): this;
1219
+ prependListener(event: "end", listener: () => void): this;
1220
+ prependListener(event: "error", listener: (err: Error) => void): this;
1221
+ prependListener(event: "finish", listener: () => void): this;
1222
+ prependListener(event: "pause", listener: () => void): this;
1223
+ prependListener(event: "pipe", listener: (src: Readable) => void): this;
1224
+ prependListener(event: "readable", listener: () => void): this;
1225
+ prependListener(event: "resume", listener: () => void): this;
1226
+ prependListener(event: "unpipe", listener: (src: Readable) => void): this;
1227
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1228
+ prependOnceListener(event: "close", listener: () => void): this;
1229
+ prependOnceListener(event: "data", listener: (chunk: any) => void): this;
1230
+ prependOnceListener(event: "drain", listener: () => void): this;
1231
+ prependOnceListener(event: "end", listener: () => void): this;
1232
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
1233
+ prependOnceListener(event: "finish", listener: () => void): this;
1234
+ prependOnceListener(event: "pause", listener: () => void): this;
1235
+ prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
1236
+ prependOnceListener(event: "readable", listener: () => void): this;
1237
+ prependOnceListener(event: "resume", listener: () => void): this;
1238
+ prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
1239
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1240
+ removeListener(event: "close", listener: () => void): this;
1241
+ removeListener(event: "data", listener: (chunk: any) => void): this;
1242
+ removeListener(event: "drain", listener: () => void): this;
1243
+ removeListener(event: "end", listener: () => void): this;
1244
+ removeListener(event: "error", listener: (err: Error) => void): this;
1245
+ removeListener(event: "finish", listener: () => void): this;
1246
+ removeListener(event: "pause", listener: () => void): this;
1247
+ removeListener(event: "pipe", listener: (src: Readable) => void): this;
1248
+ removeListener(event: "readable", listener: () => void): this;
1249
+ removeListener(event: "resume", listener: () => void): this;
1250
+ removeListener(event: "unpipe", listener: (src: Readable) => void): this;
1251
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1252
+ }
1253
+ type TransformCallback = (error?: Error | null, data?: any) => void;
1254
+ interface TransformOptions extends DuplexOptions {
1255
+ construct?(this: Transform, callback: (error?: Error | null) => void): void;
1256
+ read?(this: Transform, size: number): void;
1257
+ write?(
1258
+ this: Transform,
1259
+ chunk: any,
1260
+ encoding: BufferEncoding,
1261
+ callback: (error?: Error | null) => void,
1262
+ ): void;
1263
+ writev?(
1264
+ this: Transform,
1265
+ chunks: Array<{
1266
+ chunk: any;
1267
+ encoding: BufferEncoding;
1268
+ }>,
1269
+ callback: (error?: Error | null) => void,
1270
+ ): void;
1271
+ final?(this: Transform, callback: (error?: Error | null) => void): void;
1272
+ destroy?(this: Transform, error: Error | null, callback: (error?: Error | null) => void): void;
1273
+ transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1274
+ flush?(this: Transform, callback: TransformCallback): void;
1275
+ }
1276
+ /**
1277
+ * Transform streams are `Duplex` streams where the output is in some way
1278
+ * related to the input. Like all `Duplex` streams, `Transform` streams
1279
+ * implement both the `Readable` and `Writable` interfaces.
1280
+ *
1281
+ * Examples of `Transform` streams include:
1282
+ *
1283
+ * * `zlib streams`
1284
+ * * `crypto streams`
1285
+ * @since v0.9.4
1286
+ */
1287
+ class Transform extends Duplex {
1288
+ constructor(opts?: TransformOptions);
1289
+ _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1290
+ _flush(callback: TransformCallback): void;
1291
+ }
1292
+ /**
1293
+ * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is
1294
+ * primarily for examples and testing, but there are some use cases where `stream.PassThrough` is useful as a building block for novel sorts of streams.
1295
+ */
1296
+ class PassThrough extends Transform {}
1297
+ /**
1298
+ * A stream to attach a signal to.
1299
+ *
1300
+ * Attaches an AbortSignal to a readable or writeable stream. This lets code
1301
+ * control stream destruction using an `AbortController`.
1302
+ *
1303
+ * Calling `abort` on the `AbortController` corresponding to the passed `AbortSignal` will behave the same way as calling `.destroy(new AbortError())` on the
1304
+ * stream, and `controller.error(new AbortError())` for webstreams.
1305
+ *
1306
+ * ```js
1307
+ * const fs = require('node:fs');
1308
+ *
1309
+ * const controller = new AbortController();
1310
+ * const read = addAbortSignal(
1311
+ * controller.signal,
1312
+ * fs.createReadStream(('object.json')),
1313
+ * );
1314
+ * // Later, abort the operation closing the stream
1315
+ * controller.abort();
1316
+ * ```
1317
+ *
1318
+ * Or using an `AbortSignal` with a readable stream as an async iterable:
1319
+ *
1320
+ * ```js
1321
+ * const controller = new AbortController();
1322
+ * setTimeout(() => controller.abort(), 10_000); // set a timeout
1323
+ * const stream = addAbortSignal(
1324
+ * controller.signal,
1325
+ * fs.createReadStream(('object.json')),
1326
+ * );
1327
+ * (async () => {
1328
+ * try {
1329
+ * for await (const chunk of stream) {
1330
+ * await process(chunk);
1331
+ * }
1332
+ * } catch (e) {
1333
+ * if (e.name === 'AbortError') {
1334
+ * // The operation was cancelled
1335
+ * } else {
1336
+ * throw e;
1337
+ * }
1338
+ * }
1339
+ * })();
1340
+ * ```
1341
+ *
1342
+ * Or using an `AbortSignal` with a ReadableStream:
1343
+ *
1344
+ * ```js
1345
+ * const controller = new AbortController();
1346
+ * const rs = new ReadableStream({
1347
+ * start(controller) {
1348
+ * controller.enqueue('hello');
1349
+ * controller.enqueue('world');
1350
+ * controller.close();
1351
+ * },
1352
+ * });
1353
+ *
1354
+ * addAbortSignal(controller.signal, rs);
1355
+ *
1356
+ * finished(rs, (err) => {
1357
+ * if (err) {
1358
+ * if (err.name === 'AbortError') {
1359
+ * // The operation was cancelled
1360
+ * }
1361
+ * }
1362
+ * });
1363
+ *
1364
+ * const reader = rs.getReader();
1365
+ *
1366
+ * reader.read().then(({ value, done }) => {
1367
+ * console.log(value); // hello
1368
+ * console.log(done); // false
1369
+ * controller.abort();
1370
+ * });
1371
+ * ```
1372
+ * @since v15.4.0
1373
+ * @param signal A signal representing possible cancellation
1374
+ * @param stream A stream to attach a signal to.
1375
+ */
1376
+ function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
1377
+ /**
1378
+ * Returns the default highWaterMark used by streams.
1379
+ * Defaults to `16384` (16 KiB), or `16` for `objectMode`.
1380
+ * @since v19.9.0
1381
+ */
1382
+ function getDefaultHighWaterMark(objectMode: boolean): number;
1383
+ /**
1384
+ * Sets the default highWaterMark used by streams.
1385
+ * @since v19.9.0
1386
+ * @param value highWaterMark value
1387
+ */
1388
+ function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
1389
+ interface FinishedOptions extends Abortable {
1390
+ error?: boolean | undefined;
1391
+ readable?: boolean | undefined;
1392
+ writable?: boolean | undefined;
1393
+ }
1394
+ /**
1395
+ * A readable and/or writable stream/webstream.
1396
+ *
1397
+ * A function to get notified when a stream is no longer readable, writable
1398
+ * or has experienced an error or a premature close event.
1399
+ *
1400
+ * ```js
1401
+ * const { finished } = require('node:stream');
1402
+ * const fs = require('node:fs');
1403
+ *
1404
+ * const rs = fs.createReadStream('archive.tar');
1405
+ *
1406
+ * finished(rs, (err) => {
1407
+ * if (err) {
1408
+ * console.error('Stream failed.', err);
1409
+ * } else {
1410
+ * console.log('Stream is done reading.');
1411
+ * }
1412
+ * });
1413
+ *
1414
+ * rs.resume(); // Drain the stream.
1415
+ * ```
1416
+ *
1417
+ * Especially useful in error handling scenarios where a stream is destroyed
1418
+ * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`.
1419
+ *
1420
+ * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v20.x/api/stream.html#streamfinishedstream-options).
1421
+ *
1422
+ * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
1423
+ * invoked. The reason for this is so that unexpected `'error'` events (due to
1424
+ * incorrect stream implementations) do not cause unexpected crashes.
1425
+ * If this is unwanted behavior then the returned cleanup function needs to be
1426
+ * invoked in the callback:
1427
+ *
1428
+ * ```js
1429
+ * const cleanup = finished(rs, (err) => {
1430
+ * cleanup();
1431
+ * // ...
1432
+ * });
1433
+ * ```
1434
+ * @since v10.0.0
1435
+ * @param stream A readable and/or writable stream.
1436
+ * @param callback A callback function that takes an optional error argument.
1437
+ * @returns A cleanup function which removes all registered listeners.
1438
+ */
1439
+ function finished(
1440
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1441
+ options: FinishedOptions,
1442
+ callback: (err?: NodeJS.ErrnoException | null) => void,
1443
+ ): () => void;
1444
+ function finished(
1445
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1446
+ callback: (err?: NodeJS.ErrnoException | null) => void,
1447
+ ): () => void;
1448
+ namespace finished {
1449
+ function __promisify__(
1450
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1451
+ options?: FinishedOptions,
1452
+ ): Promise<void>;
1453
+ }
1454
+ type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
1455
+ type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
1456
+ type PipelineTransform<S extends PipelineTransformSource<any>, U> =
1457
+ | NodeJS.ReadWriteStream
1458
+ | ((
1459
+ source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ? AsyncIterable<ST>
1460
+ : S,
1461
+ ) => AsyncIterable<U>);
1462
+ type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
1463
+ type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
1464
+ type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<P>;
1465
+ type PipelineDestination<S extends PipelineTransformSource<any>, P> = S extends
1466
+ PipelineTransformSource<infer ST> ?
1467
+ | NodeJS.WritableStream
1468
+ | PipelineDestinationIterableFunction<ST>
1469
+ | PipelineDestinationPromiseFunction<ST, P>
1470
+ : never;
1471
+ type PipelineCallback<S extends PipelineDestination<any, any>> = S extends
1472
+ PipelineDestinationPromiseFunction<any, infer P> ? (err: NodeJS.ErrnoException | null, value: P) => void
1473
+ : (err: NodeJS.ErrnoException | null) => void;
1474
+ type PipelinePromise<S extends PipelineDestination<any, any>> = S extends
1475
+ PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
1476
+ interface PipelineOptions {
1477
+ signal?: AbortSignal | undefined;
1478
+ end?: boolean | undefined;
1479
+ }
1480
+ /**
1481
+ * A module method to pipe between streams and generators forwarding errors and
1482
+ * properly cleaning up and provide a callback when the pipeline is complete.
1483
+ *
1484
+ * ```js
1485
+ * const { pipeline } = require('node:stream');
1486
+ * const fs = require('node:fs');
1487
+ * const zlib = require('node:zlib');
1488
+ *
1489
+ * // Use the pipeline API to easily pipe a series of streams
1490
+ * // together and get notified when the pipeline is fully done.
1491
+ *
1492
+ * // A pipeline to gzip a potentially huge tar file efficiently:
1493
+ *
1494
+ * pipeline(
1495
+ * fs.createReadStream('archive.tar'),
1496
+ * zlib.createGzip(),
1497
+ * fs.createWriteStream('archive.tar.gz'),
1498
+ * (err) => {
1499
+ * if (err) {
1500
+ * console.error('Pipeline failed.', err);
1501
+ * } else {
1502
+ * console.log('Pipeline succeeded.');
1503
+ * }
1504
+ * },
1505
+ * );
1506
+ * ```
1507
+ *
1508
+ * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v20.x/api/stream.html#streampipelinesource-transforms-destination-options).
1509
+ *
1510
+ * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
1511
+ *
1512
+ * * `Readable` streams which have emitted `'end'` or `'close'`.
1513
+ * * `Writable` streams which have emitted `'finish'` or `'close'`.
1514
+ *
1515
+ * `stream.pipeline()` leaves dangling event listeners on the streams
1516
+ * after the `callback` has been invoked. In the case of reuse of streams after
1517
+ * failure, this can cause event listener leaks and swallowed errors. If the last
1518
+ * stream is readable, dangling event listeners will be removed so that the last
1519
+ * stream can be consumed later.
1520
+ *
1521
+ * `stream.pipeline()` closes all the streams when an error is raised.
1522
+ * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior
1523
+ * once it would destroy the socket without sending the expected response.
1524
+ * See the example below:
1525
+ *
1526
+ * ```js
1527
+ * const fs = require('node:fs');
1528
+ * const http = require('node:http');
1529
+ * const { pipeline } = require('node:stream');
1530
+ *
1531
+ * const server = http.createServer((req, res) => {
1532
+ * const fileStream = fs.createReadStream('./fileNotExist.txt');
1533
+ * pipeline(fileStream, res, (err) => {
1534
+ * if (err) {
1535
+ * console.log(err); // No such file
1536
+ * // this message can't be sent once `pipeline` already destroyed the socket
1537
+ * return res.end('error!!!');
1538
+ * }
1539
+ * });
1540
+ * });
1541
+ * ```
1542
+ * @since v10.0.0
1543
+ * @param callback Called when the pipeline is fully done.
1544
+ */
1545
+ function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1546
+ source: A,
1547
+ destination: B,
1548
+ callback: PipelineCallback<B>,
1549
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1550
+ function pipeline<
1551
+ A extends PipelineSource<any>,
1552
+ T1 extends PipelineTransform<A, any>,
1553
+ B extends PipelineDestination<T1, any>,
1554
+ >(
1555
+ source: A,
1556
+ transform1: T1,
1557
+ destination: B,
1558
+ callback: PipelineCallback<B>,
1559
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1560
+ function pipeline<
1561
+ A extends PipelineSource<any>,
1562
+ T1 extends PipelineTransform<A, any>,
1563
+ T2 extends PipelineTransform<T1, any>,
1564
+ B extends PipelineDestination<T2, any>,
1565
+ >(
1566
+ source: A,
1567
+ transform1: T1,
1568
+ transform2: T2,
1569
+ destination: B,
1570
+ callback: PipelineCallback<B>,
1571
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1572
+ function pipeline<
1573
+ A extends PipelineSource<any>,
1574
+ T1 extends PipelineTransform<A, any>,
1575
+ T2 extends PipelineTransform<T1, any>,
1576
+ T3 extends PipelineTransform<T2, any>,
1577
+ B extends PipelineDestination<T3, any>,
1578
+ >(
1579
+ source: A,
1580
+ transform1: T1,
1581
+ transform2: T2,
1582
+ transform3: T3,
1583
+ destination: B,
1584
+ callback: PipelineCallback<B>,
1585
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1586
+ function pipeline<
1587
+ A extends PipelineSource<any>,
1588
+ T1 extends PipelineTransform<A, any>,
1589
+ T2 extends PipelineTransform<T1, any>,
1590
+ T3 extends PipelineTransform<T2, any>,
1591
+ T4 extends PipelineTransform<T3, any>,
1592
+ B extends PipelineDestination<T4, any>,
1593
+ >(
1594
+ source: A,
1595
+ transform1: T1,
1596
+ transform2: T2,
1597
+ transform3: T3,
1598
+ transform4: T4,
1599
+ destination: B,
1600
+ callback: PipelineCallback<B>,
1601
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1602
+ function pipeline(
1603
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1604
+ callback: (err: NodeJS.ErrnoException | null) => void,
1605
+ ): NodeJS.WritableStream;
1606
+ function pipeline(
1607
+ stream1: NodeJS.ReadableStream,
1608
+ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1609
+ ...streams: Array<
1610
+ NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)
1611
+ >
1612
+ ): NodeJS.WritableStream;
1613
+ namespace pipeline {
1614
+ function __promisify__<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1615
+ source: A,
1616
+ destination: B,
1617
+ options?: PipelineOptions,
1618
+ ): PipelinePromise<B>;
1619
+ function __promisify__<
1620
+ A extends PipelineSource<any>,
1621
+ T1 extends PipelineTransform<A, any>,
1622
+ B extends PipelineDestination<T1, any>,
1623
+ >(
1624
+ source: A,
1625
+ transform1: T1,
1626
+ destination: B,
1627
+ options?: PipelineOptions,
1628
+ ): PipelinePromise<B>;
1629
+ function __promisify__<
1630
+ A extends PipelineSource<any>,
1631
+ T1 extends PipelineTransform<A, any>,
1632
+ T2 extends PipelineTransform<T1, any>,
1633
+ B extends PipelineDestination<T2, any>,
1634
+ >(
1635
+ source: A,
1636
+ transform1: T1,
1637
+ transform2: T2,
1638
+ destination: B,
1639
+ options?: PipelineOptions,
1640
+ ): PipelinePromise<B>;
1641
+ function __promisify__<
1642
+ A extends PipelineSource<any>,
1643
+ T1 extends PipelineTransform<A, any>,
1644
+ T2 extends PipelineTransform<T1, any>,
1645
+ T3 extends PipelineTransform<T2, any>,
1646
+ B extends PipelineDestination<T3, any>,
1647
+ >(
1648
+ source: A,
1649
+ transform1: T1,
1650
+ transform2: T2,
1651
+ transform3: T3,
1652
+ destination: B,
1653
+ options?: PipelineOptions,
1654
+ ): PipelinePromise<B>;
1655
+ function __promisify__<
1656
+ A extends PipelineSource<any>,
1657
+ T1 extends PipelineTransform<A, any>,
1658
+ T2 extends PipelineTransform<T1, any>,
1659
+ T3 extends PipelineTransform<T2, any>,
1660
+ T4 extends PipelineTransform<T3, any>,
1661
+ B extends PipelineDestination<T4, any>,
1662
+ >(
1663
+ source: A,
1664
+ transform1: T1,
1665
+ transform2: T2,
1666
+ transform3: T3,
1667
+ transform4: T4,
1668
+ destination: B,
1669
+ options?: PipelineOptions,
1670
+ ): PipelinePromise<B>;
1671
+ function __promisify__(
1672
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1673
+ options?: PipelineOptions,
1674
+ ): Promise<void>;
1675
+ function __promisify__(
1676
+ stream1: NodeJS.ReadableStream,
1677
+ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1678
+ ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
1679
+ ): Promise<void>;
1680
+ }
1681
+ interface Pipe {
1682
+ close(): void;
1683
+ hasRef(): boolean;
1684
+ ref(): void;
1685
+ unref(): void;
1686
+ }
1687
+ /**
1688
+ * Returns whether the stream has encountered an error.
1689
+ * @since v17.3.0, v16.14.0
1690
+ * @experimental
1691
+ */
1692
+ function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
1693
+ /**
1694
+ * Returns whether the stream is readable.
1695
+ * @since v17.4.0, v16.14.0
1696
+ * @experimental
1697
+ */
1698
+ function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
1699
+ const promises: typeof streamPromises;
1700
+ const consumers: typeof streamConsumers;
1701
+ }
1702
+ export = internal;
1703
+ }
1704
+ declare module "node:stream" {
1705
+ import stream = require("stream");
1706
+ export = stream;
1707
+ }