cdk-ecr-deployment 2.5.29 → 2.5.31

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