cloudstructs 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/.jsii +97 -4
  2. package/lib/codecommit-mirror/index.js +2 -2
  3. package/lib/dmarc/index.js +2 -2
  4. package/lib/ecs-service-roller/index.js +2 -2
  5. package/lib/email-receiver/receiver.js +2 -2
  6. package/lib/email-receiver/whitelist.lambda.js +1 -1
  7. package/lib/saml-identity-provider/index.js +2 -2
  8. package/lib/slack-app/manifest.js +2 -2
  9. package/lib/slack-app/provider.lambda.js +1 -1
  10. package/lib/slack-app/slack-app.js +2 -2
  11. package/lib/slack-events/events.lambda.js +1 -1
  12. package/lib/slack-events/index.js +2 -2
  13. package/lib/slack-events/signature.js +1 -1
  14. package/lib/slack-textract/detect.lambda.js +1 -1
  15. package/lib/slack-textract/index.js +1 -1
  16. package/lib/ssl-server-test/index.js +1 -1
  17. package/lib/state-machine-cr-provider/index.js +3 -3
  18. package/lib/state-machine-cr-provider/runtime/http.js +1 -1
  19. package/lib/state-machine-cr-provider/runtime/index.js +1 -1
  20. package/lib/static-website/index.js +2 -2
  21. package/lib/toolkit-cleaner/clean-images.lambda.js +1 -1
  22. package/lib/toolkit-cleaner/clean-objects.lambda.js +1 -1
  23. package/lib/toolkit-cleaner/extract-template-hashes.lambda.js +1 -1
  24. package/lib/toolkit-cleaner/get-stack-names.lambda.js +1 -1
  25. package/lib/toolkit-cleaner/index.js +4 -4
  26. package/lib/url-shortener/index.js +2 -2
  27. package/lib/url-shortener/redirect.edge-lambda.js +1 -1
  28. package/lib/url-shortener/shortener.lambda.js +1 -1
  29. package/node_modules/@slack/logger/node_modules/@types/node/README.md +2 -2
  30. package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +2 -0
  31. package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +35 -18
  32. package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +4 -2
  33. package/node_modules/@slack/logger/node_modules/@types/node/package.json +3 -15
  34. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +2 -2
  35. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +2 -0
  36. package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +35 -18
  37. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +4 -2
  38. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +3 -15
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +2 -2
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +2 -0
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +35 -18
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +4 -2
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +3 -15
  44. package/node_modules/@types/is-stream/node_modules/@types/node/README.md +2 -2
  45. package/node_modules/@types/is-stream/node_modules/@types/node/child_process.d.ts +2 -0
  46. package/node_modules/@types/is-stream/node_modules/@types/node/events.d.ts +35 -18
  47. package/node_modules/@types/is-stream/node_modules/@types/node/http.d.ts +4 -2
  48. package/node_modules/@types/is-stream/node_modules/@types/node/package.json +3 -15
  49. package/node_modules/@types/keyv/node_modules/@types/node/README.md +2 -2
  50. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +2 -0
  51. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +35 -18
  52. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +4 -2
  53. package/node_modules/@types/keyv/node_modules/@types/node/package.json +3 -15
  54. package/node_modules/@types/responselike/node_modules/@types/node/README.md +2 -2
  55. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +2 -0
  56. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +35 -18
  57. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +4 -2
  58. package/node_modules/@types/responselike/node_modules/@types/node/package.json +3 -15
  59. package/package.json +19 -19
  60. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  61. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  62. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  63. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  64. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  65. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  66. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  67. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  68. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  69. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  70. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  71. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  72. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  73. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  74. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  75. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  76. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  77. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  78. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  79. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  80. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  81. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  82. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  83. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  84. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  85. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  86. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  87. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  88. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  89. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  90. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  91. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  92. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  93. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  94. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  95. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  96. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  97. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  98. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  99. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  100. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  101. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  102. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  103. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  104. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  105. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  106. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  107. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  108. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  109. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  110. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  111. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  112. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  113. package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  114. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  115. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  116. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  117. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  118. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  119. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  120. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  121. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  122. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  123. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  124. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  125. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  126. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  127. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  128. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  129. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  130. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  131. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  132. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  133. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  134. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  135. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  136. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  137. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  138. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  139. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  140. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  141. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  142. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  143. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  144. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  145. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  146. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  147. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  148. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  149. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  150. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  151. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  152. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  153. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  154. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  155. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  156. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  157. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  158. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  159. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  160. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  161. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  162. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  163. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  164. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  165. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  166. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  167. package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  168. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  169. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  170. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  171. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  172. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  173. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  174. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  175. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  176. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  177. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  178. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  179. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  180. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  181. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  182. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  183. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  184. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  185. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  186. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  187. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  188. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  189. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  190. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  191. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  192. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  193. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  194. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  195. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  196. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  197. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  198. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  199. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  200. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  201. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  202. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  203. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  204. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  205. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  206. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  207. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  208. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  209. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  210. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  211. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  212. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  213. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  214. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  215. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  216. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  217. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  218. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  219. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  220. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  221. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  222. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  223. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  224. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  225. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  226. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  227. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  228. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  229. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  230. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  231. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  232. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  233. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  234. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  235. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  236. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  237. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  238. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  239. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  240. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  241. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  242. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  243. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  244. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  245. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  246. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  247. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  248. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  249. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  250. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  251. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  252. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  253. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  254. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  255. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  256. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  257. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  258. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  259. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  260. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  261. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  262. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  263. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  264. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  265. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  266. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  267. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  268. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  269. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  270. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  271. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  272. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  273. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  274. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  275. package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  276. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  277. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  278. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  279. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  280. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  281. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  282. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  283. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  284. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  285. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  286. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  287. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  288. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  289. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  290. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  291. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  292. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  293. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  294. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  295. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  296. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  297. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  298. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  299. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  300. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  301. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  302. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  303. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  304. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  305. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  306. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  307. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  308. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  309. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  310. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  311. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  312. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  313. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  314. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  315. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  316. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  317. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  318. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  319. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  320. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  321. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  322. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  323. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  324. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  325. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  326. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  327. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  328. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  329. package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  330. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  331. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  332. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  333. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2363
  334. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  335. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  336. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  337. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  338. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  339. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  340. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  341. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  342. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  343. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  344. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  345. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  346. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  347. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  348. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  349. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  350. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  351. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  352. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  353. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  354. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  355. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  356. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/net.d.ts +0 -954
  357. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  358. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  359. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  360. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  361. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  362. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  363. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  364. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  365. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  366. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  367. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  368. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  369. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  370. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  371. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  372. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  373. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  374. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  375. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  376. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  377. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/url.d.ts +0 -944
  378. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  379. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  380. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  381. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  382. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  383. package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
