@types/node 16.11.7 → 16.11.11

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 CHANGED
@@ -8,9 +8,9 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 08 Nov 2021 21:31:28 GMT
11
+ * Last updated: Tue, 30 Nov 2021 01:01:04 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
15
15
  # Credits
16
- These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
16
+ These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Seth Westphal](https://github.com/westy92), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
node/dns/promises.d.ts CHANGED
@@ -331,6 +331,17 @@ declare module 'dns/promises' {
331
331
  * @param servers array of `RFC 5952` formatted addresses
332
332
  */
333
333
  function setServers(servers: ReadonlyArray<string>): void;
334
+ /**
335
+ * Set the default value of `verbatim` in {@link lookup}. The value could be:
336
+ * - `ipv4first`: sets default `verbatim` `false`.
337
+ * - `verbatim`: sets default `verbatim` `true`.
338
+ *
339
+ * The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
340
+ * When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
341
+ * @since v14.18.0
342
+ * @param order must be 'ipv4first' or 'verbatim'.
343
+ */
344
+ function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
334
345
  class Resolver {
335
346
  constructor(options?: ResolverOptions);
336
347
  cancel(): void;
node/dns.d.ts CHANGED
@@ -526,6 +526,17 @@ declare module 'dns' {
526
526
  * @since v0.11.3
527
527
  */
528
528
  export function getServers(): string[];
529
+ /**
530
+ * Set the default value of `verbatim` in {@link lookup}. The value could be:
531
+ * - `ipv4first`: sets default `verbatim` `false`.
532
+ * - `verbatim`: sets default `verbatim` `true`.
533
+ *
534
+ * The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
535
+ * When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
536
+ * @since v14.18.0
537
+ * @param order must be 'ipv4first' or 'verbatim'.
538
+ */
539
+ export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
529
540
  // Error codes
530
541
  export const NODATA: string;
531
542
  export const FORMERR: string;
node/fs.d.ts CHANGED
@@ -260,6 +260,29 @@ declare module 'fs' {
260
260
  */
261
261
  readSync(): Dirent | null;
262
262
  }
263
+ /**
264
+ * Class: fs.StatWatcher
265
+ * @since v14.3.0, v12.20.0
266
+ * Extends `EventEmitter`
267
+ * A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
268
+ */
269
+ export interface StatWatcher extends EventEmitter {
270
+ /**
271
+ * @since v14.3.0, v12.20.0
272
+ * When called, requests that the Node.js event loop not exit so long as the `fs.StatWatcher` is active.
273
+ * Calling `watcher.ref()` multiple times will have no effect.
274
+ * By default, all `fs.StatWatcher`` objects are "ref'ed", making it normally unnecessary to call `watcher.ref()`
275
+ * unless `watcher.unref()` had been called previously.
276
+ */
277
+ ref(): this;
278
+ /**
279
+ * @since v14.3.0, v12.20.0
280
+ * When called, the active `fs.StatWatcher`` object will not require the Node.js event loop to remain active.
281
+ * If there is no other activity keeping the event loop running, the process may exit before the `fs.StatWatcher`` object's callback is invoked.
282
+ * `Calling watcher.unref()` multiple times will have no effect.
283
+ */
284
+ unref(): this;
285
+ }
263
286
  export interface FSWatcher extends EventEmitter {
264
287
  /**
265
288
  * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
@@ -2784,21 +2807,34 @@ declare module 'fs' {
2784
2807
  * * the file is renamed and then renamed a second time back to its original name
2785
2808
  * @since v0.1.31
2786
2809
  */
2810
+ export interface WatchFileOptions {
2811
+ bigint?: boolean | undefined;
2812
+ persistent?: boolean | undefined;
2813
+ interval?: number | undefined;
2814
+ }
2787
2815
  export function watchFile(
2788
2816
  filename: PathLike,
2789
2817
  options:
2790
- | {
2791
- persistent?: boolean | undefined;
2792
- interval?: number | undefined;
2793
- }
2818
+ | (WatchFileOptions & {
2819
+ bigint?: false | undefined;
2820
+ })
2794
2821
  | undefined,
2795
2822
  listener: (curr: Stats, prev: Stats) => void
2796
- ): void;
2823
+ ): StatWatcher;
2824
+ export function watchFile(
2825
+ filename: PathLike,
2826
+ options:
2827
+ | (WatchFileOptions & {
2828
+ bigint: true;
2829
+ })
2830
+ | undefined,
2831
+ listener: (curr: BigIntStats, prev: BigIntStats) => void
2832
+ ): StatWatcher;
2797
2833
  /**
2798
2834
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
2799
2835
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2800
2836
  */
2801
- export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
2837
+ export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): StatWatcher;
2802
2838
  /**
2803
2839
  * Stop watching for changes on `filename`. If `listener` is specified, only that
2804
2840
  * particular listener is removed. Otherwise, _all_ listeners are removed,
node/http.d.ts CHANGED
@@ -42,7 +42,7 @@
42
42
  declare module 'http' {
43
43
  import * as stream from 'node:stream';
44
44
  import { URL } from 'node:url';
45
- import { Socket, Server as NetServer, LookupFunction } from 'node:net';
45
+ import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
46
46
  // incoming headers will never contain number
47
47
  interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
48
48
  accept?: string | undefined;
@@ -951,7 +951,7 @@ declare module 'http' {
951
951
  */
952
952
  destroy(error?: Error): void;
953
953
  }
954
- interface AgentOptions {
954
+ interface AgentOptions extends Partial<TcpSocketConnectOpts> {
955
955
  /**
956
956
  * Keep sockets around in a pool to be used by other requests in the future. Default = false
957
957
  */
node/index.d.ts CHANGED
@@ -21,6 +21,7 @@
21
21
  // Nikita Galkin <https://github.com/galkin>
22
22
  // Parambir Singh <https://github.com/parambirs>
23
23
  // Sebastian Silbermann <https://github.com/eps1lon>
24
+ // Seth Westphal <https://github.com/westy92>
24
25
  // Simon Schick <https://github.com/SimonSchick>
25
26
  // Thomas den Hollander <https://github.com/ThomasdenH>
26
27
  // Wilco Bakker <https://github.com/WilcoBakker>
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.11.7",
3
+ "version": "16.11.11",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -110,6 +110,11 @@
110
110
  "url": "https://github.com/eps1lon",
111
111
  "githubUsername": "eps1lon"
112
112
  },
113
+ {
114
+ "name": "Seth Westphal",
115
+ "url": "https://github.com/westy92",
116
+ "githubUsername": "westy92"
117
+ },
113
118
  {
114
119
  "name": "Simon Schick",
115
120
  "url": "https://github.com/SimonSchick",
@@ -220,6 +225,6 @@
220
225
  },
221
226
  "scripts": {},
222
227
  "dependencies": {},
223
- "typesPublisherContentHash": "f35526242fcaf9fa8ad50a3aadb0bb8c2e9aba5a332ca0523451167ec6a19f2e",
224
- "typeScriptVersion": "3.7"
228
+ "typesPublisherContentHash": "2c07ab3f15ad8f0250e091bd0ca3ffaa5918c556923138897e7eabf6ec03c778",
229
+ "typeScriptVersion": "3.8"
225
230
  }
node/process.d.ts CHANGED
@@ -94,7 +94,11 @@ declare module 'process' {
94
94
  type ExitListener = (code: number) => void;
95
95
  type RejectionHandledListener = (promise: Promise<unknown>) => void;
96
96
  type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
97
- type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<unknown>) => void;
97
+ /**
98
+ * Most of the time the unhandledRejection will be an Error, but this should not be relied upon
99
+ * as *anything* can be thrown/rejected, it is therefore unsafe to assume the the value is an Error.
100
+ */
101
+ type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
98
102
  type WarningListener = (warning: Error) => void;
99
103
  type MessageListener = (message: unknown, sendHandle: unknown) => void;
100
104
  type SignalsListener = (signal: Signals) => void;
node/stream/web.d.ts CHANGED
@@ -1,5 +1,390 @@
1
1
  declare module 'stream/web' {
2
2
  // stub module, pending copy&paste from .d.ts or manual impl
3
+ // copy from lib.dom.d.ts
4
+
5
+ interface ReadableWritablePair<R = any, W = any> {
6
+ readable: ReadableStream<R>;
7
+ /**
8
+ * Provides a convenient, chainable way of piping this readable stream
9
+ * through a transform stream (or any other { writable, readable }
10
+ * pair). It simply pipes the stream into the writable side of the
11
+ * supplied pair, and returns the readable side for further use.
12
+ *
13
+ * Piping a stream will lock it for the duration of the pipe, preventing
14
+ * any other consumer from acquiring a reader.
15
+ */
16
+ writable: WritableStream<W>;
17
+ }
18
+
19
+ interface StreamPipeOptions {
20
+ preventAbort?: boolean;
21
+ preventCancel?: boolean;
22
+ /**
23
+ * Pipes this readable stream to a given writable stream destination.
24
+ * The way in which the piping process behaves under various error
25
+ * conditions can be customized with a number of passed options. It
26
+ * returns a promise that fulfills when the piping process completes
27
+ * successfully, or rejects if any errors were encountered.
28
+ *
29
+ * Piping a stream will lock it for the duration of the pipe, preventing
30
+ * any other consumer from acquiring a reader.
31
+ *
32
+ * Errors and closures of the source and destination streams propagate
33
+ * as follows:
34
+ *
35
+ * An error in this source readable stream will abort destination,
36
+ * unless preventAbort is truthy. The returned promise will be rejected
37
+ * with the source's error, or with any error that occurs during
38
+ * aborting the destination.
39
+ *
40
+ * An error in destination will cancel this source readable stream,
41
+ * unless preventCancel is truthy. The returned promise will be rejected
42
+ * with the destination's error, or with any error that occurs during
43
+ * canceling the source.
44
+ *
45
+ * When this source readable stream closes, destination will be closed,
46
+ * unless preventClose is truthy. The returned promise will be fulfilled
47
+ * once this process completes, unless an error is encountered while
48
+ * closing the destination, in which case it will be rejected with that
49
+ * error.
50
+ *
51
+ * If destination starts out closed or closing, this source readable
52
+ * stream will be canceled, unless preventCancel is true. The returned
53
+ * promise will be rejected with an error indicating piping to a closed
54
+ * stream failed, or with any error that occurs during canceling the
55
+ * source.
56
+ *
57
+ * The signal option can be set to an AbortSignal to allow aborting an
58
+ * ongoing pipe operation via the corresponding AbortController. In this
59
+ * case, this source readable stream will be canceled, and destination
60
+ * aborted, unless the respective options preventCancel or preventAbort
61
+ * are set.
62
+ */
63
+ preventClose?: boolean;
64
+ signal?: AbortSignal;
65
+ }
66
+
67
+ interface ReadableStreamGenericReader {
68
+ readonly closed: Promise<undefined>;
69
+ cancel(reason?: any): Promise<void>;
70
+ }
71
+
72
+ interface ReadableStreamDefaultReadValueResult<T> {
73
+ done: false;
74
+ value: T;
75
+ }
76
+
77
+ interface ReadableStreamDefaultReadDoneResult {
78
+ done: true;
79
+ value?: undefined;
80
+ }
81
+ type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
82
+ type ReadableStreamDefaultReadResult<T> =
83
+ | ReadableStreamDefaultReadValueResult<T>
84
+ | ReadableStreamDefaultReadDoneResult;
85
+
86
+ interface ReadableByteStreamControllerCallback {
87
+ (controller: ReadableByteStreamController): void | PromiseLike<void>;
88
+ }
89
+
90
+ interface UnderlyingSinkAbortCallback {
91
+ (reason?: any): void | PromiseLike<void>;
92
+ }
93
+
94
+ interface UnderlyingSinkCloseCallback {
95
+ (): void | PromiseLike<void>;
96
+ }
97
+
98
+ interface UnderlyingSinkStartCallback {
99
+ (controller: WritableStreamDefaultController): any;
100
+ }
101
+
102
+ interface UnderlyingSinkWriteCallback<W> {
103
+ (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
104
+ }
105
+
106
+ interface UnderlyingSourceCancelCallback {
107
+ (reason?: any): void | PromiseLike<void>;
108
+ }
109
+
110
+ interface UnderlyingSourcePullCallback<R> {
111
+ (controller: ReadableStreamController<R>): void | PromiseLike<void>;
112
+ }
113
+
114
+ interface UnderlyingSourceStartCallback<R> {
115
+ (controller: ReadableStreamController<R>): any;
116
+ }
117
+
118
+ interface TransformerFlushCallback<O> {
119
+ (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
120
+ }
121
+
122
+ interface TransformerStartCallback<O> {
123
+ (controller: TransformStreamDefaultController<O>): any;
124
+ }
125
+
126
+ interface TransformerTransformCallback<I, O> {
127
+ (chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
128
+ }
129
+
130
+ interface UnderlyingByteSource {
131
+ autoAllocateChunkSize?: number;
132
+ cancel?: ReadableStreamErrorCallback;
133
+ pull?: ReadableByteStreamControllerCallback;
134
+ start?: ReadableByteStreamControllerCallback;
135
+ type: 'bytes';
136
+ }
137
+
138
+ interface UnderlyingSource<R = any> {
139
+ cancel?: UnderlyingSourceCancelCallback;
140
+ pull?: UnderlyingSourcePullCallback<R>;
141
+ start?: UnderlyingSourceStartCallback<R>;
142
+ type?: undefined;
143
+ }
144
+
145
+ interface UnderlyingSink<W = any> {
146
+ abort?: UnderlyingSinkAbortCallback;
147
+ close?: UnderlyingSinkCloseCallback;
148
+ start?: UnderlyingSinkStartCallback;
149
+ type?: undefined;
150
+ write?: UnderlyingSinkWriteCallback<W>;
151
+ }
152
+
153
+ interface ReadableStreamErrorCallback {
154
+ (reason: any): void | PromiseLike<void>;
155
+ }
156
+
157
+ /** This Streams API interface represents a readable stream of byte data. */
158
+ interface ReadableStream<R = any> {
159
+ readonly locked: boolean;
160
+ cancel(reason?: any): Promise<void>;
161
+ getReader(): ReadableStreamDefaultReader<R>;
162
+ pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
163
+ pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
164
+ tee(): [ReadableStream<R>, ReadableStream<R>];
165
+ [Symbol.asyncIterator](options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
166
+ }
167
+
168
+ const ReadableStream: {
169
+ prototype: ReadableStream;
170
+ new (
171
+ underlyingSource: UnderlyingByteSource,
172
+ strategy?: QueuingStrategy<Uint8Array>,
173
+ ): ReadableStream<Uint8Array>;
174
+ new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
175
+ };
176
+
177
+ interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
178
+ read(): Promise<ReadableStreamDefaultReadResult<R>>;
179
+ releaseLock(): void;
180
+ }
181
+
182
+ const ReadableStreamDefaultReader: {
183
+ prototype: ReadableStreamDefaultReader;
184
+ new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
185
+ };
186
+
187
+ const ReadableStreamBYOBReader: any;
188
+ const ReadableStreamBYOBRequest: any;
189
+
190
+ interface ReadableByteStreamController {
191
+ readonly byobRequest: undefined;
192
+ readonly desiredSize: number | null;
193
+ close(): void;
194
+ enqueue(chunk: ArrayBufferView): void;
195
+ error(error?: any): void;
196
+ }
197
+
198
+ const ReadableByteStreamController: {
199
+ prototype: ReadableByteStreamController;
200
+ new (): ReadableByteStreamController;
201
+ };
202
+
203
+ interface ReadableStreamDefaultController<R = any> {
204
+ readonly desiredSize: number | null;
205
+ close(): void;
206
+ enqueue(chunk?: R): void;
207
+ error(e?: any): void;
208
+ }
209
+
210
+ const ReadableStreamDefaultController: {
211
+ prototype: ReadableStreamDefaultController;
212
+ new (): ReadableStreamDefaultController;
213
+ };
214
+
215
+ interface Transformer<I = any, O = any> {
216
+ flush?: TransformerFlushCallback<O>;
217
+ readableType?: undefined;
218
+ start?: TransformerStartCallback<O>;
219
+ transform?: TransformerTransformCallback<I, O>;
220
+ writableType?: undefined;
221
+ }
222
+
223
+ interface TransformStream<I = any, O = any> {
224
+ readonly readable: ReadableStream<O>;
225
+ readonly writable: WritableStream<I>;
226
+ }
227
+
228
+ const TransformStream: {
229
+ prototype: TransformStream;
230
+ new <I = any, O = any>(
231
+ transformer?: Transformer<I, O>,
232
+ writableStrategy?: QueuingStrategy<I>,
233
+ readableStrategy?: QueuingStrategy<O>,
234
+ ): TransformStream<I, O>;
235
+ };
236
+
237
+ interface TransformStreamDefaultController<O = any> {
238
+ readonly desiredSize: number | null;
239
+ enqueue(chunk?: O): void;
240
+ error(reason?: any): void;
241
+ terminate(): void;
242
+ }
243
+
244
+ const TransformStreamDefaultController: {
245
+ prototype: TransformStreamDefaultController;
246
+ new (): TransformStreamDefaultController;
247
+ };
248
+
249
+ /**
250
+ * This Streams API interface provides a standard abstraction for writing
251
+ * streaming data to a destination, known as a sink. This object comes with
252
+ * built-in back pressure and queuing.
253
+ */
254
+ interface WritableStream<W = any> {
255
+ readonly locked: boolean;
256
+ abort(reason?: any): Promise<void>;
257
+ close(): Promise<void>;
258
+ getWriter(): WritableStreamDefaultWriter<W>;
259
+ }
260
+
261
+ const WritableStream: {
262
+ prototype: WritableStream;
263
+ new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
264
+ };
265
+
266
+ /**
267
+ * This Streams API interface is the object returned by
268
+ * WritableStream.getWriter() and once created locks the < writer to the
269
+ * WritableStream ensuring that no other streams can write to the underlying
270
+ * sink.
271
+ */
272
+ interface WritableStreamDefaultWriter<W = any> {
273
+ readonly closed: Promise<undefined>;
274
+ readonly desiredSize: number | null;
275
+ readonly ready: Promise<undefined>;
276
+ abort(reason?: any): Promise<void>;
277
+ close(): Promise<void>;
278
+ releaseLock(): void;
279
+ write(chunk?: W): Promise<void>;
280
+ }
281
+
282
+ const WritableStreamDefaultWriter: {
283
+ prototype: WritableStreamDefaultWriter;
284
+ new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
285
+ };
286
+
287
+ /**
288
+ * This Streams API interface represents a controller allowing control of a
289
+ * WritableStream's state. When constructing a WritableStream, the
290
+ * underlying sink is given a corresponding WritableStreamDefaultController
291
+ * instance to manipulate.
292
+ */
293
+ interface WritableStreamDefaultController {
294
+ error(e?: any): void;
295
+ }
296
+
297
+ const WritableStreamDefaultController: {
298
+ prototype: WritableStreamDefaultController;
299
+ new (): WritableStreamDefaultController;
300
+ };
301
+
302
+ interface QueuingStrategy<T = any> {
303
+ highWaterMark?: number;
304
+ size?: QueuingStrategySize<T>;
305
+ }
306
+
307
+ interface QueuingStrategySize<T = any> {
308
+ (chunk?: T): number;
309
+ }
310
+
311
+ interface QueuingStrategyInit {
312
+ /**
313
+ * Creates a new ByteLengthQueuingStrategy with the provided high water
314
+ * mark.
315
+ *
316
+ * Note that the provided high water mark will not be validated ahead of
317
+ * time. Instead, if it is negative, NaN, or not a number, the resulting
318
+ * ByteLengthQueuingStrategy will cause the corresponding stream
319
+ * constructor to throw.
320
+ */
321
+ highWaterMark: number;
322
+ }
323
+
324
+ /**
325
+ * This Streams API interface provides a built-in byte length queuing
326
+ * strategy that can be used when constructing streams.
327
+ */
328
+ interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
329
+ readonly highWaterMark: number;
330
+ readonly size: QueuingStrategySize<ArrayBufferView>;
331
+ }
332
+
333
+ const ByteLengthQueuingStrategy: {
334
+ prototype: ByteLengthQueuingStrategy;
335
+ new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
336
+ };
337
+
338
+ /**
339
+ * This Streams API interface provides a built-in byte length queuing
340
+ * strategy that can be used when constructing streams.
341
+ */
342
+ interface CountQueuingStrategy extends QueuingStrategy {
343
+ readonly highWaterMark: number;
344
+ readonly size: QueuingStrategySize;
345
+ }
346
+
347
+ const CountQueuingStrategy: {
348
+ prototype: CountQueuingStrategy;
349
+ new (init: QueuingStrategyInit): CountQueuingStrategy;
350
+ };
351
+
352
+ interface TextEncoderStream {
353
+ /** Returns "utf-8". */
354
+ readonly encoding: 'utf-8';
355
+ readonly readable: ReadableStream<Uint8Array>;
356
+ readonly writable: WritableStream<string>;
357
+ readonly [Symbol.toStringTag]: string;
358
+ }
359
+
360
+ const TextEncoderStream: {
361
+ prototype: TextEncoderStream;
362
+ new (): TextEncoderStream;
363
+ };
364
+
365
+ interface TextDecoderOptions {
366
+ fatal?: boolean;
367
+ ignoreBOM?: boolean;
368
+ }
369
+
370
+ type BufferSource = ArrayBufferView | ArrayBuffer;
371
+
372
+ interface TextDecoderStream {
373
+ /** Returns encoding's name, lower cased. */
374
+ readonly encoding: string;
375
+ /** Returns `true` if error mode is "fatal", and `false` otherwise. */
376
+ readonly fatal: boolean;
377
+ /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
378
+ readonly ignoreBOM: boolean;
379
+ readonly readable: ReadableStream<string>;
380
+ readonly writable: WritableStream<BufferSource>;
381
+ readonly [Symbol.toStringTag]: string;
382
+ }
383
+
384
+ const TextDecoderStream: {
385
+ prototype: TextDecoderStream;
386
+ new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
387
+ };
3
388
  }
4
389
  declare module 'node:stream/web' {
5
390
  export * from 'stream/web';