@psnext/slingcli 3.3.20260911-1 → 3.3.20260914-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-VDBOM5UG.js → chunk-BRL3MDQL.js} +1 -1
  2. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
  3. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  4. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  5. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +79 -32
  6. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -0
  7. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +25 -8
  8. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -0
  9. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js +2 -0
  10. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js +23 -8
  11. package/node_modules/@smithy/core/package.json +1 -1
  12. package/node_modules/@types/node/README.md +2 -2
  13. package/node_modules/@types/node/assert/strict.d.ts +13 -56
  14. package/node_modules/@types/node/assert.d.ts +189 -190
  15. package/node_modules/@types/node/async_hooks.d.ts +151 -43
  16. package/node_modules/@types/node/buffer.buffer.d.ts +12 -13
  17. package/node_modules/@types/node/buffer.d.ts +103 -237
  18. package/node_modules/@types/node/child_process.d.ts +39 -154
  19. package/node_modules/@types/node/cluster.d.ts +238 -384
  20. package/node_modules/@types/node/console.d.ts +45 -404
  21. package/node_modules/@types/node/constants.d.ts +3 -10
  22. package/node_modules/@types/node/crypto.d.ts +1000 -1593
  23. package/node_modules/@types/node/dgram.d.ts +133 -81
  24. package/node_modules/@types/node/diagnostics_channel.d.ts +277 -59
  25. package/node_modules/@types/node/dns/promises.d.ts +9 -15
  26. package/node_modules/@types/node/dns.d.ts +136 -183
  27. package/node_modules/@types/node/domain.d.ts +12 -32
  28. package/node_modules/@types/node/events.d.ts +872 -840
  29. package/node_modules/@types/node/ffi.d.ts +486 -0
  30. package/node_modules/@types/node/fs/promises.d.ts +256 -85
  31. package/node_modules/@types/node/fs.d.ts +865 -525
  32. package/node_modules/@types/node/globals.d.ts +12 -34
  33. package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
  34. package/node_modules/@types/node/http.d.ts +433 -312
  35. package/node_modules/@types/node/http2.d.ts +545 -891
  36. package/node_modules/@types/node/https.d.ts +64 -243
  37. package/node_modules/@types/node/index.d.ts +25 -7
  38. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  39. package/node_modules/@types/node/inspector.d.ts +70 -58
  40. package/node_modules/@types/node/inspector.generated.d.ts +764 -410
  41. package/node_modules/@types/node/module.d.ts +54 -219
  42. package/node_modules/@types/node/net.d.ts +208 -222
  43. package/node_modules/@types/node/os.d.ts +41 -49
  44. package/node_modules/@types/node/package.json +13 -3
  45. package/node_modules/@types/node/path/posix.d.ts +8 -0
  46. package/node_modules/@types/node/path/win32.d.ts +8 -0
  47. package/node_modules/@types/node/path.d.ts +119 -141
  48. package/node_modules/@types/node/perf_hooks.d.ts +339 -690
  49. package/node_modules/@types/node/process.d.ts +389 -205
  50. package/node_modules/@types/node/punycode.d.ts +3 -31
  51. package/node_modules/@types/node/querystring.d.ts +3 -16
  52. package/node_modules/@types/node/quic.d.ts +2153 -0
  53. package/node_modules/@types/node/readline/promises.d.ts +3 -6
  54. package/node_modules/@types/node/readline.d.ts +66 -152
  55. package/node_modules/@types/node/repl.d.ts +101 -109
  56. package/node_modules/@types/node/sea.d.ts +1 -116
  57. package/node_modules/@types/node/sqlite.d.ts +486 -68
  58. package/node_modules/@types/node/stream/consumers.d.ts +91 -15
  59. package/node_modules/@types/node/stream/iter.d.ts +452 -0
  60. package/node_modules/@types/node/stream/promises.d.ts +136 -15
  61. package/node_modules/@types/node/stream/web.d.ts +197 -454
  62. package/node_modules/@types/node/stream.d.ts +603 -491
  63. package/node_modules/@types/node/string_decoder.d.ts +3 -43
  64. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  65. package/node_modules/@types/node/test.d.ts +513 -292
  66. package/node_modules/@types/node/timers/promises.d.ts +3 -18
  67. package/node_modules/@types/node/timers.d.ts +3 -141
  68. package/node_modules/@types/node/tls.d.ts +166 -257
  69. package/node_modules/@types/node/trace_events.d.ts +3 -97
  70. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -8
  71. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  72. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
  73. package/node_modules/@types/node/ts5.6/index.d.ts +26 -6
  74. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  75. package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  76. package/node_modules/@types/node/tty.d.ts +61 -43
  77. package/node_modules/@types/node/url.d.ts +156 -584
  78. package/node_modules/@types/node/util/types.d.ts +558 -0
  79. package/node_modules/@types/node/util.d.ts +170 -1099
  80. package/node_modules/@types/node/v8.d.ts +175 -36
  81. package/node_modules/@types/node/vfs.d.ts +211 -0
  82. package/node_modules/@types/node/vm.d.ts +292 -209
  83. package/node_modules/@types/node/wasi.d.ts +24 -74
  84. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  85. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  86. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  87. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  88. package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
  89. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  90. package/node_modules/@types/node/web-globals/events.d.ts +9 -0
  91. package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
  92. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  93. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  94. package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
  95. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  96. package/node_modules/@types/node/web-globals/streams.d.ts +97 -0
  97. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  98. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  99. package/node_modules/@types/node/worker_threads.d.ts +257 -407
  100. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  101. package/node_modules/@types/node/zlib.d.ts +24 -165
  102. package/node_modules/undici-types/agent.d.ts +12 -13
  103. package/node_modules/undici-types/api.d.ts +26 -26
  104. package/node_modules/undici-types/balanced-pool.d.ts +13 -12
  105. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  106. package/node_modules/undici-types/client-stats.d.ts +15 -0
  107. package/node_modules/undici-types/client.d.ts +63 -37
  108. package/node_modules/undici-types/connector.d.ts +5 -2
  109. package/node_modules/undici-types/cookies.d.ts +3 -1
  110. package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
  111. package/node_modules/undici-types/dispatcher.d.ts +136 -139
  112. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  113. package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
  114. package/node_modules/undici-types/errors.d.ts +92 -54
  115. package/node_modules/undici-types/eventsource.d.ts +9 -4
  116. package/node_modules/undici-types/fetch.d.ts +51 -25
  117. package/node_modules/undici-types/formdata.d.ts +7 -7
  118. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  119. package/node_modules/undici-types/global-origin.d.ts +5 -5
  120. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  121. package/node_modules/undici-types/handlers.d.ts +10 -9
  122. package/node_modules/undici-types/header.d.ts +162 -1
  123. package/node_modules/undici-types/index.d.ts +69 -47
  124. package/node_modules/undici-types/interceptors.d.ts +72 -9
  125. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  126. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  127. package/node_modules/undici-types/mock-client.d.ts +6 -4
  128. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  129. package/node_modules/undici-types/mock-interceptor.d.ts +26 -21
  130. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  131. package/node_modules/undici-types/package.json +1 -1
  132. package/node_modules/undici-types/patch.d.ts +0 -4
  133. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  134. package/node_modules/undici-types/pool.d.ts +14 -14
  135. package/node_modules/undici-types/proxy-agent.d.ts +14 -6
  136. package/node_modules/undici-types/readable.d.ts +19 -16
  137. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  138. package/node_modules/undici-types/retry-handler.d.ts +19 -10
  139. package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  140. package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  141. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  142. package/node_modules/undici-types/util.d.ts +3 -3
  143. package/node_modules/undici-types/utility.d.ts +7 -0
  144. package/node_modules/undici-types/webidl.d.ts +148 -30
  145. package/node_modules/undici-types/websocket.d.ts +48 -10
  146. package/node_modules/zod/README.md +2 -2
  147. package/node_modules/zod/package.json +1 -1
  148. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  149. package/node_modules/zod/src/v4/classic/schemas.ts +14 -30
  150. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +1 -0
  151. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +2 -11
  152. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -4
  153. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +22 -0
  154. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +1 -1
  155. package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
  156. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +53 -137
  157. package/node_modules/zod/src/v4/classic/tests/string.test.ts +70 -1
  158. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +87 -35
  159. package/node_modules/zod/src/v4/core/api.ts +21 -29
  160. package/node_modules/zod/src/v4/core/checks.ts +61 -1
  161. package/node_modules/zod/src/v4/core/compile.ts +35 -24
  162. package/node_modules/zod/src/v4/core/core.ts +1 -3
  163. package/node_modules/zod/src/v4/core/json-schema-processors.ts +9 -63
  164. package/node_modules/zod/src/v4/core/memoizer.ts +2 -5
  165. package/node_modules/zod/src/v4/core/regexes.ts +4 -0
  166. package/node_modules/zod/src/v4/core/schemas.ts +36 -109
  167. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
  168. package/node_modules/zod/src/v4/core/tests/compile.test.ts +177 -0
  169. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  170. package/node_modules/zod/src/v4/core/to-json-schema.ts +1 -1
  171. package/node_modules/zod/src/v4/core/util.ts +0 -4
  172. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  173. package/node_modules/zod/src/v4/core/visit.ts +0 -11
  174. package/node_modules/zod/src/v4/locales/ar.ts +1 -0
  175. package/node_modules/zod/src/v4/locales/az.ts +1 -0
  176. package/node_modules/zod/src/v4/locales/be.ts +1 -0
  177. package/node_modules/zod/src/v4/locales/bg.ts +1 -0
  178. package/node_modules/zod/src/v4/locales/bn.ts +1 -0
  179. package/node_modules/zod/src/v4/locales/ca.ts +1 -0
  180. package/node_modules/zod/src/v4/locales/ckb.ts +1 -0
  181. package/node_modules/zod/src/v4/locales/cs.ts +1 -0
  182. package/node_modules/zod/src/v4/locales/da.ts +1 -0
  183. package/node_modules/zod/src/v4/locales/de.ts +1 -0
  184. package/node_modules/zod/src/v4/locales/el.ts +1 -0
  185. package/node_modules/zod/src/v4/locales/en.ts +1 -0
  186. package/node_modules/zod/src/v4/locales/eo.ts +1 -0
  187. package/node_modules/zod/src/v4/locales/es.ts +1 -0
  188. package/node_modules/zod/src/v4/locales/fa.ts +1 -0
  189. package/node_modules/zod/src/v4/locales/fi.ts +1 -0
  190. package/node_modules/zod/src/v4/locales/fr-CA.ts +1 -0
  191. package/node_modules/zod/src/v4/locales/fr.ts +1 -0
  192. package/node_modules/zod/src/v4/locales/gu.ts +1 -0
  193. package/node_modules/zod/src/v4/locales/he.ts +1 -0
  194. package/node_modules/zod/src/v4/locales/hi.ts +1 -0
  195. package/node_modules/zod/src/v4/locales/hr.ts +1 -0
  196. package/node_modules/zod/src/v4/locales/hu.ts +1 -0
  197. package/node_modules/zod/src/v4/locales/hy.ts +1 -0
  198. package/node_modules/zod/src/v4/locales/id.ts +1 -0
  199. package/node_modules/zod/src/v4/locales/is.ts +1 -0
  200. package/node_modules/zod/src/v4/locales/it.ts +1 -0
  201. package/node_modules/zod/src/v4/locales/ja.ts +1 -0
  202. package/node_modules/zod/src/v4/locales/ka.ts +1 -0
  203. package/node_modules/zod/src/v4/locales/km.ts +1 -0
  204. package/node_modules/zod/src/v4/locales/kn.ts +1 -0
  205. package/node_modules/zod/src/v4/locales/ko.ts +1 -0
  206. package/node_modules/zod/src/v4/locales/lt.ts +1 -0
  207. package/node_modules/zod/src/v4/locales/mk.ts +1 -0
  208. package/node_modules/zod/src/v4/locales/ms.ts +1 -0
  209. package/node_modules/zod/src/v4/locales/ne.ts +1 -0
  210. package/node_modules/zod/src/v4/locales/nl.ts +1 -0
  211. package/node_modules/zod/src/v4/locales/nn.ts +1 -0
  212. package/node_modules/zod/src/v4/locales/no.ts +1 -0
  213. package/node_modules/zod/src/v4/locales/ota.ts +1 -0
  214. package/node_modules/zod/src/v4/locales/pl.ts +1 -0
  215. package/node_modules/zod/src/v4/locales/ps.ts +1 -0
  216. package/node_modules/zod/src/v4/locales/pt-BR.ts +1 -0
  217. package/node_modules/zod/src/v4/locales/pt.ts +1 -0
  218. package/node_modules/zod/src/v4/locales/ro.ts +1 -0
  219. package/node_modules/zod/src/v4/locales/ru.ts +1 -0
  220. package/node_modules/zod/src/v4/locales/sk.ts +1 -0
  221. package/node_modules/zod/src/v4/locales/sl.ts +1 -0
  222. package/node_modules/zod/src/v4/locales/sv.ts +1 -0
  223. package/node_modules/zod/src/v4/locales/ta.ts +1 -0
  224. package/node_modules/zod/src/v4/locales/tg.ts +1 -0
  225. package/node_modules/zod/src/v4/locales/th.ts +1 -0
  226. package/node_modules/zod/src/v4/locales/tk.ts +1 -0
  227. package/node_modules/zod/src/v4/locales/tr.ts +1 -0
  228. package/node_modules/zod/src/v4/locales/uk.ts +1 -0
  229. package/node_modules/zod/src/v4/locales/ur.ts +1 -0
  230. package/node_modules/zod/src/v4/locales/uz.ts +1 -0
  231. package/node_modules/zod/src/v4/locales/vi.ts +1 -0
  232. package/node_modules/zod/src/v4/locales/yo.ts +1 -0
  233. package/node_modules/zod/src/v4/locales/zh-CN.ts +1 -0
  234. package/node_modules/zod/src/v4/locales/zh-TW.ts +1 -0
  235. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  236. package/node_modules/zod/src/v4/mini/schemas.ts +12 -23
  237. package/node_modules/zod/src/v4/mini/tests/index.test.ts +56 -0
  238. package/node_modules/zod/src/v4/mini/tests/string.test.ts +7 -0
  239. package/node_modules/zod/v4/classic/checks.cjs +2 -1
  240. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  241. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  242. package/node_modules/zod/v4/classic/checks.js +1 -1
  243. package/node_modules/zod/v4/classic/schemas.cjs +11 -15
  244. package/node_modules/zod/v4/classic/schemas.d.cts +4 -6
  245. package/node_modules/zod/v4/classic/schemas.d.ts +4 -6
  246. package/node_modules/zod/v4/classic/schemas.js +9 -13
  247. package/node_modules/zod/v4/core/api.cjs +11 -23
  248. package/node_modules/zod/v4/core/api.d.cts +8 -4
  249. package/node_modules/zod/v4/core/api.d.ts +8 -4
  250. package/node_modules/zod/v4/core/api.js +11 -23
  251. package/node_modules/zod/v4/core/checks.cjs +32 -1
  252. package/node_modules/zod/v4/core/checks.d.cts +16 -0
  253. package/node_modules/zod/v4/core/checks.d.ts +16 -0
  254. package/node_modules/zod/v4/core/checks.js +31 -0
  255. package/node_modules/zod/v4/core/compile.cjs +12 -17
  256. package/node_modules/zod/v4/core/compile.js +13 -18
  257. package/node_modules/zod/v4/core/core.cjs +1 -1
  258. package/node_modules/zod/v4/core/core.js +1 -1
  259. package/node_modules/zod/v4/core/json-schema-processors.cjs +8 -44
  260. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -1
  261. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -1
  262. package/node_modules/zod/v4/core/json-schema-processors.js +8 -43
  263. package/node_modules/zod/v4/core/memoizer.cjs +2 -5
  264. package/node_modules/zod/v4/core/memoizer.js +2 -5
  265. package/node_modules/zod/v4/core/regexes.cjs +4 -2
  266. package/node_modules/zod/v4/core/regexes.d.cts +1 -0
  267. package/node_modules/zod/v4/core/regexes.d.ts +1 -0
  268. package/node_modules/zod/v4/core/regexes.js +2 -0
  269. package/node_modules/zod/v4/core/schemas.cjs +33 -73
  270. package/node_modules/zod/v4/core/schemas.d.cts +7 -22
  271. package/node_modules/zod/v4/core/schemas.d.ts +7 -22
  272. package/node_modules/zod/v4/core/schemas.js +30 -72
  273. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -1
  274. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -3
  275. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -3
  276. package/node_modules/zod/v4/core/to-json-schema.js +1 -1
  277. package/node_modules/zod/v4/core/util.cjs +0 -4
  278. package/node_modules/zod/v4/core/util.js +0 -4
  279. package/node_modules/zod/v4/core/versions.cjs +1 -1
  280. package/node_modules/zod/v4/core/versions.js +1 -1
  281. package/node_modules/zod/v4/core/visit.cjs +0 -12
  282. package/node_modules/zod/v4/core/visit.js +0 -12
  283. package/node_modules/zod/v4/locales/ar.cjs +1 -0
  284. package/node_modules/zod/v4/locales/ar.js +1 -0
  285. package/node_modules/zod/v4/locales/az.cjs +1 -0
  286. package/node_modules/zod/v4/locales/az.js +1 -0
  287. package/node_modules/zod/v4/locales/be.cjs +1 -0
  288. package/node_modules/zod/v4/locales/be.js +1 -0
  289. package/node_modules/zod/v4/locales/bg.cjs +1 -0
  290. package/node_modules/zod/v4/locales/bg.js +1 -0
  291. package/node_modules/zod/v4/locales/bn.cjs +1 -0
  292. package/node_modules/zod/v4/locales/bn.js +1 -0
  293. package/node_modules/zod/v4/locales/ca.cjs +1 -0
  294. package/node_modules/zod/v4/locales/ca.js +1 -0
  295. package/node_modules/zod/v4/locales/ckb.cjs +1 -0
  296. package/node_modules/zod/v4/locales/ckb.js +1 -0
  297. package/node_modules/zod/v4/locales/cs.cjs +1 -0
  298. package/node_modules/zod/v4/locales/cs.js +1 -0
  299. package/node_modules/zod/v4/locales/da.cjs +1 -0
  300. package/node_modules/zod/v4/locales/da.js +1 -0
  301. package/node_modules/zod/v4/locales/de.cjs +1 -0
  302. package/node_modules/zod/v4/locales/de.js +1 -0
  303. package/node_modules/zod/v4/locales/el.cjs +1 -0
  304. package/node_modules/zod/v4/locales/el.js +1 -0
  305. package/node_modules/zod/v4/locales/en.cjs +1 -0
  306. package/node_modules/zod/v4/locales/en.js +1 -0
  307. package/node_modules/zod/v4/locales/eo.cjs +1 -0
  308. package/node_modules/zod/v4/locales/eo.js +1 -0
  309. package/node_modules/zod/v4/locales/es.cjs +1 -0
  310. package/node_modules/zod/v4/locales/es.js +1 -0
  311. package/node_modules/zod/v4/locales/fa.cjs +1 -0
  312. package/node_modules/zod/v4/locales/fa.js +1 -0
  313. package/node_modules/zod/v4/locales/fi.cjs +1 -0
  314. package/node_modules/zod/v4/locales/fi.js +1 -0
  315. package/node_modules/zod/v4/locales/fr-CA.cjs +1 -0
  316. package/node_modules/zod/v4/locales/fr-CA.js +1 -0
  317. package/node_modules/zod/v4/locales/fr.cjs +1 -0
  318. package/node_modules/zod/v4/locales/fr.js +1 -0
  319. package/node_modules/zod/v4/locales/gu.cjs +1 -0
  320. package/node_modules/zod/v4/locales/gu.js +1 -0
  321. package/node_modules/zod/v4/locales/he.cjs +1 -0
  322. package/node_modules/zod/v4/locales/he.js +1 -0
  323. package/node_modules/zod/v4/locales/hi.cjs +1 -0
  324. package/node_modules/zod/v4/locales/hi.js +1 -0
  325. package/node_modules/zod/v4/locales/hr.cjs +1 -0
  326. package/node_modules/zod/v4/locales/hr.js +1 -0
  327. package/node_modules/zod/v4/locales/hu.cjs +1 -0
  328. package/node_modules/zod/v4/locales/hu.js +1 -0
  329. package/node_modules/zod/v4/locales/hy.cjs +1 -0
  330. package/node_modules/zod/v4/locales/hy.js +1 -0
  331. package/node_modules/zod/v4/locales/id.cjs +1 -0
  332. package/node_modules/zod/v4/locales/id.js +1 -0
  333. package/node_modules/zod/v4/locales/is.cjs +1 -0
  334. package/node_modules/zod/v4/locales/is.js +1 -0
  335. package/node_modules/zod/v4/locales/it.cjs +1 -0
  336. package/node_modules/zod/v4/locales/it.js +1 -0
  337. package/node_modules/zod/v4/locales/ja.cjs +1 -0
  338. package/node_modules/zod/v4/locales/ja.js +1 -0
  339. package/node_modules/zod/v4/locales/ka.cjs +1 -0
  340. package/node_modules/zod/v4/locales/ka.js +1 -0
  341. package/node_modules/zod/v4/locales/km.cjs +1 -0
  342. package/node_modules/zod/v4/locales/km.js +1 -0
  343. package/node_modules/zod/v4/locales/kn.cjs +1 -0
  344. package/node_modules/zod/v4/locales/kn.js +1 -0
  345. package/node_modules/zod/v4/locales/ko.cjs +1 -0
  346. package/node_modules/zod/v4/locales/ko.js +1 -0
  347. package/node_modules/zod/v4/locales/lt.cjs +1 -0
  348. package/node_modules/zod/v4/locales/lt.js +1 -0
  349. package/node_modules/zod/v4/locales/mk.cjs +1 -0
  350. package/node_modules/zod/v4/locales/mk.js +1 -0
  351. package/node_modules/zod/v4/locales/ms.cjs +1 -0
  352. package/node_modules/zod/v4/locales/ms.js +1 -0
  353. package/node_modules/zod/v4/locales/ne.cjs +1 -0
  354. package/node_modules/zod/v4/locales/ne.js +1 -0
  355. package/node_modules/zod/v4/locales/nl.cjs +1 -0
  356. package/node_modules/zod/v4/locales/nl.js +1 -0
  357. package/node_modules/zod/v4/locales/nn.cjs +1 -0
  358. package/node_modules/zod/v4/locales/nn.js +1 -0
  359. package/node_modules/zod/v4/locales/no.cjs +1 -0
  360. package/node_modules/zod/v4/locales/no.js +1 -0
  361. package/node_modules/zod/v4/locales/ota.cjs +1 -0
  362. package/node_modules/zod/v4/locales/ota.js +1 -0
  363. package/node_modules/zod/v4/locales/pl.cjs +1 -0
  364. package/node_modules/zod/v4/locales/pl.js +1 -0
  365. package/node_modules/zod/v4/locales/ps.cjs +1 -0
  366. package/node_modules/zod/v4/locales/ps.js +1 -0
  367. package/node_modules/zod/v4/locales/pt-BR.cjs +1 -0
  368. package/node_modules/zod/v4/locales/pt-BR.js +1 -0
  369. package/node_modules/zod/v4/locales/pt.cjs +1 -0
  370. package/node_modules/zod/v4/locales/pt.js +1 -0
  371. package/node_modules/zod/v4/locales/ro.cjs +1 -0
  372. package/node_modules/zod/v4/locales/ro.js +1 -0
  373. package/node_modules/zod/v4/locales/ru.cjs +1 -0
  374. package/node_modules/zod/v4/locales/ru.js +1 -0
  375. package/node_modules/zod/v4/locales/sk.cjs +1 -0
  376. package/node_modules/zod/v4/locales/sk.js +1 -0
  377. package/node_modules/zod/v4/locales/sl.cjs +1 -0
  378. package/node_modules/zod/v4/locales/sl.js +1 -0
  379. package/node_modules/zod/v4/locales/sv.cjs +1 -0
  380. package/node_modules/zod/v4/locales/sv.js +1 -0
  381. package/node_modules/zod/v4/locales/ta.cjs +1 -0
  382. package/node_modules/zod/v4/locales/ta.js +1 -0
  383. package/node_modules/zod/v4/locales/tg.cjs +1 -0
  384. package/node_modules/zod/v4/locales/tg.js +1 -0
  385. package/node_modules/zod/v4/locales/th.cjs +1 -0
  386. package/node_modules/zod/v4/locales/th.js +1 -0
  387. package/node_modules/zod/v4/locales/tk.cjs +1 -0
  388. package/node_modules/zod/v4/locales/tk.js +1 -0
  389. package/node_modules/zod/v4/locales/tr.cjs +1 -0
  390. package/node_modules/zod/v4/locales/tr.js +1 -0
  391. package/node_modules/zod/v4/locales/uk.cjs +1 -0
  392. package/node_modules/zod/v4/locales/uk.js +1 -0
  393. package/node_modules/zod/v4/locales/ur.cjs +1 -0
  394. package/node_modules/zod/v4/locales/ur.js +1 -0
  395. package/node_modules/zod/v4/locales/uz.cjs +1 -0
  396. package/node_modules/zod/v4/locales/uz.js +1 -0
  397. package/node_modules/zod/v4/locales/vi.cjs +1 -0
  398. package/node_modules/zod/v4/locales/vi.js +1 -0
  399. package/node_modules/zod/v4/locales/yo.cjs +1 -0
  400. package/node_modules/zod/v4/locales/yo.js +1 -0
  401. package/node_modules/zod/v4/locales/zh-CN.cjs +1 -0
  402. package/node_modules/zod/v4/locales/zh-CN.js +1 -0
  403. package/node_modules/zod/v4/locales/zh-TW.cjs +1 -0
  404. package/node_modules/zod/v4/locales/zh-TW.js +1 -0
  405. package/node_modules/zod/v4/mini/checks.cjs +2 -1
  406. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  407. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  408. package/node_modules/zod/v4/mini/checks.js +1 -1
  409. package/node_modules/zod/v4/mini/schemas.cjs +11 -13
  410. package/node_modules/zod/v4/mini/schemas.d.cts +1 -4
  411. package/node_modules/zod/v4/mini/schemas.d.ts +1 -4
  412. package/node_modules/zod/v4/mini/schemas.js +9 -11
  413. package/package.json +2 -2
  414. package/slingshot/index.js +183 -182
  415. package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  416. package/node_modules/@types/node/compatibility/index.d.ts +0 -9
  417. package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  418. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  419. package/node_modules/undici-types/file.d.ts +0 -39
  420. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,46 +1,29 @@
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-v22.x/api/http.html#class-httpincomingmessage)
6
- * and [`process.stdout`](https://nodejs.org/docs/latest-v22.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-v22.x/api/events.html#class-eventemitter).
9
- *
10
- * To access the `node:stream` module:
11
- *
12
- * ```js
13
- * import stream from '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/v22.x/lib/stream.js)
19
- */
20
- declare module "stream" {
1
+ declare module "node:stream" {
2
+ import { Blob } from "node:buffer";
21
3
  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 streamWeb from "node:stream/web";
25
-
26
- type ComposeFnParam = (source: any) => void;
27
-
4
+ import { ByteReadableStream, toAsyncStreamable } from "node:stream/iter";
5
+ import * as promises from "node:stream/promises";
6
+ import * as web from "node:stream/web";
28
7
  class Stream extends EventEmitter {
8
+ /**
9
+ * @since v0.9.4
10
+ */
29
11
  pipe<T extends NodeJS.WritableStream>(
30
12
  destination: T,
31
- options?: {
32
- end?: boolean | undefined;
33
- },
34
- ): T;
35
- compose<T extends NodeJS.ReadableStream>(
36
- stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,
37
- options?: { signal: AbortSignal },
13
+ options?: Stream.PipeOptions,
38
14
  ): T;
39
15
  }
40
16
  namespace Stream {
41
- export { Stream, streamPromises as promises };
17
+ export { promises, Stream };
42
18
  }
43
19
  namespace Stream {
20
+ interface PipeOptions {
21
+ /**
22
+ * End the writer when the reader ends.
23
+ * @default true
24
+ */
25
+ end?: boolean | undefined;
26
+ }
44
27
  interface StreamOptions<T extends Stream> extends Abortable {
45
28
  emitClose?: boolean | undefined;
46
29
  highWaterMark?: number | undefined;
@@ -53,19 +36,49 @@ declare module "stream" {
53
36
  encoding?: BufferEncoding | undefined;
54
37
  read?: ((this: T, size: number) => void) | undefined;
55
38
  }
56
- interface ArrayOptions {
39
+ interface ReadableIteratorOptions {
40
+ /**
41
+ * When set to `false`, calling `return` on the async iterator,
42
+ * or exiting a `for await...of` iteration using a `break`,
43
+ * `return`, or `throw` will not destroy the stream.
44
+ * @default true
45
+ */
46
+ destroyOnReturn?: boolean | undefined;
47
+ }
48
+ interface ReadableOperatorOptions extends Abortable {
57
49
  /**
58
- * The maximum concurrent invocations of `fn` to call on the stream at once.
50
+ * The maximum concurrent invocations of `fn` to call
51
+ * on the stream at once.
59
52
  * @default 1
60
53
  */
61
54
  concurrency?: number | undefined;
62
- /** Allows destroying the stream if the signal is aborted. */
63
- signal?: AbortSignal | undefined;
55
+ /**
56
+ * How many items to buffer while waiting for user consumption
57
+ * of the output.
58
+ * @default concurrency * 2 - 1
59
+ */
60
+ highWaterMark?: number | undefined;
61
+ }
62
+ /** @deprecated Use `ReadableOperatorOptions` instead. */
63
+ interface ArrayOptions extends ReadableOperatorOptions {}
64
+ interface ReadableToWebOptions {
65
+ strategy?: web.QueuingStrategy | undefined;
66
+ type?: web.ReadableStreamType | undefined;
67
+ }
68
+ interface ReadableEventMap {
69
+ "close": [];
70
+ "data": [chunk: any];
71
+ "end": [];
72
+ "error": [err: Error];
73
+ "pause": [];
74
+ "readable": [];
75
+ "resume": [];
64
76
  }
65
77
  /**
66
78
  * @since v0.9.4
67
79
  */
68
80
  class Readable extends Stream implements NodeJS.ReadableStream {
81
+ constructor(options?: ReadableOptions);
69
82
  /**
70
83
  * A utility method for creating Readable Streams out of iterators.
71
84
  * @since v12.3.0, v10.17.0
@@ -78,7 +91,7 @@ declare module "stream" {
78
91
  * @since v17.0.0
79
92
  */
80
93
  static fromWeb(
81
- readableStream: streamWeb.ReadableStream,
94
+ readableStream: web.ReadableStream,
82
95
  options?: Pick<ReadableOptions, "encoding" | "highWaterMark" | "objectMode" | "signal">,
83
96
  ): Readable;
84
97
  /**
@@ -86,16 +99,14 @@ declare module "stream" {
86
99
  * @since v17.0.0
87
100
  */
88
101
  static toWeb(
89
- streamReadable: Readable,
90
- options?: {
91
- strategy?: streamWeb.QueuingStrategy | undefined;
92
- },
93
- ): streamWeb.ReadableStream;
102
+ streamReadable: NodeJS.ReadableStream,
103
+ options?: ReadableToWebOptions,
104
+ ): web.ReadableStream;
94
105
  /**
95
106
  * Returns whether the stream has been read from or cancelled.
96
107
  * @since v16.8.0
97
108
  */
98
- static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
109
+ static isDisturbed(stream: NodeJS.ReadableStream | web.ReadableStream): boolean;
99
110
  /**
100
111
  * Returns whether the stream was destroyed or errored before emitting `'end'`.
101
112
  * @since v16.8.0
@@ -118,16 +129,16 @@ declare module "stream" {
118
129
  */
119
130
  readonly readableEncoding: BufferEncoding | null;
120
131
  /**
121
- * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v22.x/api/stream.html#event-end) event is emitted.
132
+ * Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v26.x/api/stream.html#event-end) event is emitted.
122
133
  * @since v12.9.0
123
134
  */
124
135
  readonly readableEnded: boolean;
125
136
  /**
126
137
  * This property reflects the current state of a `Readable` stream as described
127
- * in the [Three states](https://nodejs.org/docs/latest-v22.x/api/stream.html#three-states) section.
138
+ * in the [Three states](https://nodejs.org/docs/latest-v26.x/api/stream.html#three-states) section.
128
139
  * @since v9.4.0
129
140
  */
130
- readonly readableFlowing: boolean | null;
141
+ readableFlowing: boolean | null;
131
142
  /**
132
143
  * Returns the value of `highWaterMark` passed when creating this `Readable`.
133
144
  * @since v9.3.0
@@ -160,7 +171,6 @@ declare module "stream" {
160
171
  * @since v18.0.0
161
172
  */
162
173
  readonly errored: Error | null;
163
- constructor(opts?: ReadableOptions);
164
174
  _construct?(callback: (error?: Error | null) => void): void;
165
175
  _read(size: number): void;
166
176
  /**
@@ -444,16 +454,46 @@ declare module "stream" {
444
454
  */
445
455
  wrap(stream: NodeJS.ReadableStream): this;
446
456
  push(chunk: any, encoding?: BufferEncoding): boolean;
457
+ /**
458
+ * ```js
459
+ * import { Readable } from 'node:stream';
460
+ *
461
+ * async function* splitToWords(source) {
462
+ * for await (const chunk of source) {
463
+ * const words = String(chunk).split(' ');
464
+ *
465
+ * for (const word of words) {
466
+ * yield word;
467
+ * }
468
+ * }
469
+ * }
470
+ *
471
+ * const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords);
472
+ * const words = await wordsStream.toArray();
473
+ *
474
+ * console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream']
475
+ * ```
476
+ *
477
+ * `readable.compose(s)` is equivalent to `stream.compose(readable, s)`.
478
+ *
479
+ * This method also allows for an `AbortSignal` to be provided, which will destroy
480
+ * the composed stream when aborted.
481
+ *
482
+ * See [`stream.compose(...streams)`](https://nodejs.org/docs/latest-v26.x/api/stream.html#streamcomposestreams) for more information.
483
+ * @since v19.1.0, v18.13.0
484
+ * @returns a stream composed with the stream `stream`.
485
+ */
486
+ compose(
487
+ stream: NodeJS.WritableStream | web.WritableStream | web.TransformStream | ((source: any) => void),
488
+ options?: Abortable,
489
+ ): Duplex;
447
490
  /**
448
491
  * The iterator created by this method gives users the option to cancel the destruction
449
492
  * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
450
493
  * or if the iterator should destroy the stream if the stream emitted an error during iteration.
451
494
  * @since v16.3.0
452
- * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
453
- * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
454
- * **Default: `true`**.
455
495
  */
456
- iterator(options?: { destroyOnReturn?: boolean }): NodeJS.AsyncIterator<any>;
496
+ iterator(options?: ReadableIteratorOptions): NodeJS.AsyncIterator<any>;
457
497
  /**
458
498
  * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
459
499
  * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
@@ -461,7 +501,7 @@ declare module "stream" {
461
501
  * @param fn a function to map over every chunk in the stream. Async or not.
462
502
  * @returns a stream mapped with the function *fn*.
463
503
  */
464
- map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
504
+ map(fn: (data: any, options?: Abortable) => any, options?: ReadableOperatorOptions): Readable;
465
505
  /**
466
506
  * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
467
507
  * and if it returns a truthy value, the chunk will be passed to the result stream.
@@ -471,8 +511,8 @@ declare module "stream" {
471
511
  * @returns a stream filtered with the predicate *fn*.
472
512
  */
473
513
  filter(
474
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
475
- options?: ArrayOptions,
514
+ fn: (data: any, options?: Abortable) => boolean | Promise<boolean>,
515
+ options?: ReadableOperatorOptions,
476
516
  ): Readable;
477
517
  /**
478
518
  * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called.
@@ -490,8 +530,8 @@ declare module "stream" {
490
530
  * @returns a promise for when the stream has finished.
491
531
  */
492
532
  forEach(
493
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,
494
- options?: ArrayOptions,
533
+ fn: (data: any, options?: Abortable) => void | Promise<void>,
534
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
495
535
  ): Promise<void>;
496
536
  /**
497
537
  * This method allows easily obtaining the contents of a stream.
@@ -501,7 +541,7 @@ declare module "stream" {
501
541
  * @since v17.5.0
502
542
  * @returns a promise containing an array with the contents of the stream.
503
543
  */
504
- toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
544
+ toArray(options?: Abortable): Promise<any[]>;
505
545
  /**
506
546
  * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream
507
547
  * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk
@@ -512,8 +552,8 @@ declare module "stream" {
512
552
  * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.
513
553
  */
514
554
  some(
515
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
516
- options?: ArrayOptions,
555
+ fn: (data: any, options?: Abortable) => boolean | Promise<boolean>,
556
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
517
557
  ): Promise<boolean>;
518
558
  /**
519
559
  * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream
@@ -526,12 +566,12 @@ declare module "stream" {
526
566
  * or `undefined` if no element was found.
527
567
  */
528
568
  find<T>(
529
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => data is T,
530
- options?: ArrayOptions,
569
+ fn: (data: any, options?: Abortable) => data is T,
570
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
531
571
  ): Promise<T | undefined>;
532
572
  find(
533
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
534
- options?: ArrayOptions,
573
+ fn: (data: any, options?: Abortable) => boolean | Promise<boolean>,
574
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
535
575
  ): Promise<any>;
536
576
  /**
537
577
  * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream
@@ -543,8 +583,8 @@ declare module "stream" {
543
583
  * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks.
544
584
  */
545
585
  every(
546
- fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
547
- options?: ArrayOptions,
586
+ fn: (data: any, options?: Abortable) => boolean | Promise<boolean>,
587
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
548
588
  ): Promise<boolean>;
549
589
  /**
550
590
  * This method returns a new stream by applying the given callback to each chunk of the stream
@@ -556,28 +596,24 @@ declare module "stream" {
556
596
  * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator.
557
597
  * @returns a stream flat-mapped with the function *fn*.
558
598
  */
559
- flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
599
+ flatMap(
600
+ fn: (data: any, options?: Abortable) => any,
601
+ options?: Pick<ReadableOperatorOptions, "concurrency" | "signal">,
602
+ ): Readable;
560
603
  /**
561
604
  * This method returns a new stream with the first *limit* chunks dropped from the start.
562
605
  * @since v17.5.0
563
606
  * @param limit the number of chunks to drop from the readable.
564
607
  * @returns a stream with *limit* chunks dropped from the start.
565
608
  */
566
- drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
609
+ drop(limit: number, options?: Abortable): Readable;
567
610
  /**
568
611
  * This method returns a new stream with the first *limit* chunks.
569
612
  * @since v17.5.0
570
613
  * @param limit the number of chunks to take from the readable.
571
614
  * @returns a stream with *limit* chunks taken.
572
615
  */
573
- take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
574
- /**
575
- * This method returns a new stream with chunks of the underlying stream paired with a counter
576
- * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced.
577
- * @since v17.5.0
578
- * @returns a stream of indexed pairs.
579
- */
580
- asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
616
+ take(limit: number, options?: Abortable): Readable;
581
617
  /**
582
618
  * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation
583
619
  * on the previous element. It returns a promise for the final value of the reduction.
@@ -592,15 +628,11 @@ declare module "stream" {
592
628
  * @param initial the initial value to use in the reduction.
593
629
  * @returns a promise for the final value of the reduction.
594
630
  */
595
- reduce<T = any>(
596
- fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,
597
- initial?: undefined,
598
- options?: Pick<ArrayOptions, "signal">,
599
- ): Promise<T>;
600
- reduce<T = any>(
601
- fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,
631
+ reduce<T>(fn: (previous: any, data: any, options?: Abortable) => T): Promise<T>;
632
+ reduce<T>(
633
+ fn: (previous: T, data: any, options?: Abortable) => T,
602
634
  initial: T,
603
- options?: Pick<ArrayOptions, "signal">,
635
+ options?: Abortable,
604
636
  ): Promise<T>;
605
637
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
606
638
  /**
@@ -616,78 +648,92 @@ declare module "stream" {
616
648
  */
617
649
  destroy(error?: Error): this;
618
650
  /**
619
- * Event emitter
620
- * The defined events on documents including:
621
- * 1. close
622
- * 2. data
623
- * 3. end
624
- * 4. error
625
- * 5. pause
626
- * 6. readable
627
- * 7. resume
628
- */
629
- addListener(event: "close", listener: () => void): this;
630
- addListener(event: "data", listener: (chunk: any) => void): this;
631
- addListener(event: "end", listener: () => void): this;
632
- addListener(event: "error", listener: (err: Error) => void): this;
633
- addListener(event: "pause", listener: () => void): this;
634
- addListener(event: "readable", listener: () => void): this;
635
- addListener(event: "resume", listener: () => void): this;
636
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
637
- emit(event: "close"): boolean;
638
- emit(event: "data", chunk: any): boolean;
639
- emit(event: "end"): boolean;
640
- emit(event: "error", err: Error): boolean;
641
- emit(event: "pause"): boolean;
642
- emit(event: "readable"): boolean;
643
- emit(event: "resume"): boolean;
644
- emit(event: string | symbol, ...args: any[]): boolean;
645
- on(event: "close", listener: () => void): this;
646
- on(event: "data", listener: (chunk: any) => void): this;
647
- on(event: "end", listener: () => void): this;
648
- on(event: "error", listener: (err: Error) => void): this;
649
- on(event: "pause", listener: () => void): this;
650
- on(event: "readable", listener: () => void): this;
651
- on(event: "resume", listener: () => void): this;
652
- on(event: string | symbol, listener: (...args: any[]) => void): this;
653
- once(event: "close", listener: () => void): this;
654
- once(event: "data", listener: (chunk: any) => void): this;
655
- once(event: "end", listener: () => void): this;
656
- once(event: "error", listener: (err: Error) => void): this;
657
- once(event: "pause", listener: () => void): this;
658
- once(event: "readable", listener: () => void): this;
659
- once(event: "resume", listener: () => void): this;
660
- once(event: string | symbol, listener: (...args: any[]) => void): this;
661
- prependListener(event: "close", listener: () => void): this;
662
- prependListener(event: "data", listener: (chunk: any) => void): this;
663
- prependListener(event: "end", listener: () => void): this;
664
- prependListener(event: "error", listener: (err: Error) => void): this;
665
- prependListener(event: "pause", listener: () => void): this;
666
- prependListener(event: "readable", listener: () => void): this;
667
- prependListener(event: "resume", listener: () => void): this;
668
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
669
- prependOnceListener(event: "close", listener: () => void): this;
670
- prependOnceListener(event: "data", listener: (chunk: any) => void): this;
671
- prependOnceListener(event: "end", listener: () => void): this;
672
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
673
- prependOnceListener(event: "pause", listener: () => void): this;
674
- prependOnceListener(event: "readable", listener: () => void): this;
675
- prependOnceListener(event: "resume", listener: () => void): this;
676
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
677
- removeListener(event: "close", listener: () => void): this;
678
- removeListener(event: "data", listener: (chunk: any) => void): this;
679
- removeListener(event: "end", listener: () => void): this;
680
- removeListener(event: "error", listener: (err: Error) => void): this;
681
- removeListener(event: "pause", listener: () => void): this;
682
- removeListener(event: "readable", listener: () => void): this;
683
- removeListener(event: "resume", listener: () => void): this;
684
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
651
+ * @returns `AsyncIterator` to fully consume the stream.
652
+ * @since v10.0.0
653
+ */
685
654
  [Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
686
655
  /**
687
- * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.
656
+ * When the `--experimental-stream-iter` flag is enabled, `Readable` streams
657
+ * implement the `Stream.toAsyncStreamable` protocol, enabling efficient
658
+ * consumption by the `stream/iter` API.
659
+ *
660
+ * This provides a batched async iterator that drains the stream's internal
661
+ * buffer into `Uint8Array[]` batches, amortizing the per-chunk Promise overhead
662
+ * of the standard `Symbol.asyncIterator` path. For byte-mode streams, chunks
663
+ * are yielded directly as `Buffer` instances (which are `Uint8Array` subclasses).
664
+ * For object-mode or encoded streams, each chunk is normalized to `Uint8Array`
665
+ * before batching.
666
+ *
667
+ * The returned iterator is tagged as a validated source, so `from()`
668
+ * passes it through without additional normalization.
669
+ *
670
+ * ```js
671
+ * import { Readable } from 'node:stream';
672
+ * import { text, from } from 'node:stream/iter';
673
+ *
674
+ * const readable = new Readable({
675
+ * read() { this.push('hello'); this.push(null); },
676
+ * });
677
+ *
678
+ * // Readable is automatically consumed via toAsyncStreamable
679
+ * console.log(await text(from(readable))); // 'hello'
680
+ * ```
681
+ *
682
+ * Without the `--experimental-stream-iter` flag, calling this method throws
683
+ * `ERR_STREAM_ITER_MISSING_FLAG`.
684
+ */
685
+ [toAsyncStreamable](): ByteReadableStream;
686
+ /**
687
+ * Calls `readable.destroy()` with an `AbortError` and returns
688
+ * a promise that fulfills when the stream is finished.
688
689
  * @since v20.4.0
689
690
  */
690
691
  [Symbol.asyncDispose](): Promise<void>;
692
+ // #region InternalEventEmitter
693
+ addListener<E extends keyof ReadableEventMap>(
694
+ eventName: E,
695
+ listener: (...args: ReadableEventMap[E]) => void,
696
+ ): this;
697
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
698
+ emit<E extends keyof ReadableEventMap>(eventName: E, ...args: ReadableEventMap[E]): boolean;
699
+ emit(eventName: string | symbol, ...args: any[]): boolean;
700
+ listenerCount<E extends keyof ReadableEventMap>(
701
+ eventName: E,
702
+ listener?: (...args: ReadableEventMap[E]) => void,
703
+ ): number;
704
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
705
+ listeners<E extends keyof ReadableEventMap>(eventName: E): ((...args: ReadableEventMap[E]) => void)[];
706
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
707
+ off<E extends keyof ReadableEventMap>(eventName: E, listener: (...args: ReadableEventMap[E]) => void): this;
708
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
709
+ on<E extends keyof ReadableEventMap>(eventName: E, listener: (...args: ReadableEventMap[E]) => void): this;
710
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
711
+ once<E extends keyof ReadableEventMap>(
712
+ eventName: E,
713
+ listener: (...args: ReadableEventMap[E]) => void,
714
+ ): this;
715
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
716
+ prependListener<E extends keyof ReadableEventMap>(
717
+ eventName: E,
718
+ listener: (...args: ReadableEventMap[E]) => void,
719
+ ): this;
720
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
721
+ prependOnceListener<E extends keyof ReadableEventMap>(
722
+ eventName: E,
723
+ listener: (...args: ReadableEventMap[E]) => void,
724
+ ): this;
725
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
726
+ rawListeners<E extends keyof ReadableEventMap>(eventName: E): ((...args: ReadableEventMap[E]) => void)[];
727
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
728
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
729
+ removeAllListeners<E extends keyof ReadableEventMap>(eventName?: E): this;
730
+ removeAllListeners(eventName?: string | symbol): this;
731
+ removeListener<E extends keyof ReadableEventMap>(
732
+ eventName: E,
733
+ listener: (...args: ReadableEventMap[E]) => void,
734
+ ): this;
735
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
736
+ // #endregion
691
737
  }
692
738
  interface WritableOptions<T extends Writable = Writable> extends StreamOptions<T> {
693
739
  decodeStrings?: boolean | undefined;
@@ -703,38 +749,47 @@ declare module "stream" {
703
749
  writev?:
704
750
  | ((
705
751
  this: T,
706
- chunks: Array<{
752
+ chunks: {
707
753
  chunk: any;
708
754
  encoding: BufferEncoding;
709
- }>,
755
+ }[],
710
756
  callback: (error?: Error | null) => void,
711
757
  ) => void)
712
758
  | undefined;
713
759
  final?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
714
760
  }
761
+ interface WritableEventMap {
762
+ "close": [];
763
+ "drain": [];
764
+ "error": [err: Error];
765
+ "finish": [];
766
+ "pipe": [src: Readable];
767
+ "unpipe": [src: Readable];
768
+ }
715
769
  /**
716
770
  * @since v0.9.4
717
771
  */
718
772
  class Writable extends Stream implements NodeJS.WritableStream {
773
+ constructor(options?: WritableOptions);
719
774
  /**
720
775
  * A utility method for creating a `Writable` from a web `WritableStream`.
721
776
  * @since v17.0.0
722
777
  */
723
778
  static fromWeb(
724
- writableStream: streamWeb.WritableStream,
779
+ writableStream: web.WritableStream,
725
780
  options?: Pick<WritableOptions, "decodeStrings" | "highWaterMark" | "objectMode" | "signal">,
726
781
  ): Writable;
727
782
  /**
728
783
  * A utility method for creating a web `WritableStream` from a `Writable`.
729
784
  * @since v17.0.0
730
785
  */
731
- static toWeb(streamWritable: Writable): streamWeb.WritableStream;
786
+ static toWeb(streamWritable: NodeJS.WritableStream): web.WritableStream;
732
787
  /**
733
788
  * Is `true` if it is safe to call `writable.write()`, which means
734
789
  * the stream has not been destroyed, errored, or ended.
735
790
  * @since v11.4.0
736
791
  */
737
- readonly writable: boolean;
792
+ writable: boolean;
738
793
  /**
739
794
  * Returns whether the stream was destroyed or errored before emitting `'finish'`.
740
795
  * @since v18.0.0, v16.17.0
@@ -794,13 +849,12 @@ declare module "stream" {
794
849
  * @since v15.2.0, v14.17.0
795
850
  */
796
851
  readonly writableNeedDrain: boolean;
797
- constructor(opts?: WritableOptions);
798
852
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
799
853
  _writev?(
800
- chunks: Array<{
854
+ chunks: {
801
855
  chunk: any;
802
856
  encoding: BufferEncoding;
803
- }>,
857
+ }[],
804
858
  callback: (error?: Error | null) => void,
805
859
  ): void;
806
860
  _construct?(callback: (error?: Error | null) => void): void;
@@ -985,64 +1039,56 @@ declare module "stream" {
985
1039
  */
986
1040
  destroy(error?: Error): this;
987
1041
  /**
988
- * Event emitter
989
- * The defined events on documents including:
990
- * 1. close
991
- * 2. drain
992
- * 3. error
993
- * 4. finish
994
- * 5. pipe
995
- * 6. unpipe
996
- */
997
- addListener(event: "close", listener: () => void): this;
998
- addListener(event: "drain", listener: () => void): this;
999
- addListener(event: "error", listener: (err: Error) => void): this;
1000
- addListener(event: "finish", listener: () => void): this;
1001
- addListener(event: "pipe", listener: (src: Readable) => void): this;
1002
- addListener(event: "unpipe", listener: (src: Readable) => void): this;
1003
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1004
- emit(event: "close"): boolean;
1005
- emit(event: "drain"): boolean;
1006
- emit(event: "error", err: Error): boolean;
1007
- emit(event: "finish"): boolean;
1008
- emit(event: "pipe", src: Readable): boolean;
1009
- emit(event: "unpipe", src: Readable): boolean;
1010
- emit(event: string | symbol, ...args: any[]): boolean;
1011
- on(event: "close", listener: () => void): this;
1012
- on(event: "drain", listener: () => void): this;
1013
- on(event: "error", listener: (err: Error) => void): this;
1014
- on(event: "finish", listener: () => void): this;
1015
- on(event: "pipe", listener: (src: Readable) => void): this;
1016
- on(event: "unpipe", listener: (src: Readable) => void): this;
1017
- on(event: string | symbol, listener: (...args: any[]) => void): this;
1018
- once(event: "close", listener: () => void): this;
1019
- once(event: "drain", listener: () => void): this;
1020
- once(event: "error", listener: (err: Error) => void): this;
1021
- once(event: "finish", listener: () => void): this;
1022
- once(event: "pipe", listener: (src: Readable) => void): this;
1023
- once(event: "unpipe", listener: (src: Readable) => void): this;
1024
- once(event: string | symbol, listener: (...args: any[]) => void): this;
1025
- prependListener(event: "close", listener: () => void): this;
1026
- prependListener(event: "drain", listener: () => void): this;
1027
- prependListener(event: "error", listener: (err: Error) => void): this;
1028
- prependListener(event: "finish", listener: () => void): this;
1029
- prependListener(event: "pipe", listener: (src: Readable) => void): this;
1030
- prependListener(event: "unpipe", listener: (src: Readable) => void): this;
1031
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1032
- prependOnceListener(event: "close", listener: () => void): this;
1033
- prependOnceListener(event: "drain", listener: () => void): this;
1034
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
1035
- prependOnceListener(event: "finish", listener: () => void): this;
1036
- prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
1037
- prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
1038
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1039
- removeListener(event: "close", listener: () => void): this;
1040
- removeListener(event: "drain", listener: () => void): this;
1041
- removeListener(event: "error", listener: (err: Error) => void): this;
1042
- removeListener(event: "finish", listener: () => void): this;
1043
- removeListener(event: "pipe", listener: (src: Readable) => void): this;
1044
- removeListener(event: "unpipe", listener: (src: Readable) => void): this;
1045
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1042
+ * Calls `writable.destroy()` with an `AbortError` and returns
1043
+ * a promise that fulfills when the stream is finished.
1044
+ * @since v22.4.0, v20.16.0
1045
+ */
1046
+ [Symbol.asyncDispose](): Promise<void>;
1047
+ // #region InternalEventEmitter
1048
+ addListener<E extends keyof WritableEventMap>(
1049
+ eventName: E,
1050
+ listener: (...args: WritableEventMap[E]) => void,
1051
+ ): this;
1052
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1053
+ emit<E extends keyof WritableEventMap>(eventName: E, ...args: WritableEventMap[E]): boolean;
1054
+ emit(eventName: string | symbol, ...args: any[]): boolean;
1055
+ listenerCount<E extends keyof WritableEventMap>(
1056
+ eventName: E,
1057
+ listener?: (...args: WritableEventMap[E]) => void,
1058
+ ): number;
1059
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
1060
+ listeners<E extends keyof WritableEventMap>(eventName: E): ((...args: WritableEventMap[E]) => void)[];
1061
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
1062
+ off<E extends keyof WritableEventMap>(eventName: E, listener: (...args: WritableEventMap[E]) => void): this;
1063
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
1064
+ on<E extends keyof WritableEventMap>(eventName: E, listener: (...args: WritableEventMap[E]) => void): this;
1065
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
1066
+ once<E extends keyof WritableEventMap>(
1067
+ eventName: E,
1068
+ listener: (...args: WritableEventMap[E]) => void,
1069
+ ): this;
1070
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
1071
+ prependListener<E extends keyof WritableEventMap>(
1072
+ eventName: E,
1073
+ listener: (...args: WritableEventMap[E]) => void,
1074
+ ): this;
1075
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1076
+ prependOnceListener<E extends keyof WritableEventMap>(
1077
+ eventName: E,
1078
+ listener: (...args: WritableEventMap[E]) => void,
1079
+ ): this;
1080
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1081
+ rawListeners<E extends keyof WritableEventMap>(eventName: E): ((...args: WritableEventMap[E]) => void)[];
1082
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
1083
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
1084
+ removeAllListeners<E extends keyof WritableEventMap>(eventName?: E): this;
1085
+ removeAllListeners(eventName?: string | symbol): this;
1086
+ removeListener<E extends keyof WritableEventMap>(
1087
+ eventName: E,
1088
+ listener: (...args: WritableEventMap[E]) => void,
1089
+ ): this;
1090
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1091
+ // #endregion
1046
1092
  }
1047
1093
  interface DuplexOptions<T extends Duplex = Duplex> extends ReadableOptions<T>, WritableOptions<T> {
1048
1094
  allowHalfOpen?: boolean | undefined;
@@ -1052,6 +1098,10 @@ declare module "stream" {
1052
1098
  writableHighWaterMark?: number | undefined;
1053
1099
  writableCorked?: number | undefined;
1054
1100
  }
1101
+ interface DuplexToWebOptions {
1102
+ readableType?: web.ReadableStreamType | undefined;
1103
+ }
1104
+ interface DuplexEventMap extends ReadableEventMap, WritableEventMap {}
1055
1105
  /**
1056
1106
  * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
1057
1107
  *
@@ -1063,17 +1113,7 @@ declare module "stream" {
1063
1113
  * @since v0.9.4
1064
1114
  */
1065
1115
  class Duplex extends Stream implements NodeJS.ReadWriteStream {
1066
- /**
1067
- * If `false` then the stream will automatically end the writable side when the
1068
- * readable side ends. Set initially by the `allowHalfOpen` constructor option,
1069
- * which defaults to `true`.
1070
- *
1071
- * This can be changed manually to change the half-open behavior of an existing
1072
- * `Duplex` stream instance, but must be changed before the `'end'` event is emitted.
1073
- * @since v0.9.4
1074
- */
1075
- allowHalfOpen: boolean;
1076
- constructor(opts?: DuplexOptions);
1116
+ constructor(options?: DuplexOptions);
1077
1117
  /**
1078
1118
  * A utility method for creating duplex streams.
1079
1119
  *
@@ -1097,137 +1137,87 @@ declare module "stream" {
1097
1137
  */
1098
1138
  static from(
1099
1139
  src:
1100
- | Stream
1101
- | NodeBlob
1102
- | ArrayBuffer
1140
+ | NodeJS.ReadableStream
1141
+ | NodeJS.WritableStream
1142
+ | Blob
1103
1143
  | string
1104
1144
  | Iterable<any>
1105
1145
  | AsyncIterable<any>
1106
- | AsyncGeneratorFunction
1146
+ | ((source: AsyncIterable<any>) => AsyncIterable<any>)
1147
+ | ((source: AsyncIterable<any>) => Promise<void>)
1107
1148
  | Promise<any>
1108
- | Object,
1149
+ | web.ReadableWritablePair
1150
+ | web.ReadableStream
1151
+ | web.WritableStream,
1109
1152
  ): Duplex;
1110
1153
  /**
1111
1154
  * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
1112
1155
  * @since v17.0.0
1113
1156
  */
1114
- static toWeb(streamDuplex: Duplex): {
1115
- readable: streamWeb.ReadableStream;
1116
- writable: streamWeb.WritableStream;
1117
- };
1157
+ static toWeb(streamDuplex: NodeJS.ReadWriteStream, options?: DuplexToWebOptions): web.ReadableWritablePair;
1118
1158
  /**
1119
1159
  * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
1120
1160
  * @since v17.0.0
1121
1161
  */
1122
1162
  static fromWeb(
1123
- duplexStream: {
1124
- readable: streamWeb.ReadableStream;
1125
- writable: streamWeb.WritableStream;
1126
- },
1163
+ duplexStream: web.ReadableWritablePair,
1127
1164
  options?: Pick<
1128
1165
  DuplexOptions,
1129
1166
  "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal"
1130
1167
  >,
1131
1168
  ): Duplex;
1132
1169
  /**
1133
- * Event emitter
1134
- * The defined events on documents including:
1135
- * 1. close
1136
- * 2. data
1137
- * 3. drain
1138
- * 4. end
1139
- * 5. error
1140
- * 6. finish
1141
- * 7. pause
1142
- * 8. pipe
1143
- * 9. readable
1144
- * 10. resume
1145
- * 11. unpipe
1146
- */
1147
- addListener(event: "close", listener: () => void): this;
1148
- addListener(event: "data", listener: (chunk: any) => void): this;
1149
- addListener(event: "drain", listener: () => void): this;
1150
- addListener(event: "end", listener: () => void): this;
1151
- addListener(event: "error", listener: (err: Error) => void): this;
1152
- addListener(event: "finish", listener: () => void): this;
1153
- addListener(event: "pause", listener: () => void): this;
1154
- addListener(event: "pipe", listener: (src: Readable) => void): this;
1155
- addListener(event: "readable", listener: () => void): this;
1156
- addListener(event: "resume", listener: () => void): this;
1157
- addListener(event: "unpipe", listener: (src: Readable) => void): this;
1158
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
1159
- emit(event: "close"): boolean;
1160
- emit(event: "data", chunk: any): boolean;
1161
- emit(event: "drain"): boolean;
1162
- emit(event: "end"): boolean;
1163
- emit(event: "error", err: Error): boolean;
1164
- emit(event: "finish"): boolean;
1165
- emit(event: "pause"): boolean;
1166
- emit(event: "pipe", src: Readable): boolean;
1167
- emit(event: "readable"): boolean;
1168
- emit(event: "resume"): boolean;
1169
- emit(event: "unpipe", src: Readable): boolean;
1170
- emit(event: string | symbol, ...args: any[]): boolean;
1171
- on(event: "close", listener: () => void): this;
1172
- on(event: "data", listener: (chunk: any) => void): this;
1173
- on(event: "drain", listener: () => void): this;
1174
- on(event: "end", listener: () => void): this;
1175
- on(event: "error", listener: (err: Error) => void): this;
1176
- on(event: "finish", listener: () => void): this;
1177
- on(event: "pause", listener: () => void): this;
1178
- on(event: "pipe", listener: (src: Readable) => void): this;
1179
- on(event: "readable", listener: () => void): this;
1180
- on(event: "resume", listener: () => void): this;
1181
- on(event: "unpipe", listener: (src: Readable) => void): this;
1182
- on(event: string | symbol, listener: (...args: any[]) => void): this;
1183
- once(event: "close", listener: () => void): this;
1184
- once(event: "data", listener: (chunk: any) => void): this;
1185
- once(event: "drain", listener: () => void): this;
1186
- once(event: "end", listener: () => void): this;
1187
- once(event: "error", listener: (err: Error) => void): this;
1188
- once(event: "finish", listener: () => void): this;
1189
- once(event: "pause", listener: () => void): this;
1190
- once(event: "pipe", listener: (src: Readable) => void): this;
1191
- once(event: "readable", listener: () => void): this;
1192
- once(event: "resume", listener: () => void): this;
1193
- once(event: "unpipe", listener: (src: Readable) => void): this;
1194
- once(event: string | symbol, listener: (...args: any[]) => void): this;
1195
- prependListener(event: "close", listener: () => void): this;
1196
- prependListener(event: "data", listener: (chunk: any) => void): this;
1197
- prependListener(event: "drain", listener: () => void): this;
1198
- prependListener(event: "end", listener: () => void): this;
1199
- prependListener(event: "error", listener: (err: Error) => void): this;
1200
- prependListener(event: "finish", listener: () => void): this;
1201
- prependListener(event: "pause", listener: () => void): this;
1202
- prependListener(event: "pipe", listener: (src: Readable) => void): this;
1203
- prependListener(event: "readable", listener: () => void): this;
1204
- prependListener(event: "resume", listener: () => void): this;
1205
- prependListener(event: "unpipe", listener: (src: Readable) => void): this;
1206
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
1207
- prependOnceListener(event: "close", listener: () => void): this;
1208
- prependOnceListener(event: "data", listener: (chunk: any) => void): this;
1209
- prependOnceListener(event: "drain", listener: () => void): this;
1210
- prependOnceListener(event: "end", listener: () => void): this;
1211
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
1212
- prependOnceListener(event: "finish", listener: () => void): this;
1213
- prependOnceListener(event: "pause", listener: () => void): this;
1214
- prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
1215
- prependOnceListener(event: "readable", listener: () => void): this;
1216
- prependOnceListener(event: "resume", listener: () => void): this;
1217
- prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
1218
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
1219
- removeListener(event: "close", listener: () => void): this;
1220
- removeListener(event: "data", listener: (chunk: any) => void): this;
1221
- removeListener(event: "drain", listener: () => void): this;
1222
- removeListener(event: "end", listener: () => void): this;
1223
- removeListener(event: "error", listener: (err: Error) => void): this;
1224
- removeListener(event: "finish", listener: () => void): this;
1225
- removeListener(event: "pause", listener: () => void): this;
1226
- removeListener(event: "pipe", listener: (src: Readable) => void): this;
1227
- removeListener(event: "readable", listener: () => void): this;
1228
- removeListener(event: "resume", listener: () => void): this;
1229
- removeListener(event: "unpipe", listener: (src: Readable) => void): this;
1230
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1170
+ * If `false` then the stream will automatically end the writable side when the
1171
+ * readable side ends. Set initially by the `allowHalfOpen` constructor option,
1172
+ * which defaults to `true`.
1173
+ *
1174
+ * This can be changed manually to change the half-open behavior of an existing
1175
+ * `Duplex` stream instance, but must be changed before the `'end'` event is emitted.
1176
+ * @since v0.9.4
1177
+ */
1178
+ allowHalfOpen: boolean;
1179
+ // #region InternalEventEmitter
1180
+ addListener<E extends keyof DuplexEventMap>(
1181
+ eventName: E,
1182
+ listener: (...args: DuplexEventMap[E]) => void,
1183
+ ): this;
1184
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1185
+ emit<E extends keyof DuplexEventMap>(eventName: E, ...args: DuplexEventMap[E]): boolean;
1186
+ emit(eventName: string | symbol, ...args: any[]): boolean;
1187
+ listenerCount<E extends keyof DuplexEventMap>(
1188
+ eventName: E,
1189
+ listener?: (...args: DuplexEventMap[E]) => void,
1190
+ ): number;
1191
+ listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
1192
+ listeners<E extends keyof DuplexEventMap>(eventName: E): ((...args: DuplexEventMap[E]) => void)[];
1193
+ listeners(eventName: string | symbol): ((...args: any[]) => void)[];
1194
+ off<E extends keyof DuplexEventMap>(eventName: E, listener: (...args: DuplexEventMap[E]) => void): this;
1195
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
1196
+ on<E extends keyof DuplexEventMap>(eventName: E, listener: (...args: DuplexEventMap[E]) => void): this;
1197
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
1198
+ once<E extends keyof DuplexEventMap>(eventName: E, listener: (...args: DuplexEventMap[E]) => void): this;
1199
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
1200
+ prependListener<E extends keyof DuplexEventMap>(
1201
+ eventName: E,
1202
+ listener: (...args: DuplexEventMap[E]) => void,
1203
+ ): this;
1204
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1205
+ prependOnceListener<E extends keyof DuplexEventMap>(
1206
+ eventName: E,
1207
+ listener: (...args: DuplexEventMap[E]) => void,
1208
+ ): this;
1209
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1210
+ rawListeners<E extends keyof DuplexEventMap>(eventName: E): ((...args: DuplexEventMap[E]) => void)[];
1211
+ rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
1212
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
1213
+ removeAllListeners<E extends keyof DuplexEventMap>(eventName?: E): this;
1214
+ removeAllListeners(eventName?: string | symbol): this;
1215
+ removeListener<E extends keyof DuplexEventMap>(
1216
+ eventName: E,
1217
+ listener: (...args: DuplexEventMap[E]) => void,
1218
+ ): this;
1219
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
1220
+ // #endregion
1231
1221
  }
1232
1222
  interface Duplex extends Readable, Writable {}
1233
1223
  /**
@@ -1268,7 +1258,7 @@ declare module "stream" {
1268
1258
  * @since v0.9.4
1269
1259
  */
1270
1260
  class Transform extends Duplex {
1271
- constructor(opts?: TransformOptions);
1261
+ constructor(options?: TransformOptions);
1272
1262
  _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1273
1263
  _flush(callback: TransformCallback): void;
1274
1264
  }
@@ -1356,7 +1346,9 @@ declare module "stream" {
1356
1346
  * @param signal A signal representing possible cancellation
1357
1347
  * @param stream A stream to attach a signal to.
1358
1348
  */
1359
- function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
1349
+ function addAbortSignal<
1350
+ T extends NodeJS.ReadableStream | NodeJS.WritableStream | web.ReadableStream | web.WritableStream,
1351
+ >(signal: AbortSignal, stream: T): T;
1360
1352
  /**
1361
1353
  * Returns the default highWaterMark used by streams.
1362
1354
  * Defaults to `65536` (64 KiB), or `16` for `objectMode`.
@@ -1400,7 +1392,7 @@ declare module "stream" {
1400
1392
  * Especially useful in error handling scenarios where a stream is destroyed
1401
1393
  * prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`.
