@node-red/editor-client 3.1.8 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/en-US/editor.json +10 -1
  3. package/locales/fr/editor.json +8 -1
  4. package/locales/ja/editor.json +10 -3
  5. package/package.json +1 -1
  6. package/public/red/about +52 -0
  7. package/public/red/red.js +1433 -263
  8. package/public/red/red.min.js +3 -3
  9. package/public/red/style.min.css +2 -2
  10. package/public/red/tours/3.1/welcome.js +231 -0
  11. package/public/red/tours/images/nr4-auto-complete.png +0 -0
  12. package/public/red/tours/images/nr4-config-select.png +0 -0
  13. package/public/red/tours/images/nr4-multiplayer.png +0 -0
  14. package/public/red/tours/images/nr4-plugins.png +0 -0
  15. package/public/red/tours/images/nr4-sf-config.png +0 -0
  16. package/public/red/tours/images/nr4-timestamp-formatting.png +0 -0
  17. package/public/red/tours/welcome.js +105 -161
  18. package/public/types/node/assert/strict.d.ts +1 -1
  19. package/public/types/node/assert.d.ts +8 -9
  20. package/public/types/node/async_hooks.d.ts +9 -5
  21. package/public/types/node/buffer.d.ts +43 -18
  22. package/public/types/node/child_process.d.ts +8 -5
  23. package/public/types/node/cluster.d.ts +15 -19
  24. package/public/types/node/console.d.ts +2 -2
  25. package/public/types/node/crypto.d.ts +165 -70
  26. package/public/types/node/dgram.d.ts +4 -4
  27. package/public/types/node/diagnostics_channel.d.ts +8 -7
  28. package/public/types/node/dns/promises.d.ts +11 -9
  29. package/public/types/node/dns.d.ts +18 -13
  30. package/public/types/node/dom-events.d.ts +129 -0
  31. package/public/types/node/domain.d.ts +2 -2
  32. package/public/types/node/events.d.ts +49 -12
  33. package/public/types/node/fs/promises.d.ts +68 -24
  34. package/public/types/node/fs.d.ts +132 -59
  35. package/public/types/node/globals.d.ts +31 -17
  36. package/public/types/node/http.d.ts +138 -27
  37. package/public/types/node/http2.d.ts +38 -5
  38. package/public/types/node/https.d.ts +12 -3
  39. package/public/types/node/module.d.ts +1 -2
  40. package/public/types/node/net.d.ts +69 -28
  41. package/public/types/node/os.d.ts +16 -5
  42. package/public/types/node/path.d.ts +5 -5
  43. package/public/types/node/perf_hooks.d.ts +48 -9
  44. package/public/types/node/process.d.ts +18 -17
  45. package/public/types/node/querystring.d.ts +2 -2
  46. package/public/types/node/readline/promises.d.ts +146 -0
  47. package/public/types/node/readline.d.ts +141 -31
  48. package/public/types/node/stream/consumers.d.ts +2 -2
  49. package/public/types/node/stream/promises.d.ts +1 -1
  50. package/public/types/node/stream/web.d.ts +4 -66
  51. package/public/types/node/stream.d.ts +96 -118
  52. package/public/types/node/string_decoder.d.ts +2 -2
  53. package/public/types/node/test.d.ts +200 -16
  54. package/public/types/node/timers/promises.d.ts +1 -26
  55. package/public/types/node/timers.d.ts +2 -2
  56. package/public/types/node/tls.d.ts +21 -12
  57. package/public/types/node/trace_events.d.ts +12 -2
  58. package/public/types/node/ts4.8/assert/strict.d.ts +11 -0
  59. package/public/types/node/ts4.8/assert.d.ts +964 -0
  60. package/public/types/node/ts4.8/async_hooks.d.ts +504 -0
  61. package/public/types/node/ts4.8/buffer.d.ts +2262 -0
  62. package/public/types/node/ts4.8/child_process.d.ts +1372 -0
  63. package/public/types/node/ts4.8/cluster.d.ts +413 -0
  64. package/public/types/node/ts4.8/console.d.ts +415 -0
  65. package/public/types/node/ts4.8/crypto.d.ts +3967 -0
  66. package/public/types/node/ts4.8/dgram.d.ts +548 -0
  67. package/public/types/node/ts4.8/diagnostics_channel.d.ts +156 -0
  68. package/public/types/node/ts4.8/dns/promises.d.ts +373 -0
  69. package/public/types/node/ts4.8/dns.d.ts +662 -0
  70. package/public/types/node/ts4.8/dom-events.d.ts +129 -0
  71. package/public/types/node/ts4.8/domain.d.ts +173 -0
  72. package/public/types/node/ts4.8/events.d.ts +681 -0
  73. package/public/types/node/ts4.8/fs/promises.d.ts +1141 -0
  74. package/public/types/node/ts4.8/fs.d.ts +3875 -0
  75. package/public/types/node/ts4.8/globals.d.ts +297 -0
  76. package/public/types/node/ts4.8/http.d.ts +1617 -0
  77. package/public/types/node/ts4.8/http2.d.ts +2137 -0
  78. package/public/types/node/ts4.8/https.d.ts +544 -0
  79. package/public/types/node/ts4.8/module.d.ts +117 -0
  80. package/public/types/node/ts4.8/net.d.ts +872 -0
  81. package/public/types/node/ts4.8/os.d.ts +469 -0
  82. package/public/types/node/ts4.8/path.d.ts +194 -0
  83. package/public/types/node/ts4.8/perf_hooks.d.ts +628 -0
  84. package/public/types/node/ts4.8/process.d.ts +1485 -0
  85. package/public/types/node/ts4.8/querystring.d.ts +134 -0
  86. package/public/types/node/ts4.8/readline/promises.d.ts +146 -0
  87. package/public/types/node/ts4.8/readline.d.ts +656 -0
  88. package/public/types/node/ts4.8/stream/consumers.d.ts +15 -0
  89. package/public/types/node/ts4.8/stream/promises.d.ts +45 -0
  90. package/public/types/node/ts4.8/stream/web.d.ts +333 -0
  91. package/public/types/node/ts4.8/stream.d.ts +1343 -0
  92. package/public/types/node/ts4.8/string_decoder.d.ts +70 -0
  93. package/public/types/node/ts4.8/test.d.ts +377 -0
  94. package/public/types/node/ts4.8/timers/promises.d.ts +71 -0
  95. package/public/types/node/ts4.8/timers.d.ts +97 -0
  96. package/public/types/node/ts4.8/tls.d.ts +1031 -0
  97. package/public/types/node/ts4.8/trace_events.d.ts +174 -0
  98. package/public/types/node/ts4.8/tty.d.ts +209 -0
  99. package/public/types/node/ts4.8/url.d.ts +900 -0
  100. package/public/types/node/ts4.8/util.d.ts +1853 -0
  101. package/public/types/node/ts4.8/v8.d.ts +399 -0
  102. package/public/types/node/ts4.8/vm.d.ts +512 -0
  103. package/public/types/node/ts4.8/wasi.d.ts +161 -0
  104. package/public/types/node/ts4.8/worker_threads.d.ts +692 -0
  105. package/public/types/node/ts4.8/zlib.d.ts +520 -0
  106. package/public/types/node/tty.d.ts +5 -3
  107. package/public/types/node/url.d.ts +81 -39
  108. package/public/types/node/util.d.ts +269 -13
  109. package/public/types/node/v8.d.ts +22 -4
  110. package/public/types/node/vm.d.ts +7 -5
  111. package/public/types/node/wasi.d.ts +2 -2
  112. package/public/types/node/worker_threads.d.ts +51 -11
  113. package/public/types/node/zlib.d.ts +2 -2
  114. package/public/types/node-red/func.d.ts +26 -17
  115. package/public/vendor/ace/worker-jsonata.js +1 -1
  116. package/public/vendor/monaco/dist/{fa2cc0ab9f0bec2b3365.ttf → 0c718f5b7d2bce997c5f.ttf} +0 -0
  117. package/public/vendor/monaco/dist/css.worker.js +1 -1
  118. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  119. package/public/vendor/monaco/dist/editor.js +1 -29
  120. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +2 -2
  121. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  122. package/public/vendor/monaco/dist/html.worker.js +1 -1
  123. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  124. package/public/vendor/monaco/dist/json.worker.js +1 -1
  125. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  126. package/public/vendor/monaco/dist/locale/cs.js +324 -106
  127. package/public/vendor/monaco/dist/locale/de.js +336 -118
  128. package/public/vendor/monaco/dist/locale/es.js +329 -111
  129. package/public/vendor/monaco/dist/locale/fr.js +334 -116
  130. package/public/vendor/monaco/dist/locale/it.js +327 -109
  131. package/public/vendor/monaco/dist/locale/ja.js +329 -111
  132. package/public/vendor/monaco/dist/locale/ko.js +330 -112
  133. package/public/vendor/monaco/dist/locale/pl.js +329 -111
  134. package/public/vendor/monaco/dist/locale/pt-br.js +329 -111
  135. package/public/vendor/monaco/dist/locale/qps-ploc.js +330 -112
  136. package/public/vendor/monaco/dist/locale/ru.js +331 -113
  137. package/public/vendor/monaco/dist/locale/tr.js +329 -111
  138. package/public/vendor/monaco/dist/locale/zh-hans.js +331 -113
  139. package/public/vendor/monaco/dist/locale/zh-hant.js +331 -113
  140. package/public/vendor/monaco/dist/ts.worker.js +2 -2
  141. package/public/vendor/vendor.js +1 -1
  142. package/public/vendor/monaco/dist/7064e66c3890a12c47b4.ttf +0 -0
  143. /package/public/red/tours/{images → 3.1/images}/context-menu.png +0 -0
  144. /package/public/red/tours/{images → 3.1/images}/global-env-vars.png +0 -0
  145. /package/public/red/tours/{images → 3.1/images}/hiding-flows.png +0 -0
  146. /package/public/red/tours/{images → 3.1/images}/locking-flows.png +0 -0
  147. /package/public/red/tours/{images → 3.1/images}/mermaid.png +0 -0
  148. /package/public/red/tours/{images → 3.1/images}/node-help.png +0 -0
  149. /package/public/red/tours/{images → 3.1/images}/tab-changes.png +0 -0
