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