1402
1394
  *
1403
- * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streamfinishedstream-options).
1395
+ * The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v26.x/api/stream.html#streamfinishedstream-options).
1404
1396
  *
1405
1397
  * `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
1406
1398
  * invoked. The reason for this is so that unexpected `'error'` events (due to
@@ -1420,46 +1412,57 @@ declare module "stream" {
1420
1412
  * @returns A cleanup function which removes all registered listeners.
1421
1413
  */
1422
1414
  function finished(
1423
- stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1415
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | web.ReadableStream | web.WritableStream,
1424
1416
  options: FinishedOptions,
1425
1417
  callback: (err?: NodeJS.ErrnoException | null) => void,
1426
1418
  ): () => void;
1427
1419
  function finished(
1428
- stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1420
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | web.ReadableStream | web.WritableStream,
1429
1421
  callback: (err?: NodeJS.ErrnoException | null) => void,
1430
1422
  ): () => void;
1431
1423
  namespace finished {
1432
- function __promisify__(
1433
- stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1434
- options?: FinishedOptions,
1435
- ): Promise<void>;
1424
+ import __promisify__ = promises.finished;
1425
+ export { __promisify__ };
1436
1426
  }
1437
- type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
1438
- type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
1439
- type PipelineTransform<S extends PipelineTransformSource<any>, U> =
1427
+ type PipelineSourceFunction<O> = (options?: Abortable) => Iterable<O> | AsyncIterable<O>;
1428
+ type PipelineSource<O> =
1429
+ | NodeJS.ReadableStream
1430
+ | web.ReadableStream<O>
1431
+ | web.TransformStream<any, O>
1432
+ | Iterable<O>
1433
+ | AsyncIterable<O>
1434
+ | PipelineSourceFunction<O>;
1435
+ type PipelineSourceArgument<T> = (T extends (...args: any[]) => infer R ? R : T) extends infer S
1436
+ ? S extends web.TransformStream<any, infer O> ? web.ReadableStream<O> : S
1437
+ : never;
1438
+ type PipelineTransformGenerator<S extends PipelineTransformSource<any>, O> = (
1439
+ source: PipelineSourceArgument<S>,
1440
+ options?: Abortable,
1441
+ ) => AsyncIterable<O>;
1442
+ type PipelineTransformStreams<I, O> =
1440
1443
  | NodeJS.ReadWriteStream
1441
- | ((
1442
- source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ? AsyncIterable<ST>
1443
- : S,
1444
- ) => AsyncIterable<U>);
1445
- type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
1446
- type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
1447
- type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<P>;
1448
- type PipelineDestination<S extends PipelineTransformSource<any>, P> = S extends
1449
- PipelineTransformSource<infer ST> ?
1444
+ | web.TransformStream<I, O>;
1445
+ type PipelineTransform<S extends PipelineTransformSource<any>, O> = S extends
1446
+ PipelineSource<infer I> | PipelineTransformStreams<any, infer I> | ((...args: any[]) => infer I)
1447
+ ? PipelineTransformStreams<I, O> | PipelineTransformGenerator<S, O>
1448
+ : never;
1449
+ type PipelineTransformSource<O> = PipelineSource<O> | PipelineTransform<any, O>;
1450
+ type PipelineDestinationFunction<S extends PipelineTransformSource<any>, R> = (
1451
+ source: PipelineSourceArgument<S>,
1452
+ options?: Abortable,
1453
+ ) => R;
1454
+ type PipelineDestination<S extends PipelineTransformSource<any>, R> = S extends
1455
+ PipelineSource<infer I> | PipelineTransform<any, infer I> ?
1450
1456
  | NodeJS.WritableStream
1451
- | PipelineDestinationIterableFunction<ST>
1452
- | PipelineDestinationPromiseFunction<ST, P>
1457
+ | web.WritableStream<I>
1458
+ | web.TransformStream<I, any>
1459
+ | PipelineDestinationFunction<S, R>
1453
1460
  : never;
1454
- type PipelineCallback<S extends PipelineDestination<any, any>> = S extends
1455
- PipelineDestinationPromiseFunction<any, infer P> ? (err: NodeJS.ErrnoException | null, value: P) => void
1456
- : (err: NodeJS.ErrnoException | null) => void;
1457
- type PipelinePromise<S extends PipelineDestination<any, any>> = S extends
1458
- PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
1459
- interface PipelineOptions {
1460
- signal?: AbortSignal | undefined;
1461
- end?: boolean | undefined;
1462
- }
1461
+ type PipelineCallback<S extends PipelineDestination<any, any>> = (
1462
+ err: NodeJS.ErrnoException | null,
1463
+ value: S extends (...args: any[]) => PromiseLike<infer R> ? R : undefined,
1464
+ ) => void;
1465
+ type PipelineResult<S extends PipelineDestination<any, any>> = S extends NodeJS.WritableStream ? S : Duplex;
1463
1466
  /**
1464
1467
  * A module method to pipe between streams and generators forwarding errors and
1465
1468
  * properly cleaning up and provide a callback when the pipeline is complete.
@@ -1488,7 +1491,7 @@ declare module "stream" {
1488
1491
  * );
1489
1492
  * ```
