@types/node 18.11.5 → 20.2.5

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 (97) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +86 -75
  3. node/async_hooks.d.ts +66 -37
  4. node/buffer.d.ts +193 -100
  5. node/child_process.d.ts +82 -56
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +233 -235
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +59 -21
  11. node/dns/promises.d.ts +50 -6
  12. node/dns.d.ts +26 -17
  13. node/domain.d.ts +4 -4
  14. node/events.d.ts +111 -65
  15. node/fs/promises.d.ts +99 -47
  16. node/fs.d.ts +244 -73
  17. node/globals.d.ts +6 -3
  18. node/http.d.ts +265 -148
  19. node/http2.d.ts +42 -47
  20. node/https.d.ts +53 -153
  21. node/index.d.ts +2 -1
  22. node/inspector.d.ts +10 -3
  23. node/module.d.ts +6 -4
  24. node/net.d.ts +32 -15
  25. node/os.d.ts +27 -16
  26. node/package.json +9 -4
  27. node/path.d.ts +4 -4
  28. node/perf_hooks.d.ts +28 -15
  29. node/process.d.ts +49 -46
  30. node/punycode.d.ts +1 -1
  31. node/querystring.d.ts +5 -5
  32. node/readline/promises.d.ts +65 -63
  33. node/readline.d.ts +32 -159
  34. node/repl.d.ts +20 -20
  35. node/stream/consumers.d.ts +1 -1
  36. node/stream.d.ts +950 -869
  37. node/string_decoder.d.ts +6 -6
  38. node/test.d.ts +877 -139
  39. node/timers/promises.d.ts +26 -1
  40. node/timers.d.ts +125 -4
  41. node/tls.d.ts +120 -29
  42. node/trace_events.d.ts +20 -9
  43. node/ts4.8/assert.d.ts +86 -75
  44. node/ts4.8/async_hooks.d.ts +66 -37
  45. node/ts4.8/buffer.d.ts +193 -101
  46. node/ts4.8/child_process.d.ts +82 -56
  47. node/ts4.8/cluster.d.ts +12 -12
  48. node/ts4.8/console.d.ts +5 -5
  49. node/ts4.8/crypto.d.ts +230 -233
  50. node/ts4.8/dgram.d.ts +15 -15
  51. node/ts4.8/diagnostics_channel.d.ts +59 -21
  52. node/ts4.8/dns/promises.d.ts +50 -6
  53. node/ts4.8/dns.d.ts +26 -17
  54. node/ts4.8/domain.d.ts +4 -4
  55. node/ts4.8/events.d.ts +111 -65
  56. node/ts4.8/fs/promises.d.ts +97 -46
  57. node/ts4.8/fs.d.ts +244 -73
  58. node/ts4.8/globals.d.ts +21 -12
  59. node/ts4.8/http.d.ts +265 -148
  60. node/ts4.8/http2.d.ts +42 -47
  61. node/ts4.8/https.d.ts +53 -153
  62. node/ts4.8/inspector.d.ts +10 -3
  63. node/ts4.8/module.d.ts +6 -4
  64. node/ts4.8/net.d.ts +33 -16
  65. node/ts4.8/os.d.ts +27 -16
  66. node/ts4.8/path.d.ts +4 -4
  67. node/ts4.8/perf_hooks.d.ts +28 -15
  68. node/ts4.8/process.d.ts +49 -46
  69. node/ts4.8/punycode.d.ts +1 -1
  70. node/ts4.8/querystring.d.ts +5 -5
  71. node/ts4.8/readline/promises.d.ts +65 -63
  72. node/ts4.8/readline.d.ts +32 -159
  73. node/ts4.8/repl.d.ts +20 -20
  74. node/ts4.8/stream/consumers.d.ts +1 -1
  75. node/ts4.8/stream.d.ts +192 -140
  76. node/ts4.8/string_decoder.d.ts +6 -6
  77. node/ts4.8/test.d.ts +877 -139
  78. node/ts4.8/timers/promises.d.ts +26 -1
  79. node/ts4.8/timers.d.ts +125 -4
  80. node/ts4.8/tls.d.ts +120 -29
  81. node/ts4.8/trace_events.d.ts +20 -9
  82. node/ts4.8/tty.d.ts +4 -5
  83. node/ts4.8/url.d.ts +46 -42
  84. node/ts4.8/util.d.ts +325 -123
  85. node/ts4.8/v8.d.ts +253 -14
  86. node/ts4.8/vm.d.ts +417 -32
  87. node/ts4.8/wasi.d.ts +13 -19
  88. node/ts4.8/worker_threads.d.ts +38 -34
  89. node/ts4.8/zlib.d.ts +11 -11
  90. node/tty.d.ts +4 -5
  91. node/url.d.ts +46 -42
  92. node/util.d.ts +325 -123
  93. node/v8.d.ts +253 -14
  94. node/vm.d.ts +417 -32
  95. node/wasi.d.ts +13 -19
  96. node/worker_threads.d.ts +38 -34
  97. node/zlib.d.ts +11 -11