@@ -0,0 +1,1343 @@
1
+
2
+ /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
3
+
4
+ /**
5
+ * A stream is an abstract interface for working with streaming data in Node.js.
6
+ * The `stream` module provides an API for implementing the stream interface.
7
+ *
8
+ * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances.
9
+ *
10
+ * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
11
+ *
12
+ * To access the `stream` module:
13
+ *
14
+ * ```js
15
+ * const stream = require('stream');
16
+ * ```
17
+ *
18
+ * The `stream` module is useful for creating new types of stream instances. It is
19
+ * usually not necessary to use the `stream` module to consume streams.
20
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/stream.js)
21
+ */
22
+ declare module 'stream' {
23
+ import { EventEmitter, Abortable } from 'node:events';
24
+ import { Blob as NodeBlob } from "node:buffer";
25
+ import * as streamPromises from 'node:stream/promises';
26
+ import * as streamConsumers from 'node:stream/consumers';
27
+ import * as streamWeb from 'node:stream/web';
28
+ class internal extends EventEmitter {
29
+ pipe<T extends NodeJS.WritableStream>(
30
+ destination: T,
31
+ options?: {
32
+ end?: boolean | undefined;
33
+ }
34
+ ): T;
35
+ }
36
+ namespace internal {
37
+ class Stream extends internal {
38
+ constructor(opts?: ReadableOptions);
39
+ }
40
+ interface StreamOptions<T extends Stream> extends Abortable {
41
+ emitClose?: boolean | undefined;
42
+ highWaterMark?: number | undefined;
43
+ objectMode?: boolean | undefined;
44
+ construct?(this: T, callback: (error?: Error | null) => void): void;
45
+ destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void;
46
+ autoDestroy?: boolean | undefined;
47
+ }
48
+ interface ReadableOptions extends StreamOptions<Readable> {
49
+ encoding?: BufferEncoding | undefined;
50
+ read?(this: Readable, size: number): void;
51
+ }
52
+ /**
53
+ * @since v0.9.4
54
+ */
55
+ class Readable extends Stream implements NodeJS.ReadableStream {
56
+ /**
57
+ * A utility method for creating Readable Streams out of iterators.
58
+ */
59
+ static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
60
+ /**
61
+ * A utility method for creating a `Readable` from a web `ReadableStream`.
62
+ * @since v17.0.0
63
+ * @experimental
64
+ */
65
+ static fromWeb(readableStream: streamWeb.ReadableStream, options?: Pick<ReadableOptions, 'encoding' | 'highWaterMark' | 'objectMode' | 'signal'>): Readable;
66
+ /**
67
+ * Returns whether the stream has been read from or cancelled.
68
+ * @since v16.8.0
69
+ */
70
+ static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
71
+ /**
72
+ * A utility method for creating a web `ReadableStream` from a `Readable`.
73
+ * @since v17.0.0
74
+ * @experimental
75
+ */
76
+ static toWeb(streamReadable: Readable): streamWeb.ReadableStream;
77
+ /**
78
+ * Returns whether the stream was destroyed or errored before emitting `'end'`.
79
+ * @since v16.8.0
80
+ * @experimental
81
+ */
82
+ readonly readableAborted: boolean;
83
+ /**
84
+ * Is `true` if it is safe to call `readable.read()`, which means
85
+ * the stream has not been destroyed or emitted `'error'` or `'end'`.
86
+ * @since v11.4.0
87
+ */
88
+ readable: boolean;
89
+ /**
90
+ * Returns whether `'data'` has been emitted.
91
+ * @since v16.7.0, v14.18.0
92
+ * @experimental
93
+ */
94
+ readonly readableDidRead: boolean;
95
+ /**
96
+ * Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method.
97
+ * @since v12.7.0
98
+ */
99
+ readonly readableEncoding: BufferEncoding | null;
100
+ /**
101
+ * Becomes `true` when `'end'` event is emitted.
102
+ * @since v12.9.0
103
+ */
104
+ readonly readableEnded: boolean;
105
+ /**
106
+ * This property reflects the current state of a `Readable` stream as described
107
+ * in the `Three states` section.
108
+ * @since v9.4.0
109
+ */
110
+ readonly readableFlowing: boolean | null;
111
+ /**
112
+ * Returns the value of `highWaterMark` passed when creating this `Readable`.
113
+ * @since v9.3.0
114
+ */
115
+ readonly readableHighWaterMark: number;
116
+ /**
117
+ * This property contains the number of bytes (or objects) in the queue
118
+ * ready to be read. The value provides introspection data regarding
119
+ * the status of the `highWaterMark`.
120
+ * @since v9.4.0
121
+ */
122
+ readonly readableLength: number;
123
+ /**
124
+ * Getter for the property `objectMode` of a given `Readable` stream.
125
+ * @since v12.3.0
126
+ */
127
+ readonly readableObjectMode: boolean;
128
+ /**
129
+ * Is `true` after `readable.destroy()` has been called.
130
+ * @since v18.0.0
131
+ */
132
+ destroyed: boolean;
133
+ /**
134
+ * Is true after 'close' has been emitted.
135
+ * @since v8.0.0
136
+ */
137
+ readonly closed: boolean;
138
+ /**
139
+ * Returns error if the stream has been destroyed with an error.
140
+ * @since v18.0.0
141
+ */
142
+ readonly errored: Error | null;
143
+ constructor(opts?: ReadableOptions);
144
+ _construct?(callback: (error?: Error | null) => void): void;
145
+ _read(size: number): void;
146
+ /**
147
+ * The `readable.read()` method reads data out of the internal buffer and
148
+ * returns it. If no data is available to be read, `null` is returned. By default,
149
+ * the data is returned as a `Buffer` object unless an encoding has been
150
+ * specified using the `readable.setEncoding()` method or the stream is operating
151
+ * in object mode.
152
+ *
153
+ * The optional `size` argument specifies a specific number of bytes to read. If`size` bytes are not available to be read, `null` will be returned _unless_the stream has ended, in which
154
+ * case all of the data remaining in the internal
155
+ * buffer will be returned.
156
+ *
157
+ * If the `size` argument is not specified, all of the data contained in the
158
+ * internal buffer will be returned.
159
+ *
160
+ * The `size` argument must be less than or equal to 1 GiB.
161
+ *
162
+ * The `readable.read()` method should only be called on `Readable` streams
163
+ * operating in paused mode. In flowing mode, `readable.read()` is called
164
+ * automatically until the internal buffer is fully drained.
165
+ *
166
+ * ```js
167
+ * const readable = getReadableStreamSomehow();
168
+ *
169
+ * // 'readable' may be triggered multiple times as data is buffered in
170
+ * readable.on('readable', () => {
171
+ * let chunk;
172
+ * console.log('Stream is readable (new data received in buffer)');
173
+ * // Use a loop to make sure we read all currently available data
174
+ * while (null !== (chunk = readable.read())) {
175
+ * console.log(`Read ${chunk.length} bytes of data...`);
176
+ * }
177
+ * });
178
+ *
179
+ * // 'end' will be triggered once when there is no more data available
180
+ * readable.on('end', () => {
181
+ * console.log('Reached end of stream.');
182
+ * });
183
+ * ```
184
+ *
185
+ * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks
186
+ * are not concatenated. A `while` loop is necessary to consume all data
187
+ * currently in the buffer. When reading a large file `.read()` may return `null`,
188
+ * having consumed all buffered content so far, but there is still more data to
189
+ * come not yet buffered. In this case a new `'readable'` event will be emitted
190
+ * when there is more data in the buffer. Finally the `'end'` event will be
191
+ * emitted when there is no more data to come.
192
+ *
193
+ * Therefore to read a file's whole contents from a `readable`, it is necessary
194
+ * to collect chunks across multiple `'readable'` events:
195
+ *
196
+ * ```js
197
+ * const chunks = [];
198
+ *
199
+ * readable.on('readable', () => {
200
+ * let chunk;
201
+ * while (null !== (chunk = readable.read())) {
202
+ * chunks.push(chunk);
203
+ * }
204
+ * });
205
+ *
206
+ * readable.on('end', () => {
207
+ * const content = chunks.join('');
208
+ * });
209
+ * ```
210
+ *
211
+ * A `Readable` stream in object mode will always return a single item from
212
+ * a call to `readable.read(size)`, regardless of the value of the`size` argument.
213
+ *
214
+ * If the `readable.read()` method returns a chunk of data, a `'data'` event will
215
+ * also be emitted.
216
+ *
217
+ * Calling {@link read} after the `'end'` event has
218
+ * been emitted will return `null`. No runtime error will be raised.
219
+ * @since v0.9.4
220
+ * @param size Optional argument to specify how much data to read.
221
+ */
222
+ read(size?: number): any;
223
+ /**
224
+ * The `readable.setEncoding()` method sets the character encoding for
225
+ * data read from the `Readable` stream.
226
+ *
227
+ * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data
228
+ * to be returned as strings of the specified encoding rather than as `Buffer`objects. For instance, calling `readable.setEncoding('utf8')` will cause the
229
+ * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal
230
+ * string format.
231
+ *
232
+ * The `Readable` stream will properly handle multi-byte characters delivered
233
+ * through the stream that would otherwise become improperly decoded if simply
234
+ * pulled from the stream as `Buffer` objects.
235
+ *
236
+ * ```js
237
+ * const readable = getReadableStreamSomehow();
238
+ * readable.setEncoding('utf8');
239
+ * readable.on('data', (chunk) => {
240
+ * assert.equal(typeof chunk, 'string');
241
+ * console.log('Got %d characters of string data:', chunk.length);
242
+ * });
243
+ * ```
244
+ * @since v0.9.4
245
+ * @param encoding The encoding to use.
246
+ */
247
+ setEncoding(encoding: BufferEncoding): this;
248
+ /**
249
+ * The `readable.pause()` method will cause a stream in flowing mode to stop
250
+ * emitting `'data'` events, switching out of flowing mode. Any data that
251
+ * becomes available will remain in the internal buffer.
252
+ *
253
+ * ```js
254
+ * const readable = getReadableStreamSomehow();
255
+ * readable.on('data', (chunk) => {
256
+ * console.log(`Received ${chunk.length} bytes of data.`);
257
+ * readable.pause();
258
+ * console.log('There will be no additional data for 1 second.');
259
+ * setTimeout(() => {
260
+ * console.log('Now data will start flowing again.');
261
+ * readable.resume();
262
+ * }, 1000);
263
+ * });
264
+ * ```
265
+ *
266
+ * The `readable.pause()` method has no effect if there is a `'readable'`event listener.
267
+ * @since v0.9.4
268
+ */
269
+ pause(): this;
270
+ /**
271
+ * The `readable.resume()` method causes an explicitly paused `Readable` stream to
272
+ * resume emitting `'data'` events, switching the stream into flowing mode.
273
+ *
274
+ * The `readable.resume()` method can be used to fully consume the data from a
275
+ * stream without actually processing any of that data:
276
+ *
277
+ * ```js
278
+ * getReadableStreamSomehow()
279
+ * .resume()
280
+ * .on('end', () => {
281
+ * console.log('Reached the end, but did not read anything.');
282
+ * });
283
+ * ```
284
+ *
285
+ * The `readable.resume()` method has no effect if there is a `'readable'`event listener.
286
+ * @since v0.9.4
287
+ */
288
+ resume(): this;
289
+ /**
290
+ * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most
291
+ * typical cases, there will be no reason to
292
+ * use this method directly.
293
+ *
294
+ * ```js
295
+ * const readable = new stream.Readable();
296
+ *
297
+ * readable.isPaused(); // === false
298
+ * readable.pause();
299
+ * readable.isPaused(); // === true
300
+ * readable.resume();
301
+ * readable.isPaused(); // === false
302
+ * ```
303
+ * @since v0.11.14
304
+ */
305
+ isPaused(): boolean;
306
+ /**
307
+ * The `readable.unpipe()` method detaches a `Writable` stream previously attached
308
+ * using the {@link pipe} method.
309
+ *
310
+ * If the `destination` is not specified, then _all_ pipes are detached.
311
+ *
312
+ * If the `destination` is specified, but no pipe is set up for it, then
313
+ * the method does nothing.
314
+ *
315
+ * ```js
316
+ * const fs = require('fs');
317
+ * const readable = getReadableStreamSomehow();
318
+ * const writable = fs.createWriteStream('file.txt');
319
+ * // All the data from readable goes into 'file.txt',
320
+ * // but only for the first second.
321
+ * readable.pipe(writable);
322
+ * setTimeout(() => {
323
+ * console.log('Stop writing to file.txt.');
324
+ * readable.unpipe(writable);
325
+ * console.log('Manually close the file stream.');
326
+ * writable.end();
327
+ * }, 1000);
328
+ * ```
329
+ * @since v0.9.4
330
+ * @param destination Optional specific stream to unpipe
331
+ */
332
+ unpipe(destination?: NodeJS.WritableStream): this;
333
+ /**
334
+ * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the
335
+ * same as `readable.push(null)`, after which no more data can be written. The EOF
336
+ * signal is put at the end of the buffer and any buffered data will still be
337
+ * flushed.
338
+ *
339
+ * The `readable.unshift()` method pushes a chunk of data back into the internal
340
+ * buffer. This is useful in certain situations where a stream is being consumed by
341
+ * code that needs to "un-consume" some amount of data that it has optimistically
342
+ * pulled out of the source, so that the data can be passed on to some other party.
343
+ *
344
+ * The `stream.unshift(chunk)` method cannot be called after the `'end'` event
345
+ * has been emitted or a runtime error will be thrown.
346
+ *
347
+ * Developers using `stream.unshift()` often should consider switching to
348
+ * use of a `Transform` stream instead. See the `API for stream implementers` section for more information.
349
+ *
350
+ * ```js
351
+ * // Pull off a header delimited by \n\n.
352
+ * // Use unshift() if we get too much.
353
+ * // Call the callback with (error, header, stream).
354
+ * const { StringDecoder } = require('string_decoder');
355
+ * function parseHeader(stream, callback) {
356
+ * stream.on('error', callback);
357
+ * stream.on('readable', onReadable);
358
+ * const decoder = new StringDecoder('utf8');
359
+ * let header = '';
360
+ * function onReadable() {
361
+ * let chunk;
362
+ * while (null !== (chunk = stream.read())) {
363
+ * const str = decoder.write(chunk);
364
+ * if (str.includes('\n\n')) {
365
+ * // Found the header boundary.
366
+ * const split = str.split(/\n\n/);
367
+ * header += split.shift();
368
+ * const remaining = split.join('\n\n');
369
+ * const buf = Buffer.from(remaining, 'utf8');
370
+ * stream.removeListener('error', callback);
371
+ * // Remove the 'readable' listener before unshifting.
372
+ * stream.removeListener('readable', onReadable);
373
+ * if (buf.length)
374
+ * stream.unshift(buf);
375
+ * // Now the body of the message can be read from the stream.
376
+ * callback(null, header, stream);
377
+ * return;
378
+ * }
379
+ * // Still reading the header.
380
+ * header += str;
381
+ * }
382
+ * }
383
+ * }
384
+ * ```
385
+ *
386
+ * Unlike {@link push}, `stream.unshift(chunk)` will not
387
+ * end the reading process by resetting the internal reading state of the stream.
388
+ * This can cause unexpected results if `readable.unshift()` is called during a
389
+ * read (i.e. from within a {@link _read} implementation on a
390
+ * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately,
391
+ * however it is best to simply avoid calling `readable.unshift()` while in the
392
+ * process of performing a read.
393
+ * @since v0.9.11
394
+ * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a string, `Buffer`, `Uint8Array` or `null`. For object mode
395
+ * streams, `chunk` may be any JavaScript value.
396
+ * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`.
397
+ */
398
+ unshift(chunk: any, encoding?: BufferEncoding): void;
399
+ /**
400
+ * Prior to Node.js 0.10, streams did not implement the entire `stream` module API
401
+ * as it is currently defined. (See `Compatibility` for more information.)
402
+ *
403
+ * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable`
404
+ * stream that uses
405
+ * the old stream as its data source.
406
+ *
407
+ * It will rarely be necessary to use `readable.wrap()` but the method has been
408
+ * provided as a convenience for interacting with older Node.js applications and
409
+ * libraries.
410
+ *
411
+ * ```js
412
+ * const { OldReader } = require('./old-api-module.js');
413
+ * const { Readable } = require('stream');
414
+ * const oreader = new OldReader();
415
+ * const myReader = new Readable().wrap(oreader);
416
+ *
417
+ * myReader.on('readable', () => {
418
+ * myReader.read(); // etc.
419
+ * });
420
+ * ```
421
+ * @since v0.9.4
422
+ * @param stream An "old style" readable stream
423
+ */
424
+ wrap(stream: NodeJS.ReadableStream): this;
425
+ push(chunk: any, encoding?: BufferEncoding): boolean;
426
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
427
+ /**
428
+ * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
429
+ * stream will release any internal resources and subsequent calls to `push()`will be ignored.
430
+ *
431
+ * Once `destroy()` has been called any further calls will be a no-op and no
432
+ * further errors except from `_destroy()` may be emitted as `'error'`.
433
+ *
434
+ * Implementors should not override this method, but instead implement `readable._destroy()`.
435
+ * @since v8.0.0
436
+ * @param error Error which will be passed as payload in `'error'` event
437
+ */
438
+ destroy(error?: Error): this;
439
+ /**
440
+ * Event emitter
441
+ * The defined events on documents including:
442
+ * 1. close
443
+ * 2. data
444
+ * 3. end
445
+ * 4. error
446
+ * 5. pause
447
+ * 6. readable
448
+ * 7. resume
449
+ */
450
+ addListener(event: 'close', listener: () => void): this;
451
+ addListener(event: 'data', listener: (chunk: any) => void): this;
452
+ addListener(event: 'end', listener: () => void): this;
453
+ addListener(event: 'error', listener: (err: Error) => void): this;
454
+ addListener(event: 'pause', listener: () => void): this;
455
+ addListener(event: 'readable', listener: () => void): this;
456
+ addListener(event: 'resume', listener: () => void): this;
457
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
458
+ emit(event: 'close'): boolean;
459
+ emit(event: 'data', chunk: any): boolean;
460
+ emit(event: 'end'): boolean;
461
+ emit(event: 'error', err: Error): boolean;
462
+ emit(event: 'pause'): boolean;
463
+ emit(event: 'readable'): boolean;
464
+ emit(event: 'resume'): boolean;
465
+ emit(event: string | symbol, ...args: any[]): boolean;
466
+ on(event: 'close', listener: () => void): this;
467
+ on(event: 'data', listener: (chunk: any) => void): this;
468
+ on(event: 'end', listener: () => void): this;
469
+ on(event: 'error', listener: (err: Error) => void): this;
470
+ on(event: 'pause', listener: () => void): this;
471
+ on(event: 'readable', listener: () => void): this;
472
+ on(event: 'resume', listener: () => void): this;
473
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
474
+ once(event: 'close', listener: () => void): this;
475
+ once(event: 'data', listener: (chunk: any) => void): this;
476
+ once(event: 'end', listener: () => void): this;
477
+ once(event: 'error', listener: (err: Error) => void): this;
478
+ once(event: 'pause', listener: () => void): this;
479
+ once(event: 'readable', listener: () => void): this;
480
+ once(event: 'resume', listener: () => void): this;
481
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
482
+ prependListener(event: 'close', listener: () => void): this;
483
+ prependListener(event: 'data', listener: (chunk: any) => void): this;
484
+ prependListener(event: 'end', listener: () => void): this;
485
+ prependListener(event: 'error', listener: (err: Error) => void): this;
486
+ prependListener(event: 'pause', listener: () => void): this;
487
+ prependListener(event: 'readable', listener: () => void): this;
488
+ prependListener(event: 'resume', listener: () => void): this;
489
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
490
+ prependOnceListener(event: 'close', listener: () => void): this;
491
+ prependOnceListener(event: 'data', listener: (chunk: any) => void): this;
492
+ prependOnceListener(event: 'end', listener: () => void): this;
493
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
494
+ prependOnceListener(event: 'pause', listener: () => void): this;
495
+ prependOnceListener(event: 'readable', listener: () => void): this;
496
+ prependOnceListener(event: 'resume', listener: () => void): this;
497
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
498
+ removeListener(event: 'close', listener: () => void): this;
499
+ removeListener(event: 'data', listener: (chunk: any) => void): this;
500
+ removeListener(event: 'end', listener: () => void): this;
501
+ removeListener(event: 'error', listener: (err: Error) => void): this;
502
+ removeListener(event: 'pause', listener: () => void): this;
503
+ removeListener(event: 'readable', listener: () => void): this;
504
+ removeListener(event: 'resume', listener: () => void): this;
505
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
506
+ [Symbol.asyncIterator](): AsyncIterableIterator<any>;
507
+ }
508
+ interface WritableOptions extends StreamOptions<Writable> {
509
+ decodeStrings?: boolean | undefined;
510
+ defaultEncoding?: BufferEncoding | undefined;
511
+ write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
512
+ writev?(
513
+ this: Writable,
514
+ chunks: Array<{
515
+ chunk: any;
516
+ encoding: BufferEncoding;
517
+ }>,
518
+ callback: (error?: Error | null) => void
519
+ ): void;
520
+ final?(this: Writable, callback: (error?: Error | null) => void): void;
521
+ }
522
+ /**
523
+ * @since v0.9.4
524
+ */
525
+ class Writable extends Stream implements NodeJS.WritableStream {
526
+ /**
527
+ * A utility method for creating a `Writable` from a web `WritableStream`.
528
+ * @since v17.0.0
529
+ * @experimental
530
+ */
531
+ static fromWeb(writableStream: streamWeb.WritableStream, options?: Pick<WritableOptions, 'decodeStrings' | 'highWaterMark' | 'objectMode' | 'signal'>): Writable;
532
+ /**
533
+ * A utility method for creating a web `WritableStream` from a `Writable`.
534
+ * @since v17.0.0
535
+ * @experimental
536
+ */
537
+ static toWeb(streamWritable: Writable): streamWeb.WritableStream;
538
+ /**
539
+ * Is `true` if it is safe to call `writable.write()`, which means
540
+ * the stream has not been destroyed, errored or ended.
541
+ * @since v11.4.0
542
+ */
543
+ readonly writable: boolean;
544
+ /**
545
+ * Is `true` after `writable.end()` has been called. This property
546
+ * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.
547
+ * @since v12.9.0
548
+ */
549
+ readonly writableEnded: boolean;
550
+ /**
551
+ * Is set to `true` immediately before the `'finish'` event is emitted.
552
+ * @since v12.6.0
553
+ */
554
+ readonly writableFinished: boolean;
555
+ /**
556
+ * Return the value of `highWaterMark` passed when creating this `Writable`.
557
+ * @since v9.3.0
558
+ */
559
+ readonly writableHighWaterMark: number;
560
+ /**
561
+ * This property contains the number of bytes (or objects) in the queue
562
+ * ready to be written. The value provides introspection data regarding
563
+ * the status of the `highWaterMark`.
564
+ * @since v9.4.0
565
+ */
566
+ readonly writableLength: number;
567
+ /**
568
+ * Getter for the property `objectMode` of a given `Writable` stream.
569
+ * @since v12.3.0
570
+ */
571
+ readonly writableObjectMode: boolean;
572
+ /**
573
+ * Number of times `writable.uncork()` needs to be
574
+ * called in order to fully uncork the stream.
575
+ * @since v13.2.0, v12.16.0
576
+ */
577
+ readonly writableCorked: number;
578
+ /**
579
+ * Is `true` after `writable.destroy()` has been called.
580
+ * @since v8.0.0
581
+ */
582
+ destroyed: boolean;
583
+ /**
584
+ * Is true after 'close' has been emitted.
585
+ * @since v8.0.0
586
+ */
587
+ readonly closed: boolean;
588
+ /**
589
+ * Returns error if the stream has been destroyed with an error.
590
+ * @since v18.0.0
591
+ */
592
+ readonly errored: Error | null;
593
+ /**
594
+ * Is `true` if the stream's buffer has been full and stream will emit 'drain'.
595
+ * @since v15.2.0, v14.17.0
596
+ */
597
+ readonly writableNeedDrain: boolean;
598
+ constructor(opts?: WritableOptions);
599
+ _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
600
+ _writev?(
601
+ chunks: Array<{
602
+ chunk: any;
603
+ encoding: BufferEncoding;
604
+ }>,
605
+ callback: (error?: Error | null) => void
606
+ ): void;
607
+ _construct?(callback: (error?: Error | null) => void): void;
608
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
609
+ _final(callback: (error?: Error | null) => void): void;
610
+ /**
611
+ * The `writable.write()` method writes some data to the stream, and calls the
612
+ * supplied `callback` once the data has been fully handled. If an error
613
+ * occurs, the `callback` will be called with the error as its
614
+ * first argument. The `callback` is called asynchronously and before `'error'` is
615
+ * emitted.
616
+ *
617
+ * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`.
618
+ * If `false` is returned, further attempts to write data to the stream should
619
+ * stop until the `'drain'` event is emitted.
620
+ *
621
+ * While a stream is not draining, calls to `write()` will buffer `chunk`, and
622
+ * return false. Once all currently buffered chunks are drained (accepted for
623
+ * delivery by the operating system), the `'drain'` event will be emitted.
624
+ * Once `write()` returns false, do not write more chunks
625
+ * until the `'drain'` event is emitted. While calling `write()` on a stream that
626
+ * is not draining is allowed, Node.js will buffer all written chunks until
627
+ * maximum memory usage occurs, at which point it will abort unconditionally.
628
+ * Even before it aborts, high memory usage will cause poor garbage collector
629
+ * performance and high RSS (which is not typically released back to the system,
630
+ * even after the memory is no longer required). Since TCP sockets may never
631
+ * drain if the remote peer does not read the data, writing a socket that is
632
+ * not draining may lead to a remotely exploitable vulnerability.
633
+ *
634
+ * Writing data while the stream is not draining is particularly
635
+ * problematic for a `Transform`, because the `Transform` streams are paused
636
+ * by default until they are piped or a `'data'` or `'readable'` event handler
637
+ * is added.
638
+ *
639
+ * If the data to be written can be generated or fetched on demand, it is
640
+ * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is
641
+ * possible to respect backpressure and avoid memory issues using the `'drain'` event:
642
+ *
643
+ * ```js
644
+ * function write(data, cb) {
645
+ * if (!stream.write(data)) {
646
+ * stream.once('drain', cb);
647
+ * } else {
648
+ * process.nextTick(cb);
649
+ * }
650
+ * }
651
+ *
652
+ * // Wait for cb to be called before doing any other write.
653
+ * write('hello', () => {
654
+ * console.log('Write completed, do more writes now.');
655
+ * });
656
+ * ```
657
+ *
658
+ * A `Writable` stream in object mode will always ignore the `encoding` argument.
659
+ * @since v0.9.4
660
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any
661
+ * JavaScript value other than `null`.
662
+ * @param [encoding='utf8'] The encoding, if `chunk` is a string.
663
+ * @param callback Callback for when this chunk of data is flushed.
664
+ * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
665
+ */
666
+ write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
667
+ write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
668
+ /**
669
+ * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.
670
+ * @since v0.11.15
671
+ * @param encoding The new default encoding
672
+ */
673
+ setDefaultEncoding(encoding: BufferEncoding): this;
674
+ /**
675
+ * Calling the `writable.end()` method signals that no more data will be written
676
+ * to the `Writable`. The optional `chunk` and `encoding` arguments allow one
677
+ * final additional chunk of data to be written immediately before closing the
678
+ * stream.
679
+ *
680
+ * Calling the {@link write} method after calling {@link end} will raise an error.
681
+ *
682
+ * ```js
683
+ * // Write 'hello, ' and then end with 'world!'.
684
+ * const fs = require('fs');
685
+ * const file = fs.createWriteStream('example.txt');
686
+ * file.write('hello, ');
687
+ * file.end('world!');
688
+ * // Writing more now is not allowed!
689
+ * ```
690
+ * @since v0.9.4
691
+ * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any
692
+ * JavaScript value other than `null`.
693
+ * @param encoding The encoding if `chunk` is a string
694
+ * @param callback Callback for when the stream is finished.
695
+ */
696
+ end(cb?: () => void): this;
697
+ end(chunk: any, cb?: () => void): this;
698
+ end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
699
+ /**
700
+ * The `writable.cork()` method forces all written data to be buffered in memory.
701
+ * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called.
702
+ *
703
+ * The primary intent of `writable.cork()` is to accommodate a situation in which
704
+ * several small chunks are written to the stream in rapid succession. Instead of
705
+ * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them
706
+ * all to `writable._writev()`, if present. This prevents a head-of-line blocking
707
+ * situation where data is being buffered while waiting for the first small chunk
708
+ * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput.
709
+ *
710
+ * See also: `writable.uncork()`, `writable._writev()`.
711
+ * @since v0.11.2
712
+ */
713
+ cork(): void;
714
+ /**
715
+ * The `writable.uncork()` method flushes all data buffered since {@link cork} was called.
716
+ *
717
+ * When using `writable.cork()` and `writable.uncork()` to manage the buffering
718
+ * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event
719
+ * loop phase.
720
+ *
721
+ * ```js
722
+ * stream.cork();
723
+ * stream.write('some ');
724
+ * stream.write('data ');
725
+ * process.nextTick(() => stream.uncork());
726
+ * ```
727
+ *
728
+ * If the `writable.cork()` method is called multiple times on a stream, the
729
+ * same number of calls to `writable.uncork()` must be called to flush the buffered
730
+ * data.
731
+ *
732
+ * ```js
733
+ * stream.cork();
734
+ * stream.write('some ');
735
+ * stream.cork();
736
+ * stream.write('data ');
737
+ * process.nextTick(() => {
738
+ * stream.uncork();
739
+ * // The data will not be flushed until uncork() is called a second time.
740
+ * stream.uncork();
741
+ * });
742
+ * ```
743
+ *
744
+ * See also: `writable.cork()`.
745
+ * @since v0.11.2
746
+ */
747
+ uncork(): void;
748
+ /**
749
+ * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable
750
+ * stream has ended and subsequent calls to `write()` or `end()` will result in
751
+ * an `ERR_STREAM_DESTROYED` error.
752
+ * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error.
753
+ * Use `end()` instead of destroy if data should flush before close, or wait for
754
+ * the `'drain'` event before destroying the stream.
755
+ *
756
+ * Once `destroy()` has been called any further calls will be a no-op and no
757
+ * further errors except from `_destroy()` may be emitted as `'error'`.
758
+ *
759
+ * Implementors should not override this method,
760
+ * but instead implement `writable._destroy()`.
761
+ * @since v8.0.0
762
+ * @param error Optional, an error to emit with `'error'` event.
763
+ */
764
+ destroy(error?: Error): this;
765
+ /**
766
+ * Event emitter
767
+ * The defined events on documents including:
768
+ * 1. close
769
+ * 2. drain
770
+ * 3. error
771
+ * 4. finish
772
+ * 5. pipe
773
+ * 6. unpipe
774
+ */
775
+ addListener(event: 'close', listener: () => void): this;
776
+ addListener(event: 'drain', listener: () => void): this;
777
+ addListener(event: 'error', listener: (err: Error) => void): this;
778
+ addListener(event: 'finish', listener: () => void): this;
779
+ addListener(event: 'pipe', listener: (src: Readable) => void): this;
780
+ addListener(event: 'unpipe', listener: (src: Readable) => void): this;
781
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
782
+ emit(event: 'close'): boolean;
783
+ emit(event: 'drain'): boolean;
784
+ emit(event: 'error', err: Error): boolean;
785
+ emit(event: 'finish'): boolean;
786
+ emit(event: 'pipe', src: Readable): boolean;
787
+ emit(event: 'unpipe', src: Readable): boolean;
788
+ emit(event: string | symbol, ...args: any[]): boolean;
789
+ on(event: 'close', listener: () => void): this;
790
+ on(event: 'drain', listener: () => void): this;
791
+ on(event: 'error', listener: (err: Error) => void): this;
792
+ on(event: 'finish', listener: () => void): this;
793
+ on(event: 'pipe', listener: (src: Readable) => void): this;
794
+ on(event: 'unpipe', listener: (src: Readable) => void): this;
795
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
796
+ once(event: 'close', listener: () => void): this;
797
+ once(event: 'drain', listener: () => void): this;
798
+ once(event: 'error', listener: (err: Error) => void): this;
799
+ once(event: 'finish', listener: () => void): this;
800
+ once(event: 'pipe', listener: (src: Readable) => void): this;
801
+ once(event: 'unpipe', listener: (src: Readable) => void): this;
802
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
803
+ prependListener(event: 'close', listener: () => void): this;
804
+ prependListener(event: 'drain', listener: () => void): this;
805
+ prependListener(event: 'error', listener: (err: Error) => void): this;
806
+ prependListener(event: 'finish', listener: () => void): this;
807
+ prependListener(event: 'pipe', listener: (src: Readable) => void): this;
808
+ prependListener(event: 'unpipe', listener: (src: Readable) => void): this;
809
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
810
+ prependOnceListener(event: 'close', listener: () => void): this;
811
+ prependOnceListener(event: 'drain', listener: () => void): this;
812
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
813
+ prependOnceListener(event: 'finish', listener: () => void): this;
814
+ prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this;
815
+ prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this;
816
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
817
+ removeListener(event: 'close', listener: () => void): this;
818
+ removeListener(event: 'drain', listener: () => void): this;
819
+ removeListener(event: 'error', listener: (err: Error) => void): this;
820
+ removeListener(event: 'finish', listener: () => void): this;
821
+ removeListener(event: 'pipe', listener: (src: Readable) => void): this;
822
+ removeListener(event: 'unpipe', listener: (src: Readable) => void): this;
823
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
824
+ }
825
+ interface DuplexOptions extends ReadableOptions, WritableOptions {
826
+ allowHalfOpen?: boolean | undefined;
827
+ readableObjectMode?: boolean | undefined;
828
+ writableObjectMode?: boolean | undefined;
829
+ readableHighWaterMark?: number | undefined;
830
+ writableHighWaterMark?: number | undefined;
831
+ writableCorked?: number | undefined;
832
+ construct?(this: Duplex, callback: (error?: Error | null) => void): void;
833
+ read?(this: Duplex, size: number): void;
834
+ write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
835
+ writev?(
836
+ this: Duplex,
837
+ chunks: Array<{
838
+ chunk: any;
839
+ encoding: BufferEncoding;
840
+ }>,
841
+ callback: (error?: Error | null) => void
842
+ ): void;
843
+ final?(this: Duplex, callback: (error?: Error | null) => void): void;
844
+ destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void;
845
+ }
846
+ /**
847
+ * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces.
848
+ *
849
+ * Examples of `Duplex` streams include:
850
+ *
851
+ * * `TCP sockets`
852
+ * * `zlib streams`
853
+ * * `crypto streams`
854
+ * @since v0.9.4
855
+ */
856
+ class Duplex extends Readable implements Writable {
857
+ readonly writable: boolean;
858
+ readonly writableEnded: boolean;
859
+ readonly writableFinished: boolean;
860
+ readonly writableHighWaterMark: number;
861
+ readonly writableLength: number;
862
+ readonly writableObjectMode: boolean;
863
+ readonly writableCorked: number;
864
+ readonly writableNeedDrain: boolean;
865
+ readonly closed: boolean;
866
+ readonly errored: Error | null;
867
+ /**
868
+ * If `false` then the stream will automatically end the writable side when the
869
+ * readable side ends. Set initially by the `allowHalfOpen` constructor option,
870
+ * which defaults to `false`.
871
+ *
872
+ * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is
873
+ * emitted.
874
+ * @since v0.9.4
875
+ */
876
+ allowHalfOpen: boolean;
877
+ constructor(opts?: DuplexOptions);
878
+ /**
879
+ * A utility method for creating duplex streams.
880
+ *
881
+ * - `Stream` converts writable stream into writable `Duplex` and readable stream
882
+ * to `Duplex`.
883
+ * - `Blob` converts into readable `Duplex`.
884
+ * - `string` converts into readable `Duplex`.
885
+ * - `ArrayBuffer` converts into readable `Duplex`.
886
+ * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`.
887
+ * - `AsyncGeneratorFunction` converts into a readable/writable transform
888
+ * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield
889
+ * `null`.
890
+ * - `AsyncFunction` converts into a writable `Duplex`. Must return
891
+ * either `null` or `undefined`
892
+ * - `Object ({ writable, readable })` converts `readable` and
893
+ * `writable` into `Stream` and then combines them into `Duplex` where the
894
+ * `Duplex` will write to the `writable` and read from the `readable`.
895
+ * - `Promise` converts into readable `Duplex`. Value `null` is ignored.
896
+ *
897
+ * @since v16.8.0
898
+ */
899
+ static from(src: Stream | NodeBlob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
900
+ _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
901
+ _writev?(
902
+ chunks: Array<{
903
+ chunk: any;
904
+ encoding: BufferEncoding;
905
+ }>,
906
+ callback: (error?: Error | null) => void
907
+ ): void;
908
+ _destroy(error: Error | null, callback: (error: Error | null) => void): void;
909
+ _final(callback: (error?: Error | null) => void): void;
910
+ write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean;
911
+ write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
912
+ setDefaultEncoding(encoding: BufferEncoding): this;
913
+ end(cb?: () => void): this;
914
+ end(chunk: any, cb?: () => void): this;
915
+ end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
916
+ cork(): void;
917
+ uncork(): void;
918
+ }
919
+ type TransformCallback = (error?: Error | null, data?: any) => void;
920
+ interface TransformOptions extends DuplexOptions {
921
+ construct?(this: Transform, callback: (error?: Error | null) => void): void;
922
+ read?(this: Transform, size: number): void;
923
+ write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
924
+ writev?(
925
+ this: Transform,
926
+ chunks: Array<{
927
+ chunk: any;
928
+ encoding: BufferEncoding;
929
+ }>,
930
+ callback: (error?: Error | null) => void
931
+ ): void;
932
+ final?(this: Transform, callback: (error?: Error | null) => void): void;
933
+ destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void;
934
+ transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
935
+ flush?(this: Transform, callback: TransformCallback): void;
936
+ }
937
+ /**
938
+ * Transform streams are `Duplex` streams where the output is in some way
939
+ * related to the input. Like all `Duplex` streams, `Transform` streams
940
+ * implement both the `Readable` and `Writable` interfaces.
941
+ *
942
+ * Examples of `Transform` streams include:
943
+ *
944
+ * * `zlib streams`
945
+ * * `crypto streams`
946
+ * @since v0.9.4
947
+ */
948
+ class Transform extends Duplex {
949
+ constructor(opts?: TransformOptions);
950
+ _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
951
+ _flush(callback: TransformCallback): void;
952
+ }
953
+ /**
954
+ * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is
955
+ * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams.
956
+ */
957
+ class PassThrough extends Transform {}
958
+ /**
959
+ * Attaches an AbortSignal to a readable or writeable stream. This lets code
960
+ * control stream destruction using an `AbortController`.
961
+ *
962
+ * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream.
963
+ *
964
+ * ```js
965
+ * const fs = require('fs');
966
+ *
967
+ * const controller = new AbortController();
968
+ * const read = addAbortSignal(
969
+ * controller.signal,
970
+ * fs.createReadStream(('object.json'))
971
+ * );
972
+ * // Later, abort the operation closing the stream
973
+ * controller.abort();
974
+ * ```
975
+ *
976
+ * Or using an `AbortSignal` with a readable stream as an async iterable:
977
+ *
978
+ * ```js
979
+ * const controller = new AbortController();
980
+ * setTimeout(() => controller.abort(), 10_000); // set a timeout
981
+ * const stream = addAbortSignal(
982
+ * controller.signal,
983
+ * fs.createReadStream(('object.json'))
984
+ * );
985
+ * (async () => {
986
+ * try {
987
+ * for await (const chunk of stream) {
988
+ * await process(chunk);
989
+ * }
990
+ * } catch (e) {
991
+ * if (e.name === 'AbortError') {
992
+ * // The operation was cancelled
993
+ * } else {
994
+ * throw e;
995
+ * }
996
+ * }
997
+ * })();
998
+ * ```
999
+ * @since v15.4.0
1000
+ * @param signal A signal representing possible cancellation
1001
+ * @param stream a stream to attach a signal to
1002
+ */
1003
+ function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
1004
+ interface FinishedOptions extends Abortable {
1005
+ error?: boolean | undefined;
1006
+ readable?: boolean | undefined;
1007
+ writable?: boolean | undefined;
1008
+ }
1009
+ /**
1010
+ * A function to get notified when a stream is no longer readable, writable
1011
+ * or has experienced an error or a premature close event.
1012
+ *
1013
+ * ```js
1014
+ * const { finished } = require('stream');
1015
+ *
1016
+ * const rs = fs.createReadStream('archive.tar');
1017
+ *
1018
+ * finished(rs, (err) => {
1019
+ * if (err) {
1020
+ * console.error('Stream failed.', err);
1021
+ * } else {
1022
+ * console.log('Stream is done reading.');
1023
+ * }
1024
+ * });
1025
+ *
1026
+ * rs.resume(); // Drain the stream.
1027
+ * ```
1028
+ *
1029
+ * Especially useful in error handling scenarios where a stream is destroyed
1030
+ * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`.
1031
+ *
1032
+ * The `finished` API provides promise version:
1033
+ *
1034
+ * ```js
1035
+ * const { finished } = require('stream/promises');
1036
+ *
1037
+ * const rs = fs.createReadStream('archive.tar');
1038
+ *
1039
+ * async function run() {
1040
+ * await finished(rs);
1041
+ * console.log('Stream is done reading.');
1042
+ * }
1043
+ *
1044
+ * run().catch(console.error);
1045
+ * rs.resume(); // Drain the stream.
1046
+ * ```
1047
+ *
1048
+ * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been
1049
+ * invoked. The reason for this is so that unexpected `'error'` events (due to
1050
+ * incorrect stream implementations) do not cause unexpected crashes.
1051
+ * If this is unwanted behavior then the returned cleanup function needs to be
1052
+ * invoked in the callback:
1053
+ *
1054
+ * ```js
1055
+ * const cleanup = finished(rs, (err) => {
1056
+ * cleanup();
1057
+ * // ...
1058
+ * });
1059
+ * ```
1060
+ * @since v10.0.0
1061
+ * @param stream A readable and/or writable stream.
1062
+ * @param callback A callback function that takes an optional error argument.
1063
+ * @return A cleanup function which removes all registered listeners.
1064
+ */
1065
+ function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
1066
+ function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
1067
+ namespace finished {
1068
+ function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
1069
+ }
1070
+ type PipelineSourceFunction<T> = () => Iterable<T> | AsyncIterable<T>;
1071
+ type PipelineSource<T> = Iterable<T> | AsyncIterable<T> | NodeJS.ReadableStream | PipelineSourceFunction<T>;
1072
+ type PipelineTransform<S extends PipelineTransformSource<any>, U> =
1073
+ | NodeJS.ReadWriteStream
1074
+ | ((source: S extends (...args: any[]) => Iterable<infer ST> | AsyncIterable<infer ST> ? AsyncIterable<ST> : S) => AsyncIterable<U>);
1075
+ type PipelineTransformSource<T> = PipelineSource<T> | PipelineTransform<any, T>;
1076
+ type PipelineDestinationIterableFunction<T> = (source: AsyncIterable<T>) => AsyncIterable<any>;
1077
+ type PipelineDestinationPromiseFunction<T, P> = (source: AsyncIterable<T>) => Promise<P>;
1078
+ type PipelineDestination<S extends PipelineTransformSource<any>, P> = S extends PipelineTransformSource<infer ST>
1079
+ ? NodeJS.WritableStream | PipelineDestinationIterableFunction<ST> | PipelineDestinationPromiseFunction<ST, P>
1080
+ : never;
1081
+ type PipelineCallback<S extends PipelineDestination<any, any>> = S extends PipelineDestinationPromiseFunction<any, infer P>
1082
+ ? (err: NodeJS.ErrnoException | null, value: P) => void
1083
+ : (err: NodeJS.ErrnoException | null) => void;
1084
+ type PipelinePromise<S extends PipelineDestination<any, any>> = S extends PipelineDestinationPromiseFunction<any, infer P> ? Promise<P> : Promise<void>;
1085
+ interface PipelineOptions {
1086
+ signal: AbortSignal;
1087
+ }
1088
+ /**
1089
+ * A module method to pipe between streams and generators forwarding errors and
1090
+ * properly cleaning up and provide a callback when the pipeline is complete.
1091
+ *
1092
+ * ```js
1093
+ * const { pipeline } = require('stream');
1094
+ * const fs = require('fs');
1095
+ * const zlib = require('zlib');
1096
+ *
1097
+ * // Use the pipeline API to easily pipe a series of streams
1098
+ * // together and get notified when the pipeline is fully done.
1099
+ *
1100
+ * // A pipeline to gzip a potentially huge tar file efficiently:
1101
+ *
1102
+ * pipeline(
1103
+ * fs.createReadStream('archive.tar'),
1104
+ * zlib.createGzip(),
1105
+ * fs.createWriteStream('archive.tar.gz'),
1106
+ * (err) => {
1107
+ * if (err) {
1108
+ * console.error('Pipeline failed.', err);
1109
+ * } else {
1110
+ * console.log('Pipeline succeeded.');
1111
+ * }
1112
+ * }
1113
+ * );
1114
+ * ```
1115
+ *
1116
+ * The `pipeline` API provides a promise version, which can also
1117
+ * receive an options argument as the last parameter with a`signal` `AbortSignal` property. When the signal is aborted,`destroy` will be called on the underlying pipeline, with
1118
+ * an`AbortError`.
1119
+ *
1120
+ * ```js
1121
+ * const { pipeline } = require('stream/promises');
1122
+ *
1123
+ * async function run() {
1124
+ * await pipeline(
1125
+ * fs.createReadStream('archive.tar'),
1126
+ * zlib.createGzip(),
1127
+ * fs.createWriteStream('archive.tar.gz')
1128
+ * );
1129
+ * console.log('Pipeline succeeded.');
1130
+ * }
1131
+ *
1132
+ * run().catch(console.error);
1133
+ * ```
1134
+ *
1135
+ * To use an `AbortSignal`, pass it inside an options object,
1136
+ * as the last argument:
1137
+ *
1138
+ * ```js
1139
+ * const { pipeline } = require('stream/promises');
1140
+ *
1141
+ * async function run() {
1142
+ * const ac = new AbortController();
1143
+ * const signal = ac.signal;
1144
+ *
1145
+ * setTimeout(() => ac.abort(), 1);
1146
+ * await pipeline(
1147
+ * fs.createReadStream('archive.tar'),
1148
+ * zlib.createGzip(),
1149
+ * fs.createWriteStream('archive.tar.gz'),
1150
+ * { signal },
1151
+ * );
1152
+ * }
1153
+ *
1154
+ * run().catch(console.error); // AbortError
1155
+ * ```
1156
+ *
1157
+ * The `pipeline` API also supports async generators:
1158
+ *
1159
+ * ```js
1160
+ * const { pipeline } = require('stream/promises');
1161
+ * const fs = require('fs');
1162
+ *
1163
+ * async function run() {
1164
+ * await pipeline(
1165
+ * fs.createReadStream('lowercase.txt'),
1166
+ * async function* (source, { signal }) {
1167
+ * source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
1168
+ * for await (const chunk of source) {
1169
+ * yield await processChunk(chunk, { signal });
1170
+ * }
1171
+ * },
1172
+ * fs.createWriteStream('uppercase.txt')
1173
+ * );
1174
+ * console.log('Pipeline succeeded.');
1175
+ * }
1176
+ *
1177
+ * run().catch(console.error);
1178
+ * ```
1179
+ *
1180
+ * Remember to handle the `signal` argument passed into the async generator.
1181
+ * Especially in the case where the async generator is the source for the
1182
+ * pipeline (i.e. first argument) or the pipeline will never complete.
1183
+ *
1184
+ * ```js
1185
+ * const { pipeline } = require('stream/promises');
1186
+ * const fs = require('fs');
1187
+ *
1188
+ * async function run() {
1189
+ * await pipeline(
1190
+ * async function* ({ signal }) {
1191
+ * await someLongRunningfn({ signal });
1192
+ * yield 'asd';
1193
+ * },
1194
+ * fs.createWriteStream('uppercase.txt')
1195
+ * );
1196
+ * console.log('Pipeline succeeded.');
1197
+ * }
1198
+ *
1199
+ * run().catch(console.error);
1200
+ * ```
1201
+ *
1202
+ * `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
1203
+ *
1204
+ * * `Readable` streams which have emitted `'end'` or `'close'`.
1205
+ * * `Writable` streams which have emitted `'finish'` or `'close'`.
1206
+ *
1207
+ * `stream.pipeline()` leaves dangling event listeners on the streams
1208
+ * after the `callback` has been invoked. In the case of reuse of streams after
1209
+ * failure, this can cause event listener leaks and swallowed errors. If the last
1210
+ * stream is readable, dangling event listeners will be removed so that the last
1211
+ * stream can be consumed later.
1212
+ *
1213
+ * `stream.pipeline()` closes all the streams when an error is raised.
1214
+ * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior
1215
+ * once it would destroy the socket without sending the expected response.
1216
+ * See the example below:
1217
+ *
1218
+ * ```js
1219
+ * const fs = require('fs');
1220
+ * const http = require('http');
1221
+ * const { pipeline } = require('stream');
1222
+ *
1223
+ * const server = http.createServer((req, res) => {
1224
+ * const fileStream = fs.createReadStream('./fileNotExist.txt');
1225
+ * pipeline(fileStream, res, (err) => {
1226
+ * if (err) {
1227
+ * console.log(err); // No such file
1228
+ * // this message can't be sent once `pipeline` already destroyed the socket
1229
+ * return res.end('error!!!');
1230
+ * }
1231
+ * });
1232
+ * });
1233
+ * ```
1234
+ * @since v10.0.0
1235
+ * @param callback Called when the pipeline is fully done.
1236
+ */
1237
+ function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
1238
+ source: A,
1239
+ destination: B,
1240
+ callback?: PipelineCallback<B>
1241
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1242
+ function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
1243
+ source: A,
1244
+ transform1: T1,
1245
+ destination: B,
1246
+ callback?: PipelineCallback<B>
1247
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1248
+ function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
1249
+ source: A,
1250
+ transform1: T1,
1251
+ transform2: T2,
1252
+ destination: B,
1253
+ callback?: PipelineCallback<B>
1254
+ ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1255
+ function pipeline<
1256
+ A extends PipelineSource<any>,
1257
+ T1 extends PipelineTransform<A, any>,
1258
+ T2 extends PipelineTransform<T1, any>,
1259
+ T3 extends PipelineTransform<T2, any>,
1260
+ B extends PipelineDestination<T3, any>
1261
+ >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, callback?: PipelineCallback<B>): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1262
+ function pipeline<
1263
+ A extends PipelineSource<any>,
1264
+ T1 extends PipelineTransform<A, any>,
1265
+ T2 extends PipelineTransform<T1, any>,
1266
+ T3 extends PipelineTransform<T2, any>,
1267
+ T4 extends PipelineTransform<T3, any>,
1268
+ B extends PipelineDestination<T4, any>
1269
+ >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, callback?: PipelineCallback<B>): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream;
1270
+ function pipeline(
1271
+ streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
1272
+ callback?: (err: NodeJS.ErrnoException | null) => void
1273
+ ): NodeJS.WritableStream;
1274
+ function pipeline(
1275
+ stream1: NodeJS.ReadableStream,
1276
+ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1277
+ ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)>
1278
+ ): NodeJS.WritableStream;
1279
+ namespace pipeline {
1280
+ function __promisify__<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
1281
+ function __promisify__<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
1282
+ source: A,
1283
+ transform1: T1,
1284
+ destination: B,
1285
+ options?: PipelineOptions
1286
+ ): PipelinePromise<B>;
1287
+ function __promisify__<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
1288
+ source: A,
1289
+ transform1: T1,
1290
+ transform2: T2,
1291
+ destination: B,
1292
+ options?: PipelineOptions
1293
+ ): PipelinePromise<B>;
1294
+ function __promisify__<
1295
+ A extends PipelineSource<any>,
1296
+ T1 extends PipelineTransform<A, any>,
1297
+ T2 extends PipelineTransform<T1, any>,
1298
+ T3 extends PipelineTransform<T2, any>,
1299
+ B extends PipelineDestination<T3, any>
1300
+ >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
1301
+ function __promisify__<
1302
+ A extends PipelineSource<any>,
1303
+ T1 extends PipelineTransform<A, any>,
1304
+ T2 extends PipelineTransform<T1, any>,
1305
+ T3 extends PipelineTransform<T2, any>,
1306
+ T4 extends PipelineTransform<T3, any>,
1307
+ B extends PipelineDestination<T4, any>
1308
+ >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
1309
+ function __promisify__(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
1310
+ function __promisify__(
1311
+ stream1: NodeJS.ReadableStream,
1312
+ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
1313
+ ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
1314
+ ): Promise<void>;
1315
+ }
1316
+ interface Pipe {
1317
+ close(): void;
1318
+ hasRef(): boolean;
1319
+ ref(): void;
1320
+ unref(): void;
1321
+ }
1322
+
1323
+ /**
1324
+ * Returns whether the stream has encountered an error.
1325
+ * @since v17.3.0
1326
+ */
1327
+ function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
1328
+
1329
+ /**
1330
+ * Returns whether the stream is readable.
1331
+ * @since v17.4.0
1332
+ */
1333
+ function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
1334
+
1335
+ const promises: typeof streamPromises;
1336
+ const consumers: typeof streamConsumers;
1337
+ }
1338
+ export = internal;
1339
+ }
1340
+ declare module 'node:stream' {
1341
+ import stream = require('stream');
1342
+ export = stream;
1343
+ }