1490
1493
  *
1491
- * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v22.x/api/stream.html#streampipelinesource-transforms-destination-options).
1494
+ * The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v26.x/api/stream.html#streampipelinesource-transforms-destination-options).
1492
1495
  *
1493
1496
  * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
1494
1497
  *
@@ -1525,170 +1528,279 @@ declare module "stream" {
1525
1528
  * @since v10.0.0
1526
1529
  * @param callback Called when the pipeline is fully done.
1527
1530
  */
1528
- function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1529
- source: A,
1530
- destination: B,
1531
- callback: PipelineCallback<B>,
1532
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1531
+ function pipeline<S extends PipelineSource<any>, D extends PipelineDestination<S, any>>(
1532
+ source: S,
1533
+ destination: D,
1534
+ callback: PipelineCallback<D>,
1535
+ ): PipelineResult<D>;
1533
1536
  function pipeline<
1534
- A extends PipelineSource<any>,
1535
- T1 extends PipelineTransform<A, any>,
1536
- B extends PipelineDestination<T1, any>,
1537
+ S extends PipelineSource<any>,
1538
+ T extends PipelineTransform<S, any>,
1539
+ D extends PipelineDestination<T, any>,
1537
1540
  >(
1538
- source: A,
1539
- transform1: T1,
1540
- destination: B,
1541
- callback: PipelineCallback<B>,
1542
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1541
+ source: S,
1542
+ transform: T,
1543
+ destination: D,
1544
+ callback: PipelineCallback<D>,
1545
+ ): PipelineResult<D>;
1543
1546
  function pipeline<
1544
- A extends PipelineSource<any>,
1545
- T1 extends PipelineTransform<A, any>,
1547
+ S extends PipelineSource<any>,
1548
+ T1 extends PipelineTransform<S, any>,
1546
1549
  T2 extends PipelineTransform<T1, any>,
1547
- B extends PipelineDestination<T2, any>,
1550
+ D extends PipelineDestination<T2, any>,
1548
1551
  >(
1549
- source: A,
1552
+ source: S,
1550
1553
  transform1: T1,
1551
1554
  transform2: T2,
1552
- destination: B,
1553
- callback: PipelineCallback<B>,
1554
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1555
+ destination: D,
1556
+ callback: PipelineCallback<D>,
1557
+ ): PipelineResult<D>;
1555
1558
  function pipeline<
1556
- A extends PipelineSource<any>,
1557
- T1 extends PipelineTransform<A, any>,
1559
+ S extends PipelineSource<any>,
1560
+ T1 extends PipelineTransform<S, any>,
1558
1561
  T2 extends PipelineTransform<T1, any>,
1559
1562
  T3 extends PipelineTransform<T2, any>,
1560
- B extends PipelineDestination<T3, any>,
1563
+ D extends PipelineDestination<T3, any>,
1561
1564
  >(
1562
- source: A,
1565
+ source: S,
1563
1566
  transform1: T1,
1564
1567
  transform2: T2,
1565
1568
  transform3: T3,
1566
- destination: B,
1567
- callback: PipelineCallback<B>,
1568
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1569
+ destination: D,
1570
+ callback: PipelineCallback<D>,
1571
+ ): PipelineResult<D>;
1569
1572
  function pipeline<
1570
- A extends PipelineSource<any>,
1571
- T1 extends PipelineTransform<A, any>,
1573
+ S extends PipelineSource<any>,
1574
+ T1 extends PipelineTransform<S, any>,
1572
1575
  T2 extends PipelineTransform<T1, any>,
1573
1576
  T3 extends PipelineTransform<T2, any>,
1574
1577
  T4 extends PipelineTransform<T3, any>,
1575
- B extends PipelineDestination<T4, any>,
1578
+ D extends PipelineDestination<T4, any>,
1576
1579
  >(
1577
- source: A,
1580
+ source: S,
1578
1581
  transform1: T1,
1579
1582
  transform2: T2,
1580
1583
  transform3: T3,
1581
1584
  transform4: T4,
1582
- destination: B,
1583
- callback: PipelineCallback<B>,
1584
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1585
+ destination: D,
1586
+ callback: PipelineCallback<D>,
1587
+ ): PipelineResult<D>;
1585
1588
  function pipeline(
1586
- streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1589
+ streams: ReadonlyArray<PipelineSource<any> | PipelineTransform<any, any> | PipelineDestination<any, any>>,
1587
1590
  callback: (err: NodeJS.ErrnoException | null) => void,
1588
1591
  ): NodeJS.WritableStream;
1589
1592
  function pipeline(
1590
- stream1: NodeJS.ReadableStream,
1591
- stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1592
- ...streams: Array<
1593
- NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)
1594
- >
1593
+ ...streams: [
1594
+ ...[PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>],
1595
+ callback: ((err: NodeJS.ErrnoException | null) => void),
1596
+ ]
1595
1597
  ): NodeJS.WritableStream;
