@types/node 20.16.8 → 20.16.10
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 v20.16/README.md +1 -1
- node v20.16/buffer.buffer.d.ts +385 -0
- node v20.16/buffer.d.ts +11 -385
- node v20.16/child_process.d.ts +32 -28
- node v20.16/cluster.d.ts +1 -1
- node v20.16/console.d.ts +2 -2
- node v20.16/crypto.d.ts +3 -3
- node v20.16/dns/promises.d.ts +6 -5
- node v20.16/dns.d.ts +5 -5
- node v20.16/domain.d.ts +2 -2
- node v20.16/fs/promises.d.ts +2 -2
- node v20.16/fs.d.ts +1 -1
- node v20.16/globals.d.ts +0 -14
- node v20.16/globals.typedarray.d.ts +21 -0
- node v20.16/http.d.ts +2 -2
- node v20.16/http2.d.ts +24 -24
- node v20.16/https.d.ts +9 -9
- node v20.16/index.d.ts +5 -1
- node v20.16/module.d.ts +3 -3
- node v20.16/net.d.ts +2 -2
- node v20.16/os.d.ts +1 -1
- node v20.16/package.json +9 -2
- node v20.16/path.d.ts +1 -1
- node v20.16/perf_hooks.d.ts +19 -19
- node v20.16/punycode.d.ts +1 -1
- node v20.16/querystring.d.ts +1 -1
- node v20.16/readline/promises.d.ts +1 -1
- node v20.16/readline.d.ts +9 -9
- node v20.16/repl.d.ts +4 -4
- node v20.16/stream.d.ts +15 -15
- node v20.16/string_decoder.d.ts +3 -3
- node v20.16/timers/promises.d.ts +1 -1
- node v20.16/timers.d.ts +1 -1
- node v20.16/tls.d.ts +5 -5
- node v20.16/trace_events.d.ts +4 -4
- node v20.16/ts5.6/buffer.buffer.d.ts +385 -0
- node v20.16/ts5.6/globals.typedarray.d.ts +19 -0
- node v20.16/ts5.6/index.d.ts +92 -0
- node v20.16/tty.d.ts +1 -1
- node v20.16/url.d.ts +7 -7
- node v20.16/util.d.ts +45 -45
- node v20.16/v8.d.ts +12 -12
- node v20.16/vm.d.ts +11 -12
- node v20.16/worker_threads.d.ts +22 -22
- node v20.16/zlib.d.ts +8 -8
node v20.16/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 v20.16/index.d.ts
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
* IN THE SOFTWARE.
|
23
23
|
*/
|
24
24
|
|
25
|
-
// NOTE: These definitions support NodeJS and TypeScript
|
25
|
+
// NOTE: These definitions support NodeJS and TypeScript 5.7+.
|
26
26
|
|
27
27
|
// Reference required types from the default lib:
|
28
28
|
/// <reference lib="es2020" />
|
@@ -30,6 +30,10 @@
|
|
30
30
|
/// <reference lib="esnext.intl" />
|
31
31
|
/// <reference lib="esnext.bigint" />
|
32
32
|
|
33
|
+
// Definitions specific to TypeScript 5.7+
|
34
|
+
/// <reference path="globals.typedarray.d.ts" />
|
35
|
+
/// <reference path="buffer.buffer.d.ts" />
|
36
|
+
|
33
37
|
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
34
38
|
/// <reference path="assert.d.ts" />
|
35
39
|
/// <reference path="assert/strict.d.ts" />
|
node v20.16/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 v20.16/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/v20.13.1/lib/net.js)
|
14
14
|
*/
|
@@ -812,7 +812,7 @@ declare module "net" {
|
|
812
812
|
* on port 8124:
|
813
813
|
*
|
814
814
|
* ```js
|
815
|
-
*
|
815
|
+
* import net from 'node:net';
|
816
816
|
* const server = net.createServer((c) => {
|
817
817
|
* // 'connection' listener.
|
818
818
|
* console.log('client connected');
|
node v20.16/os.d.ts
CHANGED
node v20.16/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "20.16.
|
3
|
+
"version": "20.16.10",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -203,6 +203,13 @@
|
|
203
203
|
],
|
204
204
|
"main": "",
|
205
205
|
"types": "index.d.ts",
|
206
|
+
"typesVersions": {
|
207
|
+
"<=5.6": {
|
208
|
+
"*": [
|
209
|
+
"ts5.6/*"
|
210
|
+
]
|
211
|
+
}
|
212
|
+
},
|
206
213
|
"repository": {
|
207
214
|
"type": "git",
|
208
215
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
@@ -212,6 +219,6 @@
|
|
212
219
|
"dependencies": {
|
213
220
|
"undici-types": "~6.19.2"
|
214
221
|
},
|
215
|
-
"typesPublisherContentHash": "
|
222
|
+
"typesPublisherContentHash": "2f4c1b55d9201830070bc7c8dcc43b9c8024dc917c1ed90429ecdb7e50018259",
|
216
223
|
"typeScriptVersion": "4.8"
|
217
224
|
}
|
node v20.16/path.d.ts
CHANGED
node v20.16/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);
|
@@ -348,10 +348,10 @@ declare module "perf_hooks" {
|
|
348
348
|
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
|
349
349
|
*
|
350
350
|
* ```js
|
351
|
-
*
|
351
|
+
* import {
|
352
352
|
* performance,
|
353
353
|
* PerformanceObserver,
|
354
|
-
* }
|
354
|
+
* } from 'node:perf_hooks';
|
355
355
|
*
|
356
356
|
* function someFunction() {
|
357
357
|
* console.log('hello world');
|
@@ -390,10 +390,10 @@ declare module "perf_hooks" {
|
|
390
390
|
* with respect to `performanceEntry.startTime`.
|
391
391
|
*
|
392
392
|
* ```js
|
393
|
-
*
|
393
|
+
* import {
|
394
394
|
* performance,
|
395
395
|
* PerformanceObserver,
|
396
|
-
* }
|
396
|
+
* } from 'node:perf_hooks';
|
397
397
|
*
|
398
398
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
399
399
|
* console.log(perfObserverList.getEntries());
|
@@ -433,10 +433,10 @@ declare module "perf_hooks" {
|
|
433
433
|
* equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
|
434
434
|
*
|
435
435
|
* ```js
|
436
|
-
*
|
436
|
+
* import {
|
437
437
|
* performance,
|
438
438
|
* PerformanceObserver,
|
439
|
-
* }
|
439
|
+
* } from 'node:perf_hooks';
|
440
440
|
*
|
441
441
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
442
442
|
* console.log(perfObserverList.getEntriesByName('meow'));
|
@@ -484,10 +484,10 @@ declare module "perf_hooks" {
|
|
484
484
|
* with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.
|
485
485
|
*
|
486
486
|
* ```js
|
487
|
-
*
|
487
|
+
* import {
|
488
488
|
* performance,
|
489
489
|
* PerformanceObserver,
|
490
|
-
* }
|
490
|
+
* } from 'node:perf_hooks';
|
491
491
|
*
|
492
492
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
493
493
|
* console.log(perfObserverList.getEntriesByType('mark'));
|
@@ -537,10 +537,10 @@ declare module "perf_hooks" {
|
|
537
537
|
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
|
538
538
|
*
|
539
539
|
* ```js
|
540
|
-
*
|
540
|
+
* import {
|
541
541
|
* performance,
|
542
542
|
* PerformanceObserver,
|
543
|
-
* }
|
543
|
+
* } from 'node:perf_hooks';
|
544
544
|
*
|
545
545
|
* const obs = new PerformanceObserver((list, observer) => {
|
546
546
|
* // Called once asynchronously. `list` contains three items.
|
@@ -809,7 +809,7 @@ declare module "perf_hooks" {
|
|
809
809
|
* detect.
|
810
810
|
*
|
811
811
|
* ```js
|
812
|
-
*
|
812
|
+
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
813
813
|
* const h = monitorEventLoopDelay({ resolution: 20 });
|
814
814
|
* h.enable();
|
815
815
|
* // Do something.
|
@@ -858,7 +858,7 @@ declare module "perf_hooks" {
|
|
858
858
|
} from "perf_hooks";
|
859
859
|
global {
|
860
860
|
/**
|
861
|
-
* `PerformanceEntry` is a global reference for `
|
861
|
+
* `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:node:perf_hooks'`
|
862
862
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performanceentry
|
863
863
|
* @since v19.0.0
|
864
864
|
*/
|
@@ -868,7 +868,7 @@ declare module "perf_hooks" {
|
|
868
868
|
} ? T
|
869
869
|
: typeof _PerformanceEntry;
|
870
870
|
/**
|
871
|
-
* `PerformanceMark` is a global reference for `
|
871
|
+
* `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:node:perf_hooks'`
|
872
872
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performancemark
|
873
873
|
* @since v19.0.0
|
874
874
|
*/
|
@@ -878,7 +878,7 @@ declare module "perf_hooks" {
|
|
878
878
|
} ? T
|
879
879
|
: typeof _PerformanceMark;
|
880
880
|
/**
|
881
|
-
* `PerformanceMeasure` is a global reference for `
|
881
|
+
* `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:node:perf_hooks'`
|
882
882
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performancemeasure
|
883
883
|
* @since v19.0.0
|
884
884
|
*/
|
@@ -888,7 +888,7 @@ declare module "perf_hooks" {
|
|
888
888
|
} ? T
|
889
889
|
: typeof _PerformanceMeasure;
|
890
890
|
/**
|
891
|
-
* `PerformanceObserver` is a global reference for `
|
891
|
+
* `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:node:perf_hooks'`
|
892
892
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performanceobserver
|
893
893
|
* @since v19.0.0
|
894
894
|
*/
|
@@ -898,7 +898,7 @@ declare module "perf_hooks" {
|
|
898
898
|
} ? T
|
899
899
|
: typeof _PerformanceObserver;
|
900
900
|
/**
|
901
|
-
* `PerformanceObserverEntryList` is a global reference for `
|
901
|
+
* `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:node:perf_hooks'`
|
902
902
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performanceobserverentrylist
|
903
903
|
* @since v19.0.0
|
904
904
|
*/
|
@@ -908,7 +908,7 @@ declare module "perf_hooks" {
|
|
908
908
|
} ? T
|
909
909
|
: typeof _PerformanceObserverEntryList;
|
910
910
|
/**
|
911
|
-
* `PerformanceResourceTiming` is a global reference for `
|
911
|
+
* `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:node:perf_hooks'`
|
912
912
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performanceresourcetiming
|
913
913
|
* @since v19.0.0
|
914
914
|
*/
|
@@ -918,7 +918,7 @@ declare module "perf_hooks" {
|
|
918
918
|
} ? T
|
919
919
|
: typeof _PerformanceResourceTiming;
|
920
920
|
/**
|
921
|
-
* `performance` is a global reference for `
|
921
|
+
* `performance` is a global reference for `import { performance } from 'node:node:perf_hooks'`
|
922
922
|
* @see https://nodejs.org/docs/latest-v20.x/api/globals.html#performance
|
923
923
|
* @since v16.0.0
|
924
924
|
*/
|
node v20.16/punycode.d.ts
CHANGED
node v20.16/querystring.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 v20.16/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 v20.16/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/v20.13.1/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('$ ');
|
node v20.16/stream.d.ts
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* To access the `node:stream` module:
|
11
11
|
*
|
12
12
|
* ```js
|
13
|
-
*
|
13
|
+
* import stream from 'node:stream';
|
14
14
|
* ```
|
15
15
|
*
|
16
16
|
* The `node:stream` module is useful for creating new types of stream instances.
|
@@ -303,7 +303,7 @@ declare module "stream" {
|
|
303
303
|
* the method does nothing.
|
304
304
|
*
|
305
305
|
* ```js
|
306
|
-
*
|
306
|
+
* import fs from 'node:fs';
|
307
307
|
* const readable = getReadableStreamSomehow();
|
308
308
|
* const writable = fs.createWriteStream('file.txt');
|
309
309
|
* // All the data from readable goes into 'file.txt',
|
@@ -341,7 +341,7 @@ declare module "stream" {
|
|
341
341
|
* // Pull off a header delimited by \n\n.
|
342
342
|
* // Use unshift() if we get too much.
|
343
343
|
* // Call the callback with (error, header, stream).
|
344
|
-
*
|
344
|
+
* import { StringDecoder } from 'node:string_decoder';
|
345
345
|
* function parseHeader(stream, callback) {
|
346
346
|
* stream.on('error', callback);
|
347
347
|
* stream.on('readable', onReadable);
|
@@ -399,8 +399,8 @@ declare module "stream" {
|
|
399
399
|
* libraries.
|
400
400
|
*
|
401
401
|
* ```js
|
402
|
-
*
|
403
|
-
*
|
402
|
+
* import { OldReader } from './old-api-module.js';
|
403
|
+
* import { Readable } from 'node:stream';
|
404
404
|
* const oreader = new OldReader();
|
405
405
|
* const myReader = new Readable().wrap(oreader);
|
406
406
|
*
|
@@ -806,7 +806,7 @@ declare module "stream" {
|
|
806
806
|
*
|
807
807
|
* ```js
|
808
808
|
* // Write 'hello, ' and then end with 'world!'.
|
809
|
-
*
|
809
|
+
* import fs from 'node:fs';
|
810
810
|
* const file = fs.createWriteStream('example.txt');
|
811
811
|
* file.write('hello, ');
|
812
812
|
* file.end('world!');
|
@@ -1304,7 +1304,7 @@ declare module "stream" {
|
|
1304
1304
|
* stream, and `controller.error(new AbortError())` for webstreams.
|
1305
1305
|
*
|
1306
1306
|
* ```js
|
1307
|
-
*
|
1307
|
+
* import fs from 'node:fs';
|
1308
1308
|
*
|
1309
1309
|
* const controller = new AbortController();
|
1310
1310
|
* const read = addAbortSignal(
|
@@ -1398,8 +1398,8 @@ declare module "stream" {
|
|
1398
1398
|
* or has experienced an error or a premature close event.
|
1399
1399
|
*
|
1400
1400
|
* ```js
|
1401
|
-
*
|
1402
|
-
*
|
1401
|
+
* import { finished } from 'node:stream';
|
1402
|
+
* import fs from 'node:fs';
|
1403
1403
|
*
|
1404
1404
|
* const rs = fs.createReadStream('archive.tar');
|
1405
1405
|
*
|
@@ -1482,9 +1482,9 @@ declare module "stream" {
|
|
1482
1482
|
* properly cleaning up and provide a callback when the pipeline is complete.
|
1483
1483
|
*
|
1484
1484
|
* ```js
|
1485
|
-
*
|
1486
|
-
*
|
1487
|
-
*
|
1485
|
+
* import { pipeline } from 'node:stream';
|
1486
|
+
* import fs from 'node:fs';
|
1487
|
+
* import zlib from 'node:zlib';
|
1488
1488
|
*
|
1489
1489
|
* // Use the pipeline API to easily pipe a series of streams
|
1490
1490
|
* // together and get notified when the pipeline is fully done.
|
@@ -1524,9 +1524,9 @@ declare module "stream" {
|
|
1524
1524
|
* See the example below:
|
1525
1525
|
*
|
1526
1526
|
* ```js
|
1527
|
-
*
|
1528
|
-
*
|
1529
|
-
*
|
1527
|
+
* import fs from 'node:fs';
|
1528
|
+
* import http from 'node:http';
|
1529
|
+
* import { pipeline } from 'node:stream';
|
1530
1530
|
*
|
1531
1531
|
* const server = http.createServer((req, res) => {
|
1532
1532
|
* const fileStream = fs.createReadStream('./fileNotExist.txt');
|
node v20.16/string_decoder.d.ts
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
* characters. It can be accessed using:
|
5
5
|
*
|
6
6
|
* ```js
|
7
|
-
*
|
7
|
+
* import { StringDecoder } from 'node:string_decoder';
|
8
8
|
* ```
|
9
9
|
*
|
10
10
|
* The following example shows the basic use of the `StringDecoder` class.
|
11
11
|
*
|
12
12
|
* ```js
|
13
|
-
*
|
13
|
+
* import { StringDecoder } from 'node:string_decoder';
|
14
14
|
* const decoder = new StringDecoder('utf8');
|
15
15
|
*
|
16
16
|
* const cent = Buffer.from([0xC2, 0xA2]);
|
@@ -29,7 +29,7 @@
|
|
29
29
|
* symbol (`€`) are written over three separate operations:
|
30
30
|
*
|
31
31
|
* ```js
|
32
|
-
*
|
32
|
+
* import { StringDecoder } from 'node:string_decoder';
|
33
33
|
* const decoder = new StringDecoder('utf8');
|
34
34
|
*
|
35
35
|
* decoder.write(Buffer.from([0xE2]));
|
node v20.16/timers/promises.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* The `timers/promises` API provides an alternative set of timer functions
|
3
|
-
* that return `Promise` objects. The API is accessible via `
|
3
|
+
* that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`.
|
4
4
|
*
|
5
5
|
* ```js
|
6
6
|
* import {
|
node v20.16/timers.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* The `timer` module exposes a global API for scheduling functions to
|
3
3
|
* be called at some future period of time. Because the timer functions are
|
4
|
-
* globals, there is no need to
|
4
|
+
* globals, there is no need to import `node:timers` to use the API.
|
5
5
|
*
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
node v20.16/tls.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* The module can be accessed using:
|
5
5
|
*
|
6
6
|
* ```js
|
7
|
-
*
|
7
|
+
* import tls from 'node:tls';
|
8
8
|
* ```
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/tls.js)
|
10
10
|
*/
|
@@ -1000,8 +1000,8 @@ declare module "tls" {
|
|
1000
1000
|
* The following illustrates a simple echo server:
|
1001
1001
|
*
|
1002
1002
|
* ```js
|
1003
|
-
*
|
1004
|
-
*
|
1003
|
+
* import tls from 'node:tls';
|
1004
|
+
* import fs from 'node:fs';
|
1005
1005
|
*
|
1006
1006
|
* const options = {
|
1007
1007
|
* key: fs.readFileSync('server-key.pem'),
|
@@ -1046,8 +1046,8 @@ declare module "tls" {
|
|
1046
1046
|
*
|
1047
1047
|
* ```js
|
1048
1048
|
* // Assumes an echo server that is listening on port 8000.
|
1049
|
-
*
|
1050
|
-
*
|
1049
|
+
* import tls from 'node:tls';
|
1050
|
+
* import fs from 'node:fs';
|
1051
1051
|
*
|
1052
1052
|
* const options = {
|
1053
1053
|
* // Necessary only if the server requires client certificate authentication.
|
node v20.16/trace_events.d.ts
CHANGED
@@ -53,7 +53,7 @@
|
|
53
53
|
* Alternatively, trace events may be enabled using the `node:trace_events` module:
|
54
54
|
*
|
55
55
|
* ```js
|
56
|
-
*
|
56
|
+
* import trace_events from 'node:trace_events';
|
57
57
|
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
58
58
|
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
59
59
|
*
|
@@ -118,7 +118,7 @@ declare module "trace_events" {
|
|
118
118
|
* will be disabled.
|
119
119
|
*
|
120
120
|
* ```js
|
121
|
-
*
|
121
|
+
* import trace_events from 'node:trace_events';
|
122
122
|
* const t1 = trace_events.createTracing({ categories: ['node', 'v8'] });
|
123
123
|
* const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] });
|
124
124
|
* t1.enable();
|
@@ -159,7 +159,7 @@ declare module "trace_events" {
|
|
159
159
|
* Creates and returns a `Tracing` object for the given set of `categories`.
|
160
160
|
*
|
161
161
|
* ```js
|
162
|
-
*
|
162
|
+
* import trace_events from 'node:trace_events';
|
163
163
|
* const categories = ['node.perf', 'node.async_hooks'];
|
164
164
|
* const tracing = trace_events.createTracing({ categories });
|
165
165
|
* tracing.enable();
|
@@ -178,7 +178,7 @@ declare module "trace_events" {
|
|
178
178
|
* Given the file `test.js` below, the command `node --trace-event-categories node.perf test.js` will print `'node.async_hooks,node.perf'` to the console.
|
179
179
|
*
|
180
180
|
* ```js
|
181
|
-
*
|
181
|
+
* import trace_events from 'node:trace_events';
|
182
182
|
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
183
183
|
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
184
184
|
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|