@types/node 22.7.1 → 22.7.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.
- node/README.md +1 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +4 -4
- node/child_process.d.ts +34 -29
- node/cluster.d.ts +2 -1
- node/console.d.ts +2 -2
- node/crypto.d.ts +3 -3
- node/dns/promises.d.ts +5 -5
- node/dns.d.ts +5 -5
- node/domain.d.ts +2 -2
- node/fs/promises.d.ts +2 -2
- node/fs.d.ts +2 -2
- node/http.d.ts +2 -2
- node/http2.d.ts +24 -24
- node/https.d.ts +9 -9
- node/module.d.ts +3 -3
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +19 -19
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +1 -1
- node/readline/promises.d.ts +1 -1
- node/readline.d.ts +9 -9
- node/repl.d.ts +4 -4
- node/sqlite.d.ts +1 -1
- node/stream/web.d.ts +17 -17
- node/stream.d.ts +15 -15
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +2 -2
- node/timers/promises.d.ts +5 -5
- node/timers.d.ts +1 -1
- node/tls.d.ts +5 -5
- node/trace_events.d.ts +4 -4
- node/tty.d.ts +1 -1
- node/url.d.ts +7 -7
- node/util.d.ts +44 -44
- node/v8.d.ts +12 -12
- node/vm.d.ts +13 -13
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +22 -22
- node/zlib.d.ts +8 -8
node/http2.d.ts
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* It can be accessed using:
|
4
4
|
*
|
5
5
|
* ```js
|
6
|
-
*
|
6
|
+
* import http2 from 'node:http2';
|
7
7
|
* ```
|
8
8
|
* @since v8.4.0
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/http2.js)
|
@@ -157,7 +157,7 @@ declare module "http2" {
|
|
157
157
|
priority(options: StreamPriorityOptions): void;
|
158
158
|
/**
|
159
159
|
* ```js
|
160
|
-
*
|
160
|
+
* import http2 from 'node:http2';
|
161
161
|
* const client = http2.connect('http://example.org:8000');
|
162
162
|
* const { NGHTTP2_CANCEL } = http2.constants;
|
163
163
|
* const req = client.request({ ':path': '/' });
|
@@ -177,7 +177,7 @@ declare module "http2" {
|
|
177
177
|
* trailers can be sent.
|
178
178
|
*
|
179
179
|
* ```js
|
180
|
-
*
|
180
|
+
* import http2 from 'node:http2';
|
181
181
|
* const server = http2.createServer();
|
182
182
|
* server.on('stream', (stream) => {
|
183
183
|
* stream.respond(undefined, { waitForTrailers: true });
|
@@ -368,7 +368,7 @@ declare module "http2" {
|
|
368
368
|
* Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
|
369
369
|
*
|
370
370
|
* ```js
|
371
|
-
*
|
371
|
+
* import http2 from 'node:http2';
|
372
372
|
* const server = http2.createServer();
|
373
373
|
* server.on('stream', (stream) => {
|
374
374
|
* stream.respond({ ':status': 200 });
|
@@ -400,7 +400,7 @@ declare module "http2" {
|
|
400
400
|
): void;
|
401
401
|
/**
|
402
402
|
* ```js
|
403
|
-
*
|
403
|
+
* import http2 from 'node:http2';
|
404
404
|
* const server = http2.createServer();
|
405
405
|
* server.on('stream', (stream) => {
|
406
406
|
* stream.respond({ ':status': 200 });
|
@@ -416,7 +416,7 @@ declare module "http2" {
|
|
416
416
|
* close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
417
417
|
*
|
418
418
|
* ```js
|
419
|
-
*
|
419
|
+
* import http2 from 'node:http2';
|
420
420
|
* const server = http2.createServer();
|
421
421
|
* server.on('stream', (stream) => {
|
422
422
|
* stream.respond({ ':status': 200 }, { waitForTrailers: true });
|
@@ -439,8 +439,8 @@ declare module "http2" {
|
|
439
439
|
* automatically.
|
440
440
|
*
|
441
441
|
* ```js
|
442
|
-
*
|
443
|
-
*
|
442
|
+
* import http2 from 'node:http2';
|
443
|
+
* import fs from 'node:fs';
|
444
444
|
*
|
445
445
|
* const server = http2.createServer();
|
446
446
|
* server.on('stream', (stream) => {
|
@@ -482,8 +482,8 @@ declare module "http2" {
|
|
482
482
|
* or `http2stream.close()` to close the `Http2Stream`.
|
483
483
|
*
|
484
484
|
* ```js
|
485
|
-
*
|
486
|
-
*
|
485
|
+
* import http2 from 'node:http2';
|
486
|
+
* import fs from 'node:fs';
|
487
487
|
*
|
488
488
|
* const server = http2.createServer();
|
489
489
|
* server.on('stream', (stream) => {
|
@@ -529,7 +529,7 @@ declare module "http2" {
|
|
529
529
|
* Example using a file path:
|
530
530
|
*
|
531
531
|
* ```js
|
532
|
-
*
|
532
|
+
* import http2 from 'node:http2';
|
533
533
|
* const server = http2.createServer();
|
534
534
|
* server.on('stream', (stream) => {
|
535
535
|
* function statCheck(stat, headers) {
|
@@ -563,7 +563,7 @@ declare module "http2" {
|
|
563
563
|
* results to determine if the file has been modified to return an appropriate `304` response:
|
564
564
|
*
|
565
565
|
* ```js
|
566
|
-
*
|
566
|
+
* import http2 from 'node:http2';
|
567
567
|
* const server = http2.createServer();
|
568
568
|
* server.on('stream', (stream) => {
|
569
569
|
* function statCheck(stat, headers) {
|
@@ -596,7 +596,7 @@ declare module "http2" {
|
|
596
596
|
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
597
597
|
*
|
598
598
|
* ```js
|
599
|
-
*
|
599
|
+
* import http2 from 'node:http2';
|
600
600
|
* const server = http2.createServer();
|
601
601
|
* server.on('stream', (stream) => {
|
602
602
|
* stream.respondWithFile('/some/file',
|
@@ -805,7 +805,7 @@ declare module "http2" {
|
|
805
805
|
* the delta.
|
806
806
|
*
|
807
807
|
* ```js
|
808
|
-
*
|
808
|
+
* import http2 from 'node:http2';
|
809
809
|
*
|
810
810
|
* const server = http2.createServer();
|
811
811
|
* const expectedWindowSize = 2 ** 20;
|
@@ -932,7 +932,7 @@ declare module "http2" {
|
|
932
932
|
* This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
|
933
933
|
*
|
934
934
|
* ```js
|
935
|
-
*
|
935
|
+
* import http2 from 'node:http2';
|
936
936
|
* const clientSession = http2.connect('https://localhost:1234');
|
937
937
|
* const {
|
938
938
|
* HTTP2_HEADER_PATH,
|
@@ -1065,7 +1065,7 @@ declare module "http2" {
|
|
1065
1065
|
* Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
|
1066
1066
|
*
|
1067
1067
|
* ```js
|
1068
|
-
*
|
1068
|
+
* import http2 from 'node:http2';
|
1069
1069
|
*
|
1070
1070
|
* const server = http2.createServer();
|
1071
1071
|
* server.on('session', (session) => {
|
@@ -1106,7 +1106,7 @@ declare module "http2" {
|
|
1106
1106
|
* authoritative responses.
|
1107
1107
|
*
|
1108
1108
|
* ```js
|
1109
|
-
*
|
1109
|
+
* import http2 from 'node:http2';
|
1110
1110
|
* const options = getSecureOptionsSomehow();
|
1111
1111
|
* const server = http2.createSecureServer(options);
|
1112
1112
|
* server.on('stream', (stream) => {
|
@@ -1132,7 +1132,7 @@ declare module "http2" {
|
|
1132
1132
|
* server using the `http2.createSecureServer()` method:
|
1133
1133
|
*
|
1134
1134
|
* ```js
|
1135
|
-
*
|
1135
|
+
* import http2 from 'node:http2';
|
1136
1136
|
* const options = getSecureOptionsSomehow();
|
1137
1137
|
* options.origins = ['https://example.com', 'https://example.org'];
|
1138
1138
|
* const server = http2.createSecureServer(options);
|
@@ -1835,7 +1835,7 @@ declare module "http2" {
|
|
1835
1835
|
* All other interactions will be routed directly to the socket.
|
1836
1836
|
*
|
1837
1837
|
* ```js
|
1838
|
-
*
|
1838
|
+
* import http2 from 'node:http2';
|
1839
1839
|
* const server = http2.createServer((req, res) => {
|
1840
1840
|
* const ip = req.socket.remoteAddress;
|
1841
1841
|
* const port = req.socket.remotePort;
|
@@ -2411,7 +2411,7 @@ declare module "http2" {
|
|
2411
2411
|
* for use with the `HTTP2-Settings` header field.
|
2412
2412
|
*
|
2413
2413
|
* ```js
|
2414
|
-
*
|
2414
|
+
* import http2 from 'node:http2';
|
2415
2415
|
*
|
2416
2416
|
* const packed = http2.getPackedSettings({ enablePush: false });
|
2417
2417
|
*
|
@@ -2436,7 +2436,7 @@ declare module "http2" {
|
|
2436
2436
|
* with browser clients.
|
2437
2437
|
*
|
2438
2438
|
* ```js
|
2439
|
-
*
|
2439
|
+
* import http2 from 'node:http2';
|
2440
2440
|
*
|
2441
2441
|
* // Create an unencrypted HTTP/2 server.
|
2442
2442
|
* // Since there are no browsers known that support
|
@@ -2473,8 +2473,8 @@ declare module "http2" {
|
|
2473
2473
|
* Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
|
2474
2474
|
*
|
2475
2475
|
* ```js
|
2476
|
-
*
|
2477
|
-
*
|
2476
|
+
* import http2 from 'node:http2';
|
2477
|
+
* import fs from 'node:fs';
|
2478
2478
|
*
|
2479
2479
|
* const options = {
|
2480
2480
|
* key: fs.readFileSync('server-key.pem'),
|
@@ -2513,7 +2513,7 @@ declare module "http2" {
|
|
2513
2513
|
* Returns a `ClientHttp2Session` instance.
|
2514
2514
|
*
|
2515
2515
|
* ```js
|
2516
|
-
*
|
2516
|
+
* import http2 from 'node:http2';
|
2517
2517
|
* const client = http2.connect('https://localhost:1234');
|
2518
2518
|
*
|
2519
2519
|
* // Use the client
|
node/https.d.ts
CHANGED
@@ -270,8 +270,8 @@ declare module "https" {
|
|
270
270
|
/**
|
271
271
|
* ```js
|
272
272
|
* // curl -k https://localhost:8000/
|
273
|
-
*
|
274
|
-
*
|
273
|
+
* import https from 'node:https';
|
274
|
+
* import fs from 'node:fs';
|
275
275
|
*
|
276
276
|
* const options = {
|
277
277
|
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
|
@@ -287,8 +287,8 @@ declare module "https" {
|
|
287
287
|
* Or
|
288
288
|
*
|
289
289
|
* ```js
|
290
|
-
*
|
291
|
-
*
|
290
|
+
* import https from 'node:https';
|
291
|
+
* import fs from 'node:fs';
|
292
292
|
*
|
293
293
|
* const options = {
|
294
294
|
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
|
@@ -328,7 +328,7 @@ declare module "https" {
|
|
328
328
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
329
329
|
*
|
330
330
|
* ```js
|
331
|
-
*
|
331
|
+
* import https from 'node:https';
|
332
332
|
*
|
333
333
|
* const options = {
|
334
334
|
* hostname: 'encrypted.google.com',
|
@@ -401,9 +401,9 @@ declare module "https" {
|
|
401
401
|
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
|
402
402
|
*
|
403
403
|
* ```js
|
404
|
-
*
|
405
|
-
*
|
406
|
-
*
|
404
|
+
* import tls from 'node:tls';
|
405
|
+
* import https from 'node:https';
|
406
|
+
* import crypto from 'node:crypto';
|
407
407
|
*
|
408
408
|
* function sha256(s) {
|
409
409
|
* return crypto.createHash('sha256').update(s).digest('base64');
|
@@ -511,7 +511,7 @@ declare module "https" {
|
|
511
511
|
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
|
512
512
|
*
|
513
513
|
* ```js
|
514
|
-
*
|
514
|
+
* import https from 'node:https';
|
515
515
|
*
|
516
516
|
* https.get('https://encrypted.google.com/', (res) => {
|
517
517
|
* console.log('statusCode:', res.statusCode);
|
node/module.d.ts
CHANGED
@@ -12,9 +12,9 @@ declare module "module" {
|
|
12
12
|
* does not add or remove exported names from the `ES Modules`.
|
13
13
|
*
|
14
14
|
* ```js
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
15
|
+
* import fs from 'node:fs';
|
16
|
+
* import assert from 'node:assert';
|
17
|
+
* import { syncBuiltinESMExports } from 'node:module';
|
18
18
|
*
|
19
19
|
* fs.readFile = newAPI;
|
20
20
|
*
|
node/net.d.ts
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
* It can be accessed using:
|
9
9
|
*
|
10
10
|
* ```js
|
11
|
-
*
|
11
|
+
* import net from 'node:net';
|
12
12
|
* ```
|
13
13
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/net.js)
|
14
14
|
*/
|
@@ -808,7 +808,7 @@ declare module "net" {
|
|
808
808
|
* on port 8124:
|
809
809
|
*
|
810
810
|
* ```js
|
811
|
-
*
|
811
|
+
* import net from 'node:net';
|
812
812
|
* const server = net.createServer((c) => {
|
813
813
|
* // 'connection' listener.
|
814
814
|
* console.log('client connected');
|
node/os.d.ts
CHANGED
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.7.
|
3
|
+
"version": "22.7.2",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "8376ea7c8f7b17e938afe6a3333c3c4901e0574831c87341327c713768249c73",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|
node/path.d.ts
CHANGED
node/perf_hooks.d.ts
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
|
11
11
|
*
|
12
12
|
* ```js
|
13
|
-
*
|
13
|
+
* import { PerformanceObserver, performance } from 'node:perf_hooks';
|
14
14
|
*
|
15
15
|
* const obs = new PerformanceObserver((items) => {
|
16
16
|
* console.log(items.getEntries()[0].duration);
|
@@ -355,10 +355,10 @@ declare module "perf_hooks" {
|
|
355
355
|
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
|
356
356
|
*
|
357
357
|
* ```js
|
358
|
-
*
|
358
|
+
* import {
|
359
359
|
* performance,
|
360
360
|
* PerformanceObserver,
|
361
|
-
* }
|
361
|
+
* } from 'node:perf_hooks';
|
362
362
|
*
|
363
363
|
* function someFunction() {
|
364
364
|
* console.log('hello world');
|
@@ -397,10 +397,10 @@ declare module "perf_hooks" {
|
|
397
397
|
* with respect to `performanceEntry.startTime`.
|
398
398
|
*
|
399
399
|
* ```js
|
400
|
-
*
|
400
|
+
* import {
|
401
401
|
* performance,
|
402
402
|
* PerformanceObserver,
|
403
|
-
* }
|
403
|
+
* } from 'node:perf_hooks';
|
404
404
|
*
|
405
405
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
406
406
|
* console.log(perfObserverList.getEntries());
|
@@ -440,10 +440,10 @@ declare module "perf_hooks" {
|
|
440
440
|
* equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
|
441
441
|
*
|
442
442
|
* ```js
|
443
|
-
*
|
443
|
+
* import {
|
444
444
|
* performance,
|
445
445
|
* PerformanceObserver,
|
446
|
-
* }
|
446
|
+
* } from 'node:perf_hooks';
|
447
447
|
*
|
448
448
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
449
449
|
* console.log(perfObserverList.getEntriesByName('meow'));
|
@@ -491,10 +491,10 @@ declare module "perf_hooks" {
|
|
491
491
|
* with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.
|
492
492
|
*
|
493
493
|
* ```js
|
494
|
-
*
|
494
|
+
* import {
|
495
495
|
* performance,
|
496
496
|
* PerformanceObserver,
|
497
|
-
* }
|
497
|
+
* } from 'node:perf_hooks';
|
498
498
|
*
|
499
499
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
500
500
|
* console.log(perfObserverList.getEntriesByType('mark'));
|
@@ -544,10 +544,10 @@ declare module "perf_hooks" {
|
|
544
544
|
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
|
545
545
|
*
|
546
546
|
* ```js
|
547
|
-
*
|
547
|
+
* import {
|
548
548
|
* performance,
|
549
549
|
* PerformanceObserver,
|
550
|
-
* }
|
550
|
+
* } from 'node:perf_hooks';
|
551
551
|
*
|
552
552
|
* const obs = new PerformanceObserver((list, observer) => {
|
553
553
|
* // Called once asynchronously. `list` contains three items.
|
@@ -816,7 +816,7 @@ declare module "perf_hooks" {
|
|
816
816
|
* detect.
|
817
817
|
*
|
818
818
|
* ```js
|
819
|
-
*
|
819
|
+
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
820
820
|
* const h = monitorEventLoopDelay({ resolution: 20 });
|
821
821
|
* h.enable();
|
822
822
|
* // Do something.
|
@@ -865,7 +865,7 @@ declare module "perf_hooks" {
|
|
865
865
|
} from "perf_hooks";
|
866
866
|
global {
|
867
867
|
/**
|
868
|
-
* `PerformanceEntry` is a global reference for `
|
868
|
+
* `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'`
|
869
869
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry
|
870
870
|
* @since v19.0.0
|
871
871
|
*/
|
@@ -875,7 +875,7 @@ declare module "perf_hooks" {
|
|
875
875
|
} ? T
|
876
876
|
: typeof _PerformanceEntry;
|
877
877
|
/**
|
878
|
-
* `PerformanceMark` is a global reference for `
|
878
|
+
* `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'`
|
879
879
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark
|
880
880
|
* @since v19.0.0
|
881
881
|
*/
|
@@ -885,7 +885,7 @@ declare module "perf_hooks" {
|
|
885
885
|
} ? T
|
886
886
|
: typeof _PerformanceMark;
|
887
887
|
/**
|
888
|
-
* `PerformanceMeasure` is a global reference for `
|
888
|
+
* `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'`
|
889
889
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure
|
890
890
|
* @since v19.0.0
|
891
891
|
*/
|
@@ -895,7 +895,7 @@ declare module "perf_hooks" {
|
|
895
895
|
} ? T
|
896
896
|
: typeof _PerformanceMeasure;
|
897
897
|
/**
|
898
|
-
* `PerformanceObserver` is a global reference for `
|
898
|
+
* `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'`
|
899
899
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver
|
900
900
|
* @since v19.0.0
|
901
901
|
*/
|
@@ -905,7 +905,7 @@ declare module "perf_hooks" {
|
|
905
905
|
} ? T
|
906
906
|
: typeof _PerformanceObserver;
|
907
907
|
/**
|
908
|
-
* `PerformanceObserverEntryList` is a global reference for `
|
908
|
+
* `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'`
|
909
909
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist
|
910
910
|
* @since v19.0.0
|
911
911
|
*/
|
@@ -915,7 +915,7 @@ declare module "perf_hooks" {
|
|
915
915
|
} ? T
|
916
916
|
: typeof _PerformanceObserverEntryList;
|
917
917
|
/**
|
918
|
-
* `PerformanceResourceTiming` is a global reference for `
|
918
|
+
* `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'`
|
919
919
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming
|
920
920
|
* @since v19.0.0
|
921
921
|
*/
|
@@ -925,7 +925,7 @@ declare module "perf_hooks" {
|
|
925
925
|
} ? T
|
926
926
|
: typeof _PerformanceResourceTiming;
|
927
927
|
/**
|
928
|
-
* `performance` is a global reference for `
|
928
|
+
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
|
929
929
|
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance
|
930
930
|
* @since v16.0.0
|
931
931
|
*/
|
node/punycode.d.ts
CHANGED
node/querystring.d.ts
CHANGED
node/readline/promises.d.ts
CHANGED
@@ -115,7 +115,7 @@ declare module "readline/promises" {
|
|
115
115
|
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
|
116
116
|
*
|
117
117
|
* ```js
|
118
|
-
*
|
118
|
+
* import readlinePromises from 'node:readline/promises';
|
119
119
|
* const rl = readlinePromises.createInterface({
|
120
120
|
* input: process.stdin,
|
121
121
|
* output: process.stdout,
|
node/readline.d.ts
CHANGED
@@ -342,7 +342,7 @@ declare module "readline" {
|
|
342
342
|
* The `readline.createInterface()` method creates a new `readline.Interface` instance.
|
343
343
|
*
|
344
344
|
* ```js
|
345
|
-
*
|
345
|
+
* import readline from 'node:readline';
|
346
346
|
* const rl = readline.createInterface({
|
347
347
|
* input: process.stdin,
|
348
348
|
* output: process.stdout,
|
@@ -398,7 +398,7 @@ declare module "readline" {
|
|
398
398
|
* implement a small command-line interface:
|
399
399
|
*
|
400
400
|
* ```js
|
401
|
-
*
|
401
|
+
* import readline from 'node:readline';
|
402
402
|
* const rl = readline.createInterface({
|
403
403
|
* input: process.stdin,
|
404
404
|
* output: process.stdout,
|
@@ -430,8 +430,8 @@ declare module "readline" {
|
|
430
430
|
* well as a `for await...of` loop:
|
431
431
|
*
|
432
432
|
* ```js
|
433
|
-
*
|
434
|
-
*
|
433
|
+
* import fs from 'node:fs';
|
434
|
+
* import readline from 'node:readline';
|
435
435
|
*
|
436
436
|
* async function processLineByLine() {
|
437
437
|
* const fileStream = fs.createReadStream('input.txt');
|
@@ -455,8 +455,8 @@ declare module "readline" {
|
|
455
455
|
* Alternatively, one could use the `'line'` event:
|
456
456
|
*
|
457
457
|
* ```js
|
458
|
-
*
|
459
|
-
*
|
458
|
+
* import fs from 'node:fs';
|
459
|
+
* import readline from 'node:readline';
|
460
460
|
*
|
461
461
|
* const rl = readline.createInterface({
|
462
462
|
* input: fs.createReadStream('sample.txt'),
|
@@ -471,9 +471,9 @@ declare module "readline" {
|
|
471
471
|
* 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:
|
472
472
|
*
|
473
473
|
* ```js
|
474
|
-
*
|
475
|
-
*
|
476
|
-
*
|
474
|
+
* import { once } from 'node:events';
|
475
|
+
* import { createReadStream } from 'node:fs';
|
476
|
+
* import { createInterface } from 'node:readline';
|
477
477
|
*
|
478
478
|
* (async function processLineByLine() {
|
479
479
|
* try {
|
node/repl.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* applications. It can be accessed using:
|
5
5
|
*
|
6
6
|
* ```js
|
7
|
-
*
|
7
|
+
* import repl from 'node:repl';
|
8
8
|
* ```
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/repl.js)
|
10
10
|
*/
|
@@ -130,7 +130,7 @@ declare module "repl" {
|
|
130
130
|
* or directly using the JavaScript `new` keyword.
|
131
131
|
*
|
132
132
|
* ```js
|
133
|
-
*
|
133
|
+
* import repl from 'node:repl';
|
134
134
|
*
|
135
135
|
* const options = { useColors: true };
|
136
136
|
*
|
@@ -257,7 +257,7 @@ declare module "repl" {
|
|
257
257
|
* The following example shows two new commands added to the REPL instance:
|
258
258
|
*
|
259
259
|
* ```js
|
260
|
-
*
|
260
|
+
* import repl from 'node:repl';
|
261
261
|
*
|
262
262
|
* const replServer = repl.start({ prompt: '> ' });
|
263
263
|
* replServer.defineCommand('sayhello', {
|
@@ -407,7 +407,7 @@ declare module "repl" {
|
|
407
407
|
* If `options` is a string, then it specifies the input prompt:
|
408
408
|
*
|
409
409
|
* ```js
|
410
|
-
*
|
410
|
+
* import repl from 'node:repl';
|
411
411
|
*
|
412
412
|
* // a Unix style prompt
|
413
413
|
* repl.start('$ ');
|