1596
1598
  namespace pipeline {
1597
- function __promisify__<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1598
- source: A,
1599
- destination: B,
1600
- options?: PipelineOptions,
1601
- ): PipelinePromise<B>;
1602
- function __promisify__<
1603
- A extends PipelineSource<any>,
1604
- T1 extends PipelineTransform<A, any>,
1605
- B extends PipelineDestination<T1, any>,
1606
- >(
1607
- source: A,
1608
- transform1: T1,
1609
- destination: B,
1610
- options?: PipelineOptions,
1611
- ): PipelinePromise<B>;
1612
- function __promisify__<
1613
- A extends PipelineSource<any>,
1614
- T1 extends PipelineTransform<A, any>,
1615
- T2 extends PipelineTransform<T1, any>,
1616
- B extends PipelineDestination<T2, any>,
1617
- >(
1618
- source: A,
1619
- transform1: T1,
1620
- transform2: T2,
1621
- destination: B,
1622
- options?: PipelineOptions,
1623
- ): PipelinePromise<B>;
1624
- function __promisify__<
1625
- A extends PipelineSource<any>,
1626
- T1 extends PipelineTransform<A, any>,
1627
- T2 extends PipelineTransform<T1, any>,
1628
- T3 extends PipelineTransform<T2, any>,
1629
- B extends PipelineDestination<T3, any>,
1630
- >(
1631
- source: A,
1632
- transform1: T1,
1633
- transform2: T2,
1634
- transform3: T3,
1635
- destination: B,
1636
- options?: PipelineOptions,
1637
- ): PipelinePromise<B>;
1638
- function __promisify__<
1639
- A extends PipelineSource<any>,
1640
- T1 extends PipelineTransform<A, any>,
1641
- T2 extends PipelineTransform<T1, any>,
1642
- T3 extends PipelineTransform<T2, any>,
1643
- T4 extends PipelineTransform<T3, any>,
1644
- B extends PipelineDestination<T4, any>,
1645
- >(
1646
- source: A,
1647
- transform1: T1,
1648
- transform2: T2,
1649
- transform3: T3,
1650
- transform4: T4,
1651
- destination: B,
1652
- options?: PipelineOptions,
1653
- ): PipelinePromise<B>;
1654
- function __promisify__(
1655
- streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1656
- options?: PipelineOptions,
1657
- ): Promise<void>;
1658
- function __promisify__(
1659
- stream1: NodeJS.ReadableStream,
1660
- stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1661
- ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
1662
- ): Promise<void>;
1663
- }
1664
- // TODO: this interface never existed; remove in next major
1665
- interface Pipe {
1666
- close(): void;
1667
- hasRef(): boolean;
1668
- ref(): void;
1669
- unref(): void;
1599
+ import __promisify__ = promises.pipeline;
1600
+ export { __promisify__ };
1670
1601
  }
