@types/node 22.15.21 → 24.10.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.
- node/README.md +2 -2
- node/assert/strict.d.ts +105 -2
- node/assert.d.ts +162 -101
- node/async_hooks.d.ts +26 -6
- node/buffer.buffer.d.ts +9 -0
- node/buffer.d.ts +15 -7
- node/child_process.d.ts +91 -164
- node/cluster.d.ts +19 -20
- node/console.d.ts +19 -18
- node/crypto.d.ts +1264 -356
- node/dgram.d.ts +10 -9
- node/diagnostics_channel.d.ts +18 -15
- node/dns/promises.d.ts +36 -9
- node/dns.d.ts +95 -37
- node/domain.d.ts +1 -1
- node/events.d.ts +81 -36
- node/fs/promises.d.ts +104 -59
- node/fs.d.ts +414 -137
- node/globals.d.ts +149 -350
- node/globals.typedarray.d.ts +20 -0
- node/http.d.ts +187 -37
- node/http2.d.ts +266 -67
- node/https.d.ts +97 -63
- node/index.d.ts +16 -7
- node/inspector.d.ts +206 -3931
- node/inspector.generated.d.ts +4233 -0
- node/module.d.ts +153 -31
- node/net.d.ts +35 -16
- node/os.d.ts +22 -10
- node/package.json +14 -84
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +30 -18
- node/process.d.ts +40 -34
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline/promises.d.ts +1 -2
- node/readline.d.ts +13 -13
- node/repl.d.ts +25 -17
- node/sea.d.ts +10 -1
- node/sqlite.d.ts +438 -9
- node/stream/consumers.d.ts +2 -2
- node/stream/web.d.ts +13 -54
- node/stream.d.ts +68 -47
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +2034 -1975
- node/timers/promises.d.ts +1 -1
- node/timers.d.ts +1 -3
- node/tls.d.ts +124 -114
- node/trace_events.d.ts +6 -6
- node/ts5.6/buffer.buffer.d.ts +10 -2
- node/ts5.6/compatibility/float16array.d.ts +71 -0
- node/ts5.6/globals.typedarray.d.ts +17 -0
- node/ts5.6/index.d.ts +18 -7
- node/ts5.7/compatibility/float16array.d.ts +72 -0
- node/ts5.7/index.d.ts +103 -0
- node/tty.d.ts +1 -1
- node/url.d.ts +119 -34
- node/util.d.ts +46 -305
- node/v8.d.ts +100 -37
- node/vm.d.ts +299 -110
- node/wasi.d.ts +23 -2
- node/web-globals/abortcontroller.d.ts +34 -0
- node/web-globals/crypto.d.ts +32 -0
- node/web-globals/domexception.d.ts +68 -0
- node/web-globals/events.d.ts +97 -0
- node/web-globals/fetch.d.ts +50 -0
- node/web-globals/navigator.d.ts +25 -0
- node/web-globals/storage.d.ts +24 -0
- node/web-globals/streams.d.ts +22 -0
- node/worker_threads.d.ts +225 -75
- node/zlib.d.ts +44 -33
- node/compatibility/disposable.d.ts +0 -16
- node/compatibility/index.d.ts +0 -9
- node/compatibility/indexable.d.ts +0 -23
- node/dom-events.d.ts +0 -124
node/stream/web.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
2
2
|
: import("stream/web").ByteLengthQueuingStrategy;
|
|
3
|
-
type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
4
|
-
: import("stream/web").CompressionStream;
|
|
5
3
|
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
6
4
|
: import("stream/web").CountQueuingStrategy;
|
|
7
|
-
type
|
|
8
|
-
: import("stream/web").
|
|
5
|
+
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
6
|
+
: import("stream/web").QueuingStrategy<T>;
|
|
9
7
|
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
|
10
8
|
: import("stream/web").ReadableByteStreamController;
|
|
11
9
|
type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
@@ -143,6 +141,9 @@ declare module "stream/web" {
|
|
|
143
141
|
interface TransformerTransformCallback<I, O> {
|
|
144
142
|
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
|
145
143
|
}
|
|
144
|
+
interface TransformerCancelCallback {
|
|
145
|
+
(reason: any): void | PromiseLike<void>;
|
|
146
|
+
}
|
|
146
147
|
interface UnderlyingByteSource {
|
|
147
148
|
autoAllocateChunkSize?: number;
|
|
148
149
|
cancel?: ReadableStreamErrorCallback;
|
|
@@ -261,6 +262,7 @@ declare module "stream/web" {
|
|
|
261
262
|
readableType?: undefined;
|
|
262
263
|
start?: TransformerStartCallback<O>;
|
|
263
264
|
transform?: TransformerTransformCallback<I, O>;
|
|
265
|
+
cancel?: TransformerCancelCallback;
|
|
264
266
|
writableType?: undefined;
|
|
265
267
|
}
|
|
266
268
|
interface TransformStream<I = any, O = any> {
|
|
@@ -406,22 +408,17 @@ declare module "stream/web" {
|
|
|
406
408
|
prototype: TextDecoderStream;
|
|
407
409
|
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
|
|
408
410
|
};
|
|
409
|
-
|
|
411
|
+
type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip";
|
|
412
|
+
class CompressionStream {
|
|
413
|
+
constructor(format: CompressionFormat);
|
|
410
414
|
readonly readable: ReadableStream;
|
|
411
415
|
readonly writable: WritableStream;
|
|
412
416
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
|
|
416
|
-
};
|
|
417
|
-
interface DecompressionStream {
|
|
418
|
-
readonly writable: WritableStream;
|
|
417
|
+
class DecompressionStream {
|
|
418
|
+
constructor(format: CompressionFormat);
|
|
419
419
|
readonly readable: ReadableStream;
|
|
420
|
+
readonly writable: WritableStream;
|
|
420
421
|
}
|
|
421
|
-
const DecompressionStream: {
|
|
422
|
-
prototype: DecompressionStream;
|
|
423
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
|
|
424
|
-
};
|
|
425
422
|
|
|
426
423
|
global {
|
|
427
424
|
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
|
|
@@ -434,26 +431,6 @@ declare module "stream/web" {
|
|
|
434
431
|
? T
|
|
435
432
|
: typeof import("stream/web").ByteLengthQueuingStrategy;
|
|
436
433
|
|
|
437
|
-
interface CompressionStream extends _CompressionStream {}
|
|
438
|
-
/**
|
|
439
|
-
* `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
|
|
440
|
-
* https://nodejs.org/api/globals.html#class-compressionstream
|
|
441
|
-
* @since v18.0.0
|
|
442
|
-
*/
|
|
443
|
-
var CompressionStream: typeof globalThis extends {
|
|
444
|
-
onmessage: any;
|
|
445
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
446
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
447
|
-
ReportingObserver: any;
|
|
448
|
-
CompressionStream: infer T;
|
|
449
|
-
} ? T
|
|
450
|
-
// TS 4.8, 4.9, 5.0
|
|
451
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
452
|
-
prototype: T;
|
|
453
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
454
|
-
}
|
|
455
|
-
: typeof import("stream/web").CompressionStream;
|
|
456
|
-
|
|
457
434
|
interface CountQueuingStrategy extends _CountQueuingStrategy {}
|
|
458
435
|
/**
|
|
459
436
|
* `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
|
|
@@ -463,25 +440,7 @@ declare module "stream/web" {
|
|
|
463
440
|
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
|
|
464
441
|
: typeof import("stream/web").CountQueuingStrategy;
|
|
465
442
|
|
|
466
|
-
interface
|
|
467
|
-
/**
|
|
468
|
-
* `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
|
|
469
|
-
* https://nodejs.org/api/globals.html#class-decompressionstream
|
|
470
|
-
* @since v18.0.0
|
|
471
|
-
*/
|
|
472
|
-
var DecompressionStream: typeof globalThis extends {
|
|
473
|
-
onmessage: any;
|
|
474
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
475
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
476
|
-
ReportingObserver: any;
|
|
477
|
-
DecompressionStream: infer T extends object;
|
|
478
|
-
} ? T
|
|
479
|
-
// TS 4.8, 4.9, 5.0
|
|
480
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
481
|
-
prototype: T;
|
|
482
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
483
|
-
}
|
|
484
|
-
: typeof import("stream/web").DecompressionStream;
|
|
443
|
+
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
|
|
485
444
|
|
|
486
445
|
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|
|
487
446
|
/**
|
node/stream.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* A stream is an abstract interface for working with streaming data in Node.js.
|
|
3
3
|
* The `node:stream` module provides an API for implementing the stream interface.
|
|
4
4
|
*
|
|
5
|
-
* There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-
|
|
6
|
-
* and [`process.stdout`](https://nodejs.org/docs/latest-
|
|
5
|
+
* There are many stream objects provided by Node.js. For instance, a [request to an HTTP server](https://nodejs.org/docs/latest-v24.x/api/http.html#class-httpincomingmessage)
|
|
6
|
+
* and [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) are both stream instances.
|
|
7
7
|
*
|
|
8
|
-
* Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-
|
|
8
|
+
* Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`](https://nodejs.org/docs/latest-v24.x/api/events.html#class-eventemitter).
|
|
9
9
|
*
|
|
10
10
|
* To access the `node:stream` module:
|
|
11
11
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* The `node:stream` module is useful for creating new types of stream instances.
|
|
17
17
|
* It is usually not necessary to use the `node:stream` module to consume streams.
|
|
18
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
18
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/stream.js)
|
|
19
19
|
*/
|
|
20
20
|
declare module "stream" {
|
|
21
21
|
import { Abortable, EventEmitter } from "node:events";
|
|
@@ -45,22 +45,22 @@ declare module "stream" {
|
|
|
45
45
|
emitClose?: boolean | undefined;
|
|
46
46
|
highWaterMark?: number | undefined;
|
|
47
47
|
objectMode?: boolean | undefined;
|
|
48
|
-
construct
|
|
49
|
-
destroy
|
|
48
|
+
construct?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
|
|
49
|
+
destroy?: ((this: T, error: Error | null, callback: (error?: Error | null) => void) => void) | undefined;
|
|
50
50
|
autoDestroy?: boolean | undefined;
|
|
51
51
|
}
|
|
52
52
|
interface ReadableOptions<T extends Readable = Readable> extends StreamOptions<T> {
|
|
53
53
|
encoding?: BufferEncoding | undefined;
|
|
54
|
-
read
|
|
54
|
+
read?: ((this: T, size: number) => void) | undefined;
|
|
55
55
|
}
|
|
56
56
|
interface ArrayOptions {
|
|
57
57
|
/**
|
|
58
58
|
* The maximum concurrent invocations of `fn` to call on the stream at once.
|
|
59
59
|
* @default 1
|
|
60
60
|
*/
|
|
61
|
-
concurrency?: number;
|
|
61
|
+
concurrency?: number | undefined;
|
|
62
62
|
/** Allows destroying the stream if the signal is aborted. */
|
|
63
|
-
signal?: AbortSignal;
|
|
63
|
+
signal?: AbortSignal | undefined;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* @since v0.9.4
|
|
@@ -76,7 +76,6 @@ declare module "stream" {
|
|
|
76
76
|
/**
|
|
77
77
|
* A utility method for creating a `Readable` from a web `ReadableStream`.
|
|
78
78
|
* @since v17.0.0
|
|
79
|
-
* @experimental
|
|
80
79
|
*/
|
|
81
80
|
static fromWeb(
|
|
82
81
|
readableStream: streamWeb.ReadableStream,
|
|
@@ -85,7 +84,6 @@ declare module "stream" {
|
|
|
85
84
|
/**
|
|
86
85
|
* A utility method for creating a web `ReadableStream` from a `Readable`.
|
|
87
86
|
* @since v17.0.0
|
|
88
|
-
* @experimental
|
|
89
87
|
*/
|
|
90
88
|
static toWeb(
|
|
91
89
|
streamReadable: Readable,
|
|
@@ -101,7 +99,6 @@ declare module "stream" {
|
|
|
101
99
|
/**
|
|
102
100
|
* Returns whether the stream was destroyed or errored before emitting `'end'`.
|
|
103
101
|
* @since v16.8.0
|
|
104
|
-
* @experimental
|
|
105
102
|
*/
|
|
106
103
|
readonly readableAborted: boolean;
|
|
107
104
|
/**
|
|
@@ -113,7 +110,6 @@ declare module "stream" {
|
|
|
113
110
|
/**
|
|
114
111
|
* Returns whether `'data'` has been emitted.
|
|
115
112
|
* @since v16.7.0, v14.18.0
|
|
116
|
-
* @experimental
|
|
117
113
|
*/
|
|
118
114
|
readonly readableDidRead: boolean;
|
|
119
115
|
/**
|
|
@@ -122,13 +118,13 @@ declare module "stream" {
|
|
|
122
118
|
*/
|
|
123
119
|
readonly readableEncoding: BufferEncoding | null;
|
|
124
120
|
/**
|
|
125
|
-
* Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-
|
|
121
|
+
* Becomes `true` when [`'end'`](https://nodejs.org/docs/latest-v24.x/api/stream.html#event-end) event is emitted.
|
|
126
122
|
* @since v12.9.0
|
|
127
123
|
*/
|
|
128
124
|
readonly readableEnded: boolean;
|
|
129
125
|
/**
|
|
130
126
|
* This property reflects the current state of a `Readable` stream as described
|
|
131
|
-
* in the [Three states](https://nodejs.org/docs/latest-
|
|
127
|
+
* in the [Three states](https://nodejs.org/docs/latest-v24.x/api/stream.html#three-states) section.
|
|
132
128
|
* @since v9.4.0
|
|
133
129
|
*/
|
|
134
130
|
readonly readableFlowing: boolean | null;
|
|
@@ -619,6 +615,17 @@ declare module "stream" {
|
|
|
619
615
|
* @param error Error which will be passed as payload in `'error'` event
|
|
620
616
|
*/
|
|
621
617
|
destroy(error?: Error): this;
|
|
618
|
+
/**
|
|
619
|
+
* @returns `AsyncIterator` to fully consume the stream.
|
|
620
|
+
* @since v10.0.0
|
|
621
|
+
*/
|
|
622
|
+
[Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
|
|
623
|
+
/**
|
|
624
|
+
* Calls `readable.destroy()` with an `AbortError` and returns
|
|
625
|
+
* a promise that fulfills when the stream is finished.
|
|
626
|
+
* @since v20.4.0
|
|
627
|
+
*/
|
|
628
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
622
629
|
/**
|
|
623
630
|
* Event emitter
|
|
624
631
|
* The defined events on documents including:
|
|
@@ -686,31 +693,29 @@ declare module "stream" {
|
|
|
686
693
|
removeListener(event: "readable", listener: () => void): this;
|
|
687
694
|
removeListener(event: "resume", listener: () => void): this;
|
|
688
695
|
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
689
|
-
[Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
|
|
690
|
-
/**
|
|
691
|
-
* Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished.
|
|
692
|
-
* @since v20.4.0
|
|
693
|
-
*/
|
|
694
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
695
696
|
}
|
|
696
697
|
interface WritableOptions<T extends Writable = Writable> extends StreamOptions<T> {
|
|
697
698
|
decodeStrings?: boolean | undefined;
|
|
698
699
|
defaultEncoding?: BufferEncoding | undefined;
|
|
699
|
-
write
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
700
|
+
write?:
|
|
701
|
+
| ((
|
|
702
|
+
this: T,
|
|
703
|
+
chunk: any,
|
|
704
|
+
encoding: BufferEncoding,
|
|
705
|
+
callback: (error?: Error | null) => void,
|
|
706
|
+
) => void)
|
|
707
|
+
| undefined;
|
|
708
|
+
writev?:
|
|
709
|
+
| ((
|
|
710
|
+
this: T,
|
|
711
|
+
chunks: Array<{
|
|
712
|
+
chunk: any;
|
|
713
|
+
encoding: BufferEncoding;
|
|
714
|
+
}>,
|
|
715
|
+
callback: (error?: Error | null) => void,
|
|
716
|
+
) => void)
|
|
717
|
+
| undefined;
|
|
718
|
+
final?: ((this: T, callback: (error?: Error | null) => void) => void) | undefined;
|
|
714
719
|
}
|
|
715
720
|
/**
|
|
716
721
|
* @since v0.9.4
|
|
@@ -719,7 +724,6 @@ declare module "stream" {
|
|
|
719
724
|
/**
|
|
720
725
|
* A utility method for creating a `Writable` from a web `WritableStream`.
|
|
721
726
|
* @since v17.0.0
|
|
722
|
-
* @experimental
|
|
723
727
|
*/
|
|
724
728
|
static fromWeb(
|
|
725
729
|
writableStream: streamWeb.WritableStream,
|
|
@@ -728,7 +732,6 @@ declare module "stream" {
|
|
|
728
732
|
/**
|
|
729
733
|
* A utility method for creating a web `WritableStream` from a `Writable`.
|
|
730
734
|
* @since v17.0.0
|
|
731
|
-
* @experimental
|
|
732
735
|
*/
|
|
733
736
|
static toWeb(streamWritable: Writable): streamWeb.WritableStream;
|
|
734
737
|
/**
|
|
@@ -737,6 +740,11 @@ declare module "stream" {
|
|
|
737
740
|
* @since v11.4.0
|
|
738
741
|
*/
|
|
739
742
|
readonly writable: boolean;
|
|
743
|
+
/**
|
|
744
|
+
* Returns whether the stream was destroyed or errored before emitting `'finish'`.
|
|
745
|
+
* @since v18.0.0, v16.17.0
|
|
746
|
+
*/
|
|
747
|
+
readonly writableAborted: boolean;
|
|
740
748
|
/**
|
|
741
749
|
* Is `true` after `writable.end()` has been called. This property
|
|
742
750
|
* does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.
|
|
@@ -958,6 +966,12 @@ declare module "stream" {
|
|
|
958
966
|
* @param error Optional, an error to emit with `'error'` event.
|
|
959
967
|
*/
|
|
960
968
|
destroy(error?: Error): this;
|
|
969
|
+
/**
|
|
970
|
+
* Calls `writable.destroy()` with an `AbortError` and returns
|
|
971
|
+
* a promise that fulfills when the stream is finished.
|
|
972
|
+
* @since v22.4.0, v20.16.0
|
|
973
|
+
*/
|
|
974
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
961
975
|
/**
|
|
962
976
|
* Event emitter
|
|
963
977
|
* The defined events on documents including:
|
|
@@ -1084,7 +1098,6 @@ declare module "stream" {
|
|
|
1084
1098
|
/**
|
|
1085
1099
|
* A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`.
|
|
1086
1100
|
* @since v17.0.0
|
|
1087
|
-
* @experimental
|
|
1088
1101
|
*/
|
|
1089
1102
|
static toWeb(streamDuplex: Duplex): {
|
|
1090
1103
|
readable: streamWeb.ReadableStream;
|
|
@@ -1093,7 +1106,6 @@ declare module "stream" {
|
|
|
1093
1106
|
/**
|
|
1094
1107
|
* A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`.
|
|
1095
1108
|
* @since v17.0.0
|
|
1096
|
-
* @experimental
|
|
1097
1109
|
*/
|
|
1098
1110
|
static fromWeb(
|
|
1099
1111
|
duplexStream: {
|
|
@@ -1227,8 +1239,10 @@ declare module "stream" {
|
|
|
1227
1239
|
function duplexPair(options?: DuplexOptions): [Duplex, Duplex];
|
|
1228
1240
|
type TransformCallback = (error?: Error | null, data?: any) => void;
|
|
1229
1241
|
interface TransformOptions<T extends Transform = Transform> extends DuplexOptions<T> {
|
|
1230
|
-
transform
|
|
1231
|
-
|
|
1242
|
+
transform?:
|
|
1243
|
+
| ((this: T, chunk: any, encoding: BufferEncoding, callback: TransformCallback) => void)
|
|
1244
|
+
| undefined;
|
|
1245
|
+
flush?: ((this: T, callback: TransformCallback) => void) | undefined;
|
|
1232
1246
|
}
|
|
1233
1247
|
/**
|
|
1234
1248
|
* Transform streams are `Duplex` streams where the output is in some way
|
|
@@ -1374,7 +1388,7 @@ declare module "stream" {
|
|
|
1374
1388
|
* Especially useful in error handling scenarios where a stream is destroyed
|
|
1375
1389
|
* prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`.
|
|
1376
1390
|
*
|
|
1377
|
-
* The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-
|
|
1391
|
+
* The `finished` API provides [`promise version`](https://nodejs.org/docs/latest-v24.x/api/stream.html#streamfinishedstream-options).
|
|
1378
1392
|
*
|
|
1379
1393
|
* `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
|
|
1380
1394
|
* invoked. The reason for this is so that unexpected `'error'` events (due to
|
|
@@ -1462,7 +1476,7 @@ declare module "stream" {
|
|
|
1462
1476
|
* );
|
|
1463
1477
|
* ```
|
|
1464
1478
|
*
|
|
1465
|
-
* The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-
|
|
1479
|
+
* The `pipeline` API provides a [`promise version`](https://nodejs.org/docs/latest-v24.x/api/stream.html#streampipelinesource-transforms-destination-options).
|
|
1466
1480
|
*
|
|
1467
1481
|
* `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
|
|
1468
1482
|
*
|
|
@@ -1635,24 +1649,31 @@ declare module "stream" {
|
|
|
1635
1649
|
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
|
|
1636
1650
|
): Promise<void>;
|
|
1637
1651
|
}
|
|
1652
|
+
// TODO: this interface never existed; remove in next major
|
|
1638
1653
|
interface Pipe {
|
|
1639
1654
|
close(): void;
|
|
1640
1655
|
hasRef(): boolean;
|
|
1641
1656
|
ref(): void;
|
|
1642
1657
|
unref(): void;
|
|
1643
1658
|
}
|
|
1659
|
+
// TODO: these should all take webstream arguments
|
|
1644
1660
|
/**
|
|
1645
1661
|
* Returns whether the stream has encountered an error.
|
|
1646
1662
|
* @since v17.3.0, v16.14.0
|
|
1647
|
-
* @experimental
|
|
1648
1663
|
*/
|
|
1649
1664
|
function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
|
|
1650
1665
|
/**
|
|
1651
1666
|
* Returns whether the stream is readable.
|
|
1652
1667
|
* @since v17.4.0, v16.14.0
|
|
1653
|
-
* @
|
|
1668
|
+
* @returns Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`.
|
|
1669
|
+
*/
|
|
1670
|
+
function isReadable(stream: Readable | NodeJS.ReadableStream): boolean | null;
|
|
1671
|
+
/**
|
|
1672
|
+
* Returns whether the stream is writable.
|
|
1673
|
+
* @since v20.0.0
|
|
1674
|
+
* @returns Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`.
|
|
1654
1675
|
*/
|
|
1655
|
-
function
|
|
1676
|
+
function isWritable(stream: Writable | NodeJS.WritableStream): boolean | null;
|
|
1656
1677
|
}
|
|
1657
1678
|
export = Stream;
|
|
1658
1679
|
}
|
node/string_decoder.d.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* decoder.write(Buffer.from([0x82]));
|
|
37
37
|
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
|
|
38
38
|
* ```
|
|
39
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
39
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/string_decoder.js)
|
|
40
40
|
*/
|
|
41
41
|
declare module "string_decoder" {
|
|
42
42
|
class StringDecoder {
|
|
@@ -48,7 +48,7 @@ declare module "string_decoder" {
|
|
|
48
48
|
* @since v0.1.99
|
|
49
49
|
* @param buffer The bytes to decode.
|
|
50
50
|
*/
|
|
51
|
-
write(buffer: string |
|
|
51
|
+
write(buffer: string | NodeJS.ArrayBufferView): string;
|
|
52
52
|
/**
|
|
53
53
|
* Returns any remaining input stored in the internal buffer as a string. Bytes
|
|
54
54
|
* representing incomplete UTF-8 and UTF-16 characters will be replaced with
|
|
@@ -59,7 +59,7 @@ declare module "string_decoder" {
|
|
|
59
59
|
* @since v0.9.3
|
|
60
60
|
* @param buffer The bytes to decode.
|
|
61
61
|
*/
|
|
62
|
-
end(buffer?: string |
|
|
62
|
+
end(buffer?: string | NodeJS.ArrayBufferView): string;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
declare module "node:string_decoder" {
|