@@ -1,1701 +0,0 @@
1
- /**
2
- * A stream is an abstract interface for working with streaming data in Node.js.
3
- * The `node:stream` module provides an API for implementing the stream interface.
4
- *
5
- * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances.
6
- *
7
- * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
8
- *
9
- * To access the `node:stream` module:
10
- *
11
- * ```js
12
- * const stream = require('node:stream');
13
- * ```
14
- *
15
- * The `node:stream` module is useful for creating new types of stream instances.
16
- * It is usually not necessary to use the `node:stream` module to consume streams.
17
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/stream.js)
18
- */
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
-
28
- class internal extends EventEmitter {
29
- pipe<T extends NodeJS.WritableStream>(
30
- destination: T,
31
- options?: {
32
- end?: boolean | undefined;
33
- },
34
- ): T;
35
- compose<T extends NodeJS.ReadableStream>(
36
- stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,
37
- options?: { signal: AbortSignal },
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;
941
- }
942
- namespace internal {
943
- class Stream extends internal {
944
- constructor(opts?: ReadableOptions);
945
- }
946
- interface StreamOptions<T extends Stream> extends Abortable {
947
- emitClose?: boolean | undefined;
948
- highWaterMark?: number | undefined;
949
- objectMode?: boolean | undefined;
950
- construct?(this: T, callback: (error?: Error | null) => void): void;
951
- destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void;
952
- autoDestroy?: boolean | undefined;
953
- }
954
- interface ReadableOptions extends StreamOptions<Readable> {
955
- encoding?: BufferEncoding | undefined;
956
- read?(this: Readable, size: number): void;
957
- }
958
- /**
959
- * @since v0.9.4
960
- */
961
- class Readable extends ReadableBase {
962
- /**
963
- * A utility method for creating a `Readable` from a web `ReadableStream`.
964
- * @since v17.0.0
965
- * @experimental
966
- */
967
- static fromWeb(
968
- readableStream: streamWeb.ReadableStream,
969
- options?: Pick<ReadableOptions, "encoding" | "highWaterMark" | "objectMode" | "signal">,
970
- ): Readable;
971
- /**
972
- * A utility method for creating a web `ReadableStream` from a `Readable`.
973
- * @since v17.0.0
974
- * @experimental
975
- */
976
- static toWeb(streamReadable: Readable): streamWeb.ReadableStream;
977
- }
978
- interface WritableOptions extends StreamOptions<Writable> {
979
- decodeStrings?: boolean | undefined;
980
- defaultEncoding?: BufferEncoding | undefined;
981
- write?(
982
- this: Writable,
983
- chunk: any,
984
- encoding: BufferEncoding,
985
- callback: (error?: Error | null) => void,
986
- ): void;
987
- writev?(
988
- this: Writable,
989
- chunks: Array<{
990
- chunk: any;
991
- encoding: BufferEncoding;
992
- }>,
993
- callback: (error?: Error | null) => void,
994
- ): void;
995
- final?(this: Writable, callback: (error?: Error | null) => void): void;
996
- }
997
- /**
998
- * @since v0.9.4
999
- */
1000
- class Writable extends WritableBase {
1001
- /**
1002
- * A utility method for creating a `Writable` from a web `WritableStream`.
1003
- * @since v17.0.0
1004
- * @experimental
1005
- */
1006
- static fromWeb(
1007
- writableStream: streamWeb.WritableStream,
1008
- options?: Pick<WritableOptions, "decodeStrings" | "highWaterMark" | "objectMode" | "signal">,
1009
- ): Writable;
1010
- /**
1011
- * A utility method for creating a web `WritableStream` from a `Writable`.
1012
- * @since v17.0.0
1013
- * @experimental
1014
- */
1015
- static toWeb(streamWritable: Writable): streamWeb.WritableStream;
1016
- }
1017
- interface DuplexOptions extends ReadableOptions, WritableOptions {
1018
- allowHalfOpen?: boolean | undefined;
1019
- readableObjectMode?: boolean | undefined;
1020
- writableObjectMode?: boolean | undefined;
1021
- readableHighWaterMark?: number | undefined;
1022
- writableHighWaterMark?: number | undefined;
1023
- writableCorked?: number | undefined;
1024
- construct?(this: Duplex, callback: (error?: Error | null) => void): void;
1025
- read?(this: Duplex, size: number): void;
1026
- write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
1027
- writev?(
1028
- this: Duplex,
1029
- chunks: Array<{
1030
- chunk: any;
1031
- encoding: BufferEncoding;
1032
- }>,
1033
- callback: (error?: Error | null) => void,
1034
- ): void;
1035
- final?(this: Duplex, callback: (error?: Error | null) => void): void;
1036
- destroy?(this: Duplex, error: Error | null, callback: (error?: Error | null) => void): void;
1037
- }
1038
- /**
1039
- * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
1040
- *
1041
- * Examples of `Duplex` streams include:
1042
- *
1043
- * * `TCP sockets`
1044
- * * `zlib streams`
1045
- * * `crypto streams`
1046
- * @since v0.9.4
1047
- */
1048
- class Duplex extends ReadableBase implements WritableBase {
1049
- readonly writable: boolean;
1050
- readonly writableEnded: boolean;
1051
- readonly writableFinished: boolean;
1052
- readonly writableHighWaterMark: number;
1053
- readonly writableLength: number;
1054
- readonly writableObjectMode: boolean;
1055
- readonly writableCorked: number;
1056
- readonly writableNeedDrain: boolean;
1057
- readonly closed: boolean;
1058
- readonly errored: Error | null;
1059
- /**
1060
- * If `false` then the stream will automatically end the writable side when the
1061
- * readable side ends. Set initially by the `allowHalfOpen` constructor option,
1062
- * which defaults to `true`.
1063
- *
1064
- * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is
1065
- * emitted.
1066
- * @since v0.9.4
1067
- */
1068
- allowHalfOpen: boolean;
1069
- constructor(opts?: DuplexOptions);
1070
- /**
1071
- * A utility method for creating duplex streams.
1072
- *
1073
- * - `Stream` converts writable stream into writable `Duplex` and readable stream
1074
- * to `Duplex`.
1075
- * - `Blob` converts into readable `Duplex`.
1076
- * - `string` converts into readable `Duplex`.
1077
- * - `ArrayBuffer` converts into readable `Duplex`.
1078
- * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`.
1079
- * - `AsyncGeneratorFunction` converts into a readable/writable transform
1080
- * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield
1081
- * `null`.
1082
- * - `AsyncFunction` converts into a writable `Duplex`. Must return
1083
- * either `null` or `undefined`
1084
- * - `Object ({ writable, readable })` converts `readable` and
1085
- * `writable` into `Stream` and then combines them into `Duplex` where the
1086
- * `Duplex` will write to the `writable` and read from the `readable`.
1087
- * - `Promise` converts into readable `Duplex`. Value `null` is ignored.
1088
- *
1089
- * @since v16.8.0
1090
- */
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;
1103
- _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
1104
- _writev?(
1105
- chunks: Array<{
1106
- chunk: any;
1107
- encoding: BufferEncoding;
1108
- }>,
1109
- callback: (error?: Error | null) => void,
1110
- ): void;
1111
- _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
1112
- _final(callback: (error?: Error | null) => void): void;
1113
- write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
1114
- write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
1115
- setDefaultEncoding(encoding: BufferEncoding): this;
1116
- end(cb?: () => void): this;
1117
- end(chunk: any, cb?: () => void): this;
1118
- end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
1119
- cork(): void;
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;
1145
- /**
1146
- * Event emitter
1147
- * The defined events on documents including:
1148
- * 1. close
1149
- * 2. data
1150
- * 3. drain
1151
- * 4. end
1152
- * 5. error
1153
- * 6. finish
1154
- * 7. pause
1155
- * 8. pipe
1156
- * 9. readable
1157
- * 10. resume
1158
- * 11. unpipe
1159
- */
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;
1171
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
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;
1183
- emit(event: string | symbol, ...args: any[]): boolean;
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;
1195
- on(event: string | symbol, listener: (...args: any[]) => 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;
1207
- once(event: string | symbol, listener: (...args: any[]) => 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;
1219
- prependListener(event: string | symbol, listener: (...args: any[]) => 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;
1231
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => 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;
1243
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
1244
- }
1245
- type TransformCallback = (error?: Error | null, data?: any) => void;
1246
- interface TransformOptions extends DuplexOptions {
1247
- construct?(this: Transform, callback: (error?: Error | null) => void): void;
1248
- read?(this: Transform, size: number): void;
1249
- write?(
1250
- this: Transform,
1251
- chunk: any,
1252
- encoding: BufferEncoding,
1253
- callback: (error?: Error | null) => void,
1254
- ): void;
1255
- writev?(
1256
- this: Transform,
1257
- chunks: Array<{
1258
- chunk: any;
1259
- encoding: BufferEncoding;
1260
- }>,
1261
- callback: (error?: Error | null) => void,
1262
- ): void;
1263
- final?(this: Transform, callback: (error?: Error | null) => void): void;
1264
- destroy?(this: Transform, error: Error | null, callback: (error?: Error | null) => void): void;
1265
- transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1266
- flush?(this: Transform, callback: TransformCallback): void;
1267
- }
1268
- /**
1269
- * Transform streams are `Duplex` streams where the output is in some way
1270
- * related to the input. Like all `Duplex` streams, `Transform` streams
1271
- * implement both the `Readable` and `Writable` interfaces.
1272
- *
1273
- * Examples of `Transform` streams include:
1274
- *
1275
- * * `zlib streams`
1276
- * * `crypto streams`
1277
- * @since v0.9.4
1278
- */
1279
- class Transform extends Duplex {
1280
- constructor(opts?: TransformOptions);
1281
- _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
1282
- _flush(callback: TransformCallback): void;
1283
- }
1284
- /**
1285
- * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is
1286
- * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams.
1287
- */
1288
- class PassThrough extends Transform {}
1289
- /**
1290
- * A stream to attach a signal to.
1291
- *
1292
- * Attaches an AbortSignal to a readable or writeable stream. This lets code
1293
- * control stream destruction using an `AbortController`.
1294
- *
1295
- * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new
1296
- * AbortError())` for webstreams.
1297
- *
1298
- * ```js
1299
- * const fs = require('node:fs');
1300
- *
1301
- * const controller = new AbortController();
1302
- * const read = addAbortSignal(
1303
- * controller.signal,
1304
- * fs.createReadStream(('object.json')),
1305
- * );
1306
- * // Later, abort the operation closing the stream
1307
- * controller.abort();
1308
- * ```
1309
- *
1310
- * Or using an `AbortSignal` with a readable stream as an async iterable:
1311
- *
1312
- * ```js
1313
- * const controller = new AbortController();
1314
- * setTimeout(() => controller.abort(), 10_000); // set a timeout
1315
- * const stream = addAbortSignal(
1316
- * controller.signal,
1317
- * fs.createReadStream(('object.json')),
1318
- * );
1319
- * (async () => {
1320
- * try {
1321
- * for await (const chunk of stream) {
1322
- * await process(chunk);
1323
- * }
1324
- * } catch (e) {
1325
- * if (e.name === 'AbortError') {
1326
- * // The operation was cancelled
1327
- * } else {
1328
- * throw e;
1329
- * }
1330
- * }
1331
- * })();
1332
- * ```
1333
- *
1334
- * Or using an `AbortSignal` with a ReadableStream:
1335
- *
1336
- * ```js
1337
- * const controller = new AbortController();
1338
- * const rs = new ReadableStream({
1339
- * start(controller) {
1340
- * controller.enqueue('hello');
1341
- * controller.enqueue('world');
1342
- * controller.close();
1343
- * },
1344
- * });
1345
- *
1346
- * addAbortSignal(controller.signal, rs);
1347
- *
1348
- * finished(rs, (err) => {
1349
- * if (err) {
1350
- * if (err.name === 'AbortError') {
1351
- * // The operation was cancelled
1352
- * }
1353
- * }
1354
- * });
1355
- *
1356
- * const reader = rs.getReader();
1357
- *
1358
- * reader.read().then(({ value, done }) => {
1359
- * console.log(value); // hello
1360
- * console.log(done); // false
1361
- * controller.abort();
1362
- * });
1363
- * ```
1364
- * @since v15.4.0
1365
- * @param signal A signal representing possible cancellation
1366
- * @param stream a stream to attach a signal to
1367
- */
1368
- function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
1369
- /**
1370
- * Returns the default highWaterMark used by streams.
1371
- * Defaults to `16384` (16 KiB), or `16` for `objectMode`.
1372
- * @since v19.9.0
1373
- * @param objectMode
1374
- */
1375
- function getDefaultHighWaterMark(objectMode: boolean): number;
1376
- /**
1377
- * Sets the default highWaterMark used by streams.
1378
- * @since v19.9.0
1379
- * @param objectMode
1380
- * @param value highWaterMark value
1381
- */
1382
- function setDefaultHighWaterMark(objectMode: boolean, value: number): void;
1383
- interface FinishedOptions extends Abortable {
1384
- error?: boolean | undefined;
1385
- readable?: boolean | undefined;
1386
- writable?: boolean | undefined;
1387
- }
1388
- /**
1389
- * A readable and/or writable stream/webstream.
1390
- *
1391
- * A function to get notified when a stream is no longer readable, writable
1392
- * or has experienced an error or a premature close event.
1393
- *
1394
- * ```js
1395
- * const { finished } = require('node:stream');
1396
- * const fs = require('node:fs');
1397
- *
1398
- * const rs = fs.createReadStream('archive.tar');
1399
- *
1400
- * finished(rs, (err) => {
1401
- * if (err) {
1402
- * console.error('Stream failed.', err);
1403
- * } else {
1404
- * console.log('Stream is done reading.');
1405
- * }
1406
- * });
1407
- *
1408
- * rs.resume(); // Drain the stream.
1409
- * ```
1410
- *
1411
- * Especially useful in error handling scenarios where a stream is destroyed
1412
- * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`.
1413
- *
1414
- * The `finished` API provides `promise version`.
1415
- *
1416
- * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
1417
- * invoked. The reason for this is so that unexpected `'error'` events (due to
1418
- * incorrect stream implementations) do not cause unexpected crashes.
1419
- * If this is unwanted behavior then the returned cleanup function needs to be
1420
- * invoked in the callback:
1421
- *
1422
- * ```js
1423
- * const cleanup = finished(rs, (err) => {
1424
- * cleanup();
1425
- * // ...
1426
- * });
1427
- * ```
1428
- * @since v10.0.0
1429
- * @param stream A readable and/or writable stream.
1430
- * @param callback A callback function that takes an optional error argument.
1431
- * @return A cleanup function which removes all registered listeners.
1432
- */
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;
1442
- namespace finished {
1443
- function __promisify__(
1444
- stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
1445
- options?: FinishedOptions,
1446
- ): Promise<void>;
1447
- }
1448
- type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
1449
- type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
1450
- type PipelineTransform<S extends PipelineTransformSource<any>, U> =
1451
- | NodeJS.ReadWriteStream
1452
- | ((
1453
- source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ? AsyncIterable<ST>
1454
- : S,
1455
- ) => AsyncIterable<U>);
1456
- type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
1457
- type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
1458
- type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<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>
1464
- : never;
1465
- type PipelineCallback<S extends PipelineDestination<any, any>> = S extends
1466
- PipelineDestinationPromiseFunction<any, infer P> ? (err: NodeJS.ErrnoException | null, value: P) => void
1467
- : (err: NodeJS.ErrnoException | null) => void;
1468
- type PipelinePromise<S extends PipelineDestination<any, any>> = S extends
1469
- PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
1470
- interface PipelineOptions {
1471
- signal?: AbortSignal | undefined;
1472
- end?: boolean | undefined;
1473
- }
1474
- /**
1475
- * A module method to pipe between streams and generators forwarding errors and
1476
- * properly cleaning up and provide a callback when the pipeline is complete.
1477
- *
1478
- * ```js
1479
- * const { pipeline } = require('node:stream');
1480
- * const fs = require('node:fs');
1481
- * const zlib = require('node:zlib');
1482
- *
1483
- * // Use the pipeline API to easily pipe a series of streams
1484
- * // together and get notified when the pipeline is fully done.
1485
- *
1486
- * // A pipeline to gzip a potentially huge tar file efficiently:
1487
- *
1488
- * pipeline(
1489
- * fs.createReadStream('archive.tar'),
1490
- * zlib.createGzip(),
1491
- * fs.createWriteStream('archive.tar.gz'),
1492
- * (err) => {
1493
- * if (err) {
1494
- * console.error('Pipeline failed.', err);
1495
- * } else {
1496
- * console.log('Pipeline succeeded.');
1497
- * }
1498
- * },
1499
- * );
1500
- * ```
1501
- *
1502
- * The `pipeline` API provides a `promise version`.
1503
- *
1504
- * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
1505
- *
1506
- * * `Readable` streams which have emitted `'end'` or `'close'`.
1507
- * * `Writable` streams which have emitted `'finish'` or `'close'`.
1508
- *
1509
- * `stream.pipeline()` leaves dangling event listeners on the streams
1510
- * after the `callback` has been invoked. In the case of reuse of streams after
1511
- * failure, this can cause event listener leaks and swallowed errors. If the last
1512
- * stream is readable, dangling event listeners will be removed so that the last
1513
- * stream can be consumed later.
1514
- *
1515
- * `stream.pipeline()` closes all the streams when an error is raised.
1516
- * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior
1517
- * once it would destroy the socket without sending the expected response.
1518
- * See the example below:
1519
- *
1520
- * ```js
1521
- * const fs = require('node:fs');
1522
- * const http = require('node:http');
1523
- * const { pipeline } = require('node:stream');
1524
- *
1525
- * const server = http.createServer((req, res) => {
1526
- * const fileStream = fs.createReadStream('./fileNotExist.txt');
1527
- * pipeline(fileStream, res, (err) => {
1528
- * if (err) {
1529
- * console.log(err); // No such file
1530
- * // this message can't be sent once `pipeline` already destroyed the socket
1531
- * return res.end('error!!!');
1532
- * }
1533
- * });
1534
- * });
1535
- * ```
1536
- * @since v10.0.0
1537
- * @param callback Called when the pipeline is fully done.
1538
- */
1539
- function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1540
- source: A,
1541
- destination: B,
1542
- callback?: PipelineCallback<B>,
1543
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1544
- function pipeline<
1545
- A extends PipelineSource<any>,
1546
- T1 extends PipelineTransform<A, any>,
1547
- B extends PipelineDestination<T1, any>,
1548
- >(
1549
- source: A,
1550
- transform1: T1,
1551
- destination: B,
1552
- callback?: PipelineCallback<B>,
1553
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
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
- >(
1560
- source: A,
1561
- transform1: T1,
1562
- transform2: T2,
1563
- destination: B,
1564
- callback?: PipelineCallback<B>,
1565
- ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1566
- function pipeline<
1567
- A extends PipelineSource<any>,
1568
- T1 extends PipelineTransform<A, any>,
1569
- T2 extends PipelineTransform<T1, any>,
1570
- T3 extends PipelineTransform<T2, any>,
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;
1580
- function pipeline<
1581
- A extends PipelineSource<any>,
1582
- T1 extends PipelineTransform<A, any>,
1583
- T2 extends PipelineTransform<T1, any>,
1584
- T3 extends PipelineTransform<T2, any>,
1585
- T4 extends PipelineTransform<T3, any>,
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;
1596
- function pipeline(
1597
- streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1598
- callback?: (err: NodeJS.ErrnoException | null) => void,
1599
- ): NodeJS.WritableStream;
1600
- function pipeline(
1601
- stream1: NodeJS.ReadableStream,
1602
- stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1603
- ...streams: Array<
1604
- NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)
1605
- >
1606
- ): NodeJS.WritableStream;
1607
- namespace pipeline {
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
- >(
1618
- source: A,
1619
- transform1: T1,
1620
- destination: B,
1621
- options?: PipelineOptions,
1622
- ): PipelinePromise<B>;
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
- >(
1629
- source: A,
1630
- transform1: T1,
1631
- transform2: T2,
1632
- destination: B,
1633
- options?: PipelineOptions,
1634
- ): PipelinePromise<B>;
1635
- function __promisify__<
1636
- A extends PipelineSource<any>,
1637
- T1 extends PipelineTransform<A, any>,
1638
- T2 extends PipelineTransform<T1, any>,
1639
- T3 extends PipelineTransform<T2, any>,
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>;
1649
- function __promisify__<
1650
- A extends PipelineSource<any>,
1651
- T1 extends PipelineTransform<A, any>,
1652
- T2 extends PipelineTransform<T1, any>,
1653
- T3 extends PipelineTransform<T2, any>,
1654
- T4 extends PipelineTransform<T3, any>,
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>;
1669
- function __promisify__(
1670
- stream1: NodeJS.ReadableStream,
1671
- stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1672
- ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
1673
- ): Promise<void>;
1674
- }
1675
- interface Pipe {
1676
- close(): void;
1677
- hasRef(): boolean;
1678
- ref(): void;
1679
- unref(): void;
1680
- }
1681
- /**
1682
- * Returns whether the stream has encountered an error.
1683
- * @since v17.3.0, v16.14.0
1684
- * @experimental
1685
- */
1686
- function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
1687
- /**
1688
- * Returns whether the stream is readable.
1689
- * @since v17.4.0, v16.14.0
1690
- * @experimental
1691
- */
1692
- function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
1693
- const promises: typeof streamPromises;
1694
- const consumers: typeof streamConsumers;
1695
- }
1696
- export = internal;
1697
- }
1698
- declare module "node:stream" {
1699
- import stream = require("stream");
1700
- export = stream;
1701
- }