1602
+ type ComposeSource<O> =
1603
+ | NodeJS.ReadableStream
1604
+ | web.ReadableStream<O>
1605
+ | Iterable<O>
1606
+ | AsyncIterable<O>
1607
+ | (() => AsyncIterable<O>);
1608
+ type ComposeTransformStreams<I, O> = NodeJS.ReadWriteStream | web.TransformStream<I, O>;
1609
+ type ComposeTransformGenerator<I, O> = (source: AsyncIterable<I>) => AsyncIterable<O>;
1610
+ type ComposeTransform<S extends ComposeTransformSource<any>, O> = S extends
1611
+ ComposeSource<infer I> | ComposeTransformStreams<any, infer I> | ComposeTransformGenerator<any, infer I>
1612
+ ? ComposeTransformStreams<I, O> | ComposeTransformGenerator<I, O>
1613
+ : never;
1614
+ type ComposeTransformSource<O> = ComposeSource<O> | ComposeTransform<any, O>;
1615
+ type ComposeDestination<S extends ComposeTransformSource<any>> = S extends ComposeTransformSource<infer I> ?
1616
+ | NodeJS.WritableStream
1617
+ | web.WritableStream<I>
1618
+ | web.TransformStream<I, any>
1619
+ | ((source: AsyncIterable<I>) => void)
1620
+ : never;
1621
+ /**
1622
+ * Combines two or more streams into a `Duplex` stream that writes to the
1623
+ * first stream and reads from the last. Each provided stream is piped into
1624
+ * the next, using `stream.pipeline`. If any of the streams error then all
1625
+ * are destroyed, including the outer `Duplex` stream.
1626
+ *
1627
+ * Because `stream.compose` returns a new stream that in turn can (and
1628
+ * should) be piped into other streams, it enables composition. In contrast,
1629
+ * when passing streams to `stream.pipeline`, typically the first stream is
1630
+ * a readable stream and the last a writable stream, forming a closed
1631
+ * circuit.
1632
+ *
1633
+ * If passed a `Function` it must be a factory method taking a `source`
1634
+ * `Iterable`.
1635
+ *
1636
+ * ```js
1637
+ * import { compose, Transform } from 'node:stream';
1638
+ *
1639
+ * const removeSpaces = new Transform({
1640
+ * transform(chunk, encoding, callback) {
1641
+ * callback(null, String(chunk).replace(' ', ''));
1642
+ * },
1643
+ * });
1644
+ *
1645
+ * async function* toUpper(source) {
1646
+ * for await (const chunk of source) {
1647
+ * yield String(chunk).toUpperCase();
1648
+ * }
1649
+ * }
1650
+ *
1651
+ * let res = '';
1652
+ * for await (const buf of compose(removeSpaces, toUpper).end('hello world')) {
1653
+ * res += buf;
1654
+ * }
1655
+ *
1656
+ * console.log(res); // prints 'HELLOWORLD'
1657
+ * ```
1658
+ *
1659
+ * `stream.compose` can be used to convert async iterables, generators and
1660
+ * functions into streams.
1661
+ *
1662
+ * * `AsyncIterable` converts into a readable `Duplex`. Cannot yield
1663
+ * `null`.
1664
+ * * `AsyncGeneratorFunction` converts into a readable/writable transform `Duplex`.
1665
+ * Must take a source `AsyncIterable` as first parameter. Cannot yield
1666
+ * `null`.
1667
+ * * `AsyncFunction` converts into a writable `Duplex`. Must return
1668
+ * either `null` or `undefined`.
1669
+ *
1670
+ * ```js
1671
+ * import { compose } from 'node:stream';
1672
+ * import { finished } from 'node:stream/promises';
1673
+ *
1674
+ * // Convert AsyncIterable into readable Duplex.
1675
+ * const s1 = compose(async function*() {
1676
+ * yield 'Hello';
1677
+ * yield 'World';
1678
+ * }());
1679
+ *
1680
+ * // Convert AsyncGenerator into transform Duplex.
1681
+ * const s2 = compose(async function*(source) {
1682
+ * for await (const chunk of source) {
1683
+ * yield String(chunk).toUpperCase();
1684
+ * }
1685
+ * });
1686
+ *
1687
+ * let res = '';
1688
+ *
1689
+ * // Convert AsyncFunction into writable Duplex.
1690
+ * const s3 = compose(async function(source) {
1691
+ * for await (const chunk of source) {
1692
+ * res += chunk;
1693
+ * }
1694
+ * });
1695
+ *
1696
+ * await finished(compose(s1, s2, s3));
1697
+ *
1698
+ * console.log(res); // prints 'HELLOWORLD'
1699
+ * ```
1700
+ *
1701
+ * For convenience, the `readable.compose(stream)` method is available on
1702
+ * `Readable` and `Duplex` streams as a wrapper for this function.
1703
+ * @since v16.9.0
1704
+ * @experimental
1705
+ */
1706
+ /* eslint-disable @definitelytyped/no-unnecessary-generics */
1707
+ function compose(stream: ComposeSource<any> | ComposeDestination<any>): Duplex;
1708
+ function compose<
1709
+ S extends ComposeSource<any> | ComposeTransform<any, any>,
1710
+ D extends ComposeTransform<S, any> | ComposeDestination<S>,
1711
+ >(
1712
+ source: S,
1713
+ destination: D,
1714
+ ): Duplex;
1715
+ function compose<
1716
+ S extends ComposeSource<any> | ComposeTransform<any, any>,
1717
+ T extends ComposeTransform<S, any>,
1718
+ D extends ComposeTransform<T, any> | ComposeDestination<T>,
1719
+ >(source: S, transform: T, destination: D): Duplex;
1720
+ function compose<
1721
+ S extends ComposeSource<any> | ComposeTransform<any, any>,
1722
+ T1 extends ComposeTransform<S, any>,
1723
+ T2 extends ComposeTransform<T1, any>,
1724
+ D extends ComposeTransform<T2, any> | ComposeDestination<T2>,
1725
+ >(source: S, transform1: T1, transform2: T2, destination: D): Duplex;
1726
+ function compose<
1727
+ S extends ComposeSource<any> | ComposeTransform<any, any>,
1728
+ T1 extends ComposeTransform<S, any>,
1729
+ T2 extends ComposeTransform<T1, any>,
1730
+ T3 extends ComposeTransform<T2, any>,
1731
+ D extends ComposeTransform<T3, any> | ComposeDestination<T3>,
1732
+ >(source: S, transform1: T1, transform2: T2, transform3: T3, destination: D): Duplex;
1733
+ function compose<
1734
+ S extends ComposeSource<any> | ComposeTransform<any, any>,
1735
+ T1 extends ComposeTransform<S, any>,
1736
+ T2 extends ComposeTransform<T1, any>,
1737
+ T3 extends ComposeTransform<T2, any>,
1738
+ T4 extends ComposeTransform<T3, any>,
1739
+ D extends ComposeTransform<T4, any> | ComposeDestination<T4>,
1740
+ >(source: S, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: D): Duplex;
1741
+ function compose(
1742
+ ...streams: [
1743
+ ComposeSource<any>,
1744
+ ...ComposeTransform<any, any>[],
1745
+ ComposeDestination<any>,
1746
+ ]
1747
+ ): Duplex;
1748
+ /* eslint-enable @definitelytyped/no-unnecessary-generics */
1671
1749
  /**
1672
1750
  * Returns whether the stream has encountered an error.
1673
1751
  * @since v17.3.0, v16.14.0
1674
1752
  */