@@ -1,23 +1,28 @@
1
1
  /**
2
- * The `readline/promise` module provides an API for reading lines of input from a Readable stream one line at a time.
3
- *
4
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline/promises.js)
5
2
  * @since v17.0.0
3
+ * @experimental
6
4
  */
7
5
  declare module 'readline/promises' {
8
6
  import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
9
7
  import { Abortable } from 'node:events';
10
-
8
+ /**
9
+ * Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a
10
+ * single `input` `Readable` stream and a single `output` `Writable` stream.
11
+ * The `output` stream is used to print prompts for user input that arrives on,
12
+ * and is read from, the `input` stream.
13
+ * @since v17.0.0
14
+ */
11
15
  class Interface extends _Interface {
12
16
  /**
13
- * The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
14
- * then invokes the callback function passing the provided input as the first argument.
17
+ * The `rl.question()` method displays the `query` by writing it to the `output`,
18
+ * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
15
19
  *
16
- * When called, rl.question() will resume the input stream if it has been paused.
20
+ * When called, `rl.question()` will resume the `input` stream if it has been
21
+ * paused.
17
22
  *
18
- * If the readlinePromises.Interface was created with output set to null or undefined the query is not written.
23
+ * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
19
24
  *
20
- * If the question is called after rl.close(), it returns a rejected promise.
25
+ * If the question is called after `rl.close()`, it returns a rejected promise.
21
26
  *
22
27
  * Example usage:
23
28
  *
@@ -26,7 +31,7 @@ declare module 'readline/promises' {
26
31
  * console.log(`Oh, so your favorite food is ${answer}`);
27
32
  * ```
28
33
  *
29
- * Using an AbortSignal to cancel a question.
34
+ * Using an `AbortSignal` to cancel a question.
30
35
  *
31
36
  * ```js
32
37
  * const signal = AbortSignal.timeout(10_000);
@@ -38,61 +43,87 @@ declare module 'readline/promises' {
38
43
  * const answer = await rl.question('What is your favorite food? ', { signal });
39
44
  * console.log(`Oh, so your favorite food is ${answer}`);
40
45
  * ```
41
- *
42
46
  * @since v17.0.0
43
- * @param query A statement or query to write to output, prepended to the prompt.
47
+ * @param query A statement or query to write to `output`, prepended to the prompt.
48
+ * @return A promise that is fulfilled with the user's input in response to the `query`.
44
49
  */
45
50
  question(query: string): Promise<string>;
46
51
  question(query: string, options: Abortable): Promise<string>;
47
52
  }
48
-
53
+ /**
54
+ * @since v17.0.0
55
+ */
49
56
  class Readline {
50
57
  /**
51
58
  * @param stream A TTY stream.
52
59
  */
53
- constructor(stream: NodeJS.WritableStream, options?: { autoCommit?: boolean });
60
+ constructor(
61
+ stream: NodeJS.WritableStream,
62
+ options?: {
63
+ autoCommit?: boolean;
64
+ }
65
+ );
54
66
  /**
55
- * The `rl.clearLine()` method adds to the internal list of pending action an action that clears current line of the associated `stream` in a specified direction identified by `dir`.
56
- * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
67
+ * The `rl.clearLine()` method adds to the internal list of pending action an
68
+ * action that clears current line of the associated `stream` in a specified
69
+ * direction identified by `dir`.
70
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
71
+ * @since v17.0.0
72
+ * @return this
57
73
  */
58
74
  clearLine(dir: Direction): this;
59
75
  /**
60
- * The `rl.clearScreenDown()` method adds to the internal list of pending action an action that clears the associated `stream` from the current position of the cursor down.
61
- * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
76
+ * The `rl.clearScreenDown()` method adds to the internal list of pending action an
77
+ * action that clears the associated stream from the current position of the
78
+ * cursor down.
79
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
80
+ * @since v17.0.0
81
+ * @return this
62
82
  */
63
83
  clearScreenDown(): this;
64
84
  /**
65
- * The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions.
85
+ * The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions.
86
+ * @since v17.0.0
66
87
  */
67
88
  commit(): Promise<void>;
68
89
  /**
69
- * The `rl.cursorTo()` method adds to the internal list of pending action an action that moves cursor to the specified position in the associated `stream`.
70
- * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
90
+ * The `rl.cursorTo()` method adds to the internal list of pending action an action
91
+ * that moves cursor to the specified position in the associated `stream`.
92
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
93
+ * @since v17.0.0
94
+ * @return this
71
95
  */
72
96
  cursorTo(x: number, y?: number): this;
73
97
  /**
74
- * The `rl.moveCursor()` method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated `stream`.
75
- * Call `rl.commit()` to see the effect of this method, unless autoCommit: true was passed to the constructor.
98
+ * The `rl.moveCursor()` method adds to the internal list of pending action an
99
+ * action that moves the cursor _relative_ to its current position in the
100
+ * associated `stream`.
101
+ * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
102
+ * @since v17.0.0
103
+ * @return this
76
104
  */
77
105
  moveCursor(dx: number, dy: number): this;
78
106
  /**
79
- * The `rl.rollback()` method clears the internal list of pending actions without sending it to the associated `stream`.
107
+ * The `rl.rollback` methods clears the internal list of pending actions without
108
+ * sending it to the associated `stream`.
109
+ * @since v17.0.0
110
+ * @return this
80
111
  */
81
112
  rollback(): this;
82
113
  }
83
-
84
114
  /**
85
- * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
115
+ * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance.
86
116
  *
87
117
  * ```js
88
118
  * const readlinePromises = require('node:readline/promises');
89
119
  * const rl = readlinePromises.createInterface({
90
120
  * input: process.stdin,
91
- * output: process.stdout
121
+ * output: process.stdout,
92
122
  * });
93
123
  * ```
94
124
  *
95
- * Once the `readlinePromises.Interface` instance is created, the most common case is to listen for the `'line'` event:
125
+ * Once the `readlinePromises.Interface` instance is created, the most common case
126
+ * is to listen for the `'line'` event:
96
127
  *
97
128
  * ```js
98
129
  * rl.on('line', (line) => {
@@ -100,42 +131,13 @@ declare module 'readline/promises' {
100
131
  * });
101
132
  * ```
102
133
  *
103
- * If `terminal` is `true` for this instance then the `output` stream will get the best compatibility if it defines an `output.columns` property,
104
- * and emits a `'resize'` event on the `output`, if or when the columns ever change (`process.stdout` does this automatically when it is a TTY).
105
- *
106
- * ## Use of the `completer` function
107
- *
108
- * The `completer` function takes the current line entered by the user as an argument, and returns an `Array` with 2 entries:
109
- *
110
- * - An Array with matching entries for the completion.
111
- * - The substring that was used for the matching.
112
- *
113
- * For instance: `[[substr1, substr2, ...], originalsubstring]`.
114
- *
115
- * ```js
116
- * function completer(line) {
117
- * const completions = '.help .error .exit .quit .q'.split(' ');
118
- * const hits = completions.filter((c) => c.startsWith(line));
119
- * // Show all completions if none found
120
- * return [hits.length ? hits : completions, line];
121
- * }
122
- * ```
123
- *
124
- * The `completer` function can also returns a `Promise`, or be asynchronous:
125
- *
126
- * ```js
127
- * async function completer(linePartial) {
128
- * await someAsyncWork();
129
- * return [['123'], linePartial];
130
- * }
131
- * ```
134
+ * If `terminal` is `true` for this instance then the `output` stream will get
135
+ * the best compatibility if it defines an `output.columns` property and emits
136
+ * a `'resize'` event on the `output` if or when the columns ever change
137
+ * (`process.stdout` does this automatically when it is a TTY).
138
+ * @since v17.0.0
132
139
  */
133
- function createInterface(
134
- input: NodeJS.ReadableStream,
135
- output?: NodeJS.WritableStream,
136
- completer?: Completer | AsyncCompleter,
137
- terminal?: boolean,
138
- ): Interface;
140
+ function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
139
141
  function createInterface(options: ReadLineOptions): Interface;
140
142
  }