1675
- function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
1753
+ function isErrored(
1754
+ stream: NodeJS.ReadableStream | NodeJS.WritableStream | web.ReadableStream | web.WritableStream,
1755
+ ): boolean;
1676
1756
  /**
1677
1757
  * Returns whether the stream is readable.
1678
1758
  * @since v17.4.0, v16.14.0
1679
1759
  * @returns Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`.
1680
1760
  */
1681
- function isReadable(stream: Readable | NodeJS.ReadableStream): boolean | null;
1761
+ function isReadable(stream: NodeJS.ReadableStream | web.ReadableStream): boolean | null;
1682
1762
  /**
1683
1763
  * Returns whether the stream is writable.
1684
1764
  * @since v20.0.0
1685
1765
  * @returns Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`.
1686
1766
  */
1687
- function isWritable(stream: Writable | NodeJS.WritableStream): boolean | null;
1767
+ function isWritable(stream: NodeJS.WritableStream | web.WritableStream): boolean | null;
1768
+ }
1769
+ global {
1770
+ namespace NodeJS {
1771
+ // These interfaces are vestigial, and correspond roughly to the "streams2" interfaces
1772
+ // from early versions of Node.js, but they are still used widely across the ecosystem.
1773
+ // Accordingly, they are commonly used as "in-types" for @types/node APIs, so that
1774
+ // eg. streams returned from older libraries will still be considered valid input to
1775
+ // functions which accept stream arguments.
1776
+ // It's not possible to change or remove these without astronomical levels of breakage.
1777
+ interface ReadableStream extends EventEmitter {
1778
+ readable: boolean;
1779
+ read(size?: number): string | Buffer;
1780
+ setEncoding(encoding: BufferEncoding): this;
1781
+ pause(): this;
1782
+ resume(): this;
1783
+ isPaused(): boolean;
1784
+ pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
1785
+ unpipe(destination?: WritableStream): this;
1786
+ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
1787
+ wrap(oldStream: ReadableStream): this;
1788
+ [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
1789
+ }
1790
+ interface WritableStream extends EventEmitter {
1791
+ writable: boolean;
1792
+ write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
1793
+ write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
1794
+ end(cb?: () => void): this;
1795
+ end(data: string | Uint8Array, cb?: () => void): this;
1796
+ end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
1797
+ }
1798
+ interface ReadWriteStream extends ReadableStream, WritableStream {}
1799
+ }
1688
1800
  }
1689
1801
  export = Stream;
1690
1802
  }
1691
- declare module "node:stream" {
1692
- import stream = require("stream");
1803
+ declare module "stream" {
1804
+ import stream = require("node:stream");
1693
1805
  export = stream;
1694
1806
  }