141
143
  declare module 'node:readline/promises' {
node/readline.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
2
+ * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
3
3
  *
4
4
  * To use the promise-based APIs:
5
5
  *
@@ -13,7 +13,7 @@
13
13
  * import * as readline from 'node:readline';
14
14
  * ```
15
15
  *
16
- * The following simple example illustrates the basic use of the `readline` module.
16
+ * The following simple example illustrates the basic use of the `node:readline`module.
17
17
  *
18
18
  * ```js
19
19
  * import * as readline from 'node:readline/promises';
@@ -30,12 +30,11 @@
30
30
  *
31
31
  * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
32
32
  * received on the `input` stream.
33
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline.js)
33
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js)
34
34
  */
35
35
  declare module 'readline' {
36
36
  import { Abortable, EventEmitter } from 'node:events';
37
37
  import * as promises from 'node:readline/promises';
38
-
39
38
  export { promises };
40
39
  export interface Key {
41
40
  sequence?: string | undefined;
@@ -74,7 +73,7 @@ declare module 'readline' {
74
73
  * const showResults = debounce(() => {
75
74
  * console.log(
76
75
  * '\n',
77
- * values.filter((val) => val.startsWith(rl.line)).join(' ')
76
+ * values.filter((val) => val.startsWith(rl.line)).join(' '),
78
77
  * );
79
78
  * }, 300);
80
79
  * process.stdin.on('keypress', (c, k) => {
@@ -100,7 +99,7 @@ declare module 'readline' {
100
99
  * > Instances of the `readline.Interface` class are constructed using the
101
100
  * > `readline.createInterface()` method.
102
101
  *
103
- * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
102
+ * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
104
103
  */
105
104
  protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
106
105
  /**
@@ -109,12 +108,12 @@ declare module 'readline' {
109
108
  * > Instances of the `readline.Interface` class are constructed using the
110
109
  * > `readline.createInterface()` method.
111
110
  *
112
- * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
111
+ * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
113
112
  */
114
113
  protected constructor(options: ReadLineOptions);
115
114
  /**
116
115
  * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
117
- * @since v15.3.0
116
+ * @since v15.3.0, v14.17.0
118
117
  * @return the current prompt string
119
118
  */
120
119
  getPrompt(): string;
@@ -124,13 +123,13 @@ declare module 'readline' {
124
123
  */
125
124
  setPrompt(prompt: string): void;
126
125
  /**
127
- * The `rl.prompt()` method writes the `readline.Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
126
+ * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
128
127
  * location at which to provide input.
129
128
  *
130
129
  * When called, `rl.prompt()` will resume the `input` stream if it has been
131
130
  * paused.
132
131
  *
133
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
132
+ * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
134
133
  * @since v0.1.98
135
134
  * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
136
135
  */
@@ -142,12 +141,14 @@ declare module 'readline' {
142
141
  * When called, `rl.question()` will resume the `input` stream if it has been
143
142
  * paused.
144
143
  *
145
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
144
+ * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
146
145
  *
147
146
  * The `callback` function passed to `rl.question()` does not follow the typical
148
147
  * pattern of accepting an `Error` object or `null` as the first argument.
149
148
  * The `callback` is called with the provided answer as the only argument.
150
149
  *
150
+ * An error will be thrown if calling `rl.question()` after `rl.close()`.
151
+ *
151
152
  * Example usage:
152
153
  *
153
154
  * ```js
@@ -172,25 +173,6 @@ declare module 'readline' {
172
173
  *
173
174
  * setTimeout(() => ac.abort(), 10000);
174
175
  * ```
175
- *
176
- * If this method is invoked as it's util.promisify()ed version, it returns a
177
- * Promise that fulfills with the answer. If the question is canceled using
178
- * an `AbortController` it will reject with an `AbortError`.
179
- *
180
- * ```js
181
- * const util = require('util');
182
- * const question = util.promisify(rl.question).bind(rl);
183
- *
184
- * async function questionExample() {
185
- * try {
186
- * const answer = await question('What is you favorite food? ');
187
- * console.log(`Oh, so your favorite food is ${answer}`);
188
- * } catch (err) {
189
- * console.error('Question rejected', err);
190
- * }
191
- * }
192
- * questionExample();
193
- * ```
194
176
  * @since v0.3.3
195
177
  * @param query A statement or query to write to `output`, prepended to the prompt.
196
178
  * @param callback A callback function that is invoked with the user's input in response to the `query`.
@@ -201,7 +183,7 @@ declare module 'readline' {
201
183
  * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
202
184
  * later if necessary.
203
185
  *
204
- * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
186
+ * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
205
187
  * @since v0.3.4
206
188
  */
207
189
  pause(): this;
@@ -211,12 +193,12 @@ declare module 'readline' {
211
193
  */
212
194
  resume(): this;
213
195
  /**
214
- * The `rl.close()` method closes the `readline.Interface` instance and
196
+ * The `rl.close()` method closes the `Interface` instance and
215
197
  * relinquishes control over the `input` and `output` streams. When called,
216
198
  * the `'close'` event will be emitted.
217
199
  *
218
200
  * Calling `rl.close()` does not immediately stop other events (including `'line'`)
219
- * from being emitted by the `readline.Interface` instance.
201
+ * from being emitted by the `Interface` instance.
220
202
  * @since v0.1.98
221
203
  */
222
204
  close(): void;
@@ -231,7 +213,7 @@ declare module 'readline' {
231
213
  * When called, `rl.write()` will resume the `input` stream if it has been
232
214
  * paused.
233
215
  *
234
- * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
216
+ * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
235
217
  *
236
218
  * ```js
237
219
  * rl.write('Delete this!');
@@ -351,10 +333,10 @@ declare module 'readline' {
351
333
  * The `readline.createInterface()` method creates a new `readline.Interface`instance.
352
334
  *
353
335
  * ```js
354
- * const readline = require('readline');
336
+ * const readline = require('node:readline');
355
337
  * const rl = readline.createInterface({
356
338
  * input: process.stdin,
357
- * output: process.stdout
339
+ * output: process.stdout,
358
340
  * });
359
341
  * ```
360
342
  *
@@ -373,14 +355,8 @@ declare module 'readline' {
373
355
  * (`process.stdout` does this automatically when it is a TTY).
374
356
  *
375
357
  * When creating a `readline.Interface` using `stdin` as input, the program
376
- * will not terminate until it receives `EOF` (Ctrl+D on
377
- * Linux/macOS, Ctrl+Z followed by Return on
378
- * Windows).
379
- * If you want your application to exit without waiting for user input, you can `unref()` the standard input stream:
380
- *
381
- * ```js
382
- * process.stdin.unref();
383
- * ```
358
+ * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without
359
+ * waiting for user input, call `process.stdin.unref()`.
384
360
  * @since v0.1.98
385
361
  */
386
362
  export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
@@ -408,11 +384,11 @@ declare module 'readline' {
408
384
  * implement a small command-line interface:
409
385
  *
410
386
  * ```js
411
- * const readline = require('readline');
387
+ * const readline = require('node:readline');
412
388
  * const rl = readline.createInterface({
413
389
  * input: process.stdin,
414
390
  * output: process.stdout,
415
- * prompt: 'OHAI> '
391
+ * prompt: 'OHAI> ',
416
392
  * });
417
393
  *
418
394
  * rl.prompt();
@@ -440,15 +416,15 @@ declare module 'readline' {
440
416
  * well as a `for await...of` loop:
441
417
  *
442
418
  * ```js
443
- * const fs = require('fs');
444
- * const readline = require('readline');
419
+ * const fs = require('node:fs');
420
+ * const readline = require('node:readline');
445
421
  *
446
422
  * async function processLineByLine() {
447
423
  * const fileStream = fs.createReadStream('input.txt');
448
424
  *
449
425
  * const rl = readline.createInterface({
450
426
  * input: fileStream,
451
- * crlfDelay: Infinity
427
+ * crlfDelay: Infinity,
452
428
  * });
453
429
  * // Note: we use the crlfDelay option to recognize all instances of CR LF
454
430
  * // ('\r\n') in input.txt as a single line break.
@@ -465,12 +441,12 @@ declare module 'readline' {
465
441
  * Alternatively, one could use the `'line'` event:
466
442
  *
467
443
  * ```js
468
- * const fs = require('fs');
469
- * const readline = require('readline');
444
+ * const fs = require('node:fs');
445
+ * const readline = require('node:readline');
470
446
  *
471
447
  * const rl = readline.createInterface({
472
448
  * input: fs.createReadStream('sample.txt'),
473
- * crlfDelay: Infinity
449
+ * crlfDelay: Infinity,
474
450
  * });
475
451
  *
476
452
  * rl.on('line', (line) => {
@@ -481,15 +457,15 @@ declare module 'readline' {
481
457
  * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
482
458
  *
483
459
  * ```js
484
- * const { once } = require('events');
485
- * const { createReadStream } = require('fs');
486
- * const { createInterface } = require('readline');
460
+ * const { once } = require('node:events');
461
+ * const { createReadStream } = require('node:fs');
462
+ * const { createInterface } = require('node:readline');
487
463
  *
488
464
  * (async function processLineByLine() {
489
465
  * try {
490
466
  * const rl = createInterface({
491
467
  * input: createReadStream('big-file.txt'),
492
- * crlfDelay: Infinity
468
+ * crlfDelay: Infinity,
493
469
  * });
494
470
  *
495
471
  * rl.on('line', (line) => {
@@ -539,109 +515,6 @@ declare module 'readline' {
539
515
  /**
540
516
  * The `readline.moveCursor()` method moves the cursor _relative_ to its current
541
517
  * position in a given `TTY` `stream`.
542
- *
543
- * ## Example: Tiny CLI
544
- *
545
- * The following example illustrates the use of `readline.Interface` class to
546
- * implement a small command-line interface:
547
- *
548
- * ```js
549
- * const readline = require('readline');
550
- * const rl = readline.createInterface({
551
- * input: process.stdin,
552
- * output: process.stdout,
553
- * prompt: 'OHAI> '
554
- * });
555
- *
556
- * rl.prompt();
557
- *
558
- * rl.on('line', (line) => {
559
- * switch (line.trim()) {
560
- * case 'hello':
561
- * console.log('world!');
562
- * break;
563
- * default:
564
- * console.log(`Say what? I might have heard '${line.trim()}'`);
565
- * break;
566
- * }
567
- * rl.prompt();
568
- * }).on('close', () => {
569
- * console.log('Have a great day!');
570
- * process.exit(0);
571
- * });
572
- * ```
573
- *
574
- * ## Example: Read file stream line-by-Line
575
- *
576
- * A common use case for `readline` is to consume an input file one line at a
577
- * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
578
- * well as a `for await...of` loop:
579
- *
580
- * ```js
581
- * const fs = require('fs');
582
- * const readline = require('readline');
583
- *
584
- * async function processLineByLine() {
585
- * const fileStream = fs.createReadStream('input.txt');
586
- *
587
- * const rl = readline.createInterface({
588
- * input: fileStream,
589
- * crlfDelay: Infinity
590
- * });
591
- * // Note: we use the crlfDelay option to recognize all instances of CR LF
592
- * // ('\r\n') in input.txt as a single line break.
593
- *
594
- * for await (const line of rl) {
595
- * // Each line in input.txt will be successively available here as `line`.
596
- * console.log(`Line from file: ${line}`);
597
- * }
598
- * }
599
- *
600
- * processLineByLine();
601
- * ```
602
- *
603
- * Alternatively, one could use the `'line'` event:
604
- *
605
- * ```js
606
- * const fs = require('fs');
607
- * const readline = require('readline');
608
- *
609
- * const rl = readline.createInterface({
610
- * input: fs.createReadStream('sample.txt'),
611
- * crlfDelay: Infinity
612
- * });
613
- *
614
- * rl.on('line', (line) => {
615
- * console.log(`Line from file: ${line}`);
616
- * });
617
- * ```
618
- *
619
- * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
620
- *
621
- * ```js
622
- * const { once } = require('events');
623
- * const { createReadStream } = require('fs');
624
- * const { createInterface } = require('readline');
625
- *
626
- * (async function processLineByLine() {
627
- * try {
628
- * const rl = createInterface({
629
- * input: createReadStream('big-file.txt'),
630
- * crlfDelay: Infinity
631
- * });
632
- *
633
- * rl.on('line', (line) => {
634
- * // Process the line.
635
- * });
636
- *
637
- * await once(rl, 'close');
638
- *
639
- * console.log('File processed.');
640
- * } catch (err) {
641
- * console.error(err);
642
- * }
643
- * })();
644
- * ```
645
518
  * @since v0.7.7
646
519
  * @param callback Invoked once the operation completes.
647
520
  * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.