@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/child_process.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* is primarily provided by the {@link spawn} function:
|
5
5
|
*
|
6
6
|
* ```js
|
7
|
-
*
|
7
|
+
* import { spawn } from 'node:child_process';
|
8
8
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
9
9
|
*
|
10
10
|
* ls.stdout.on('data', (data) => {
|
@@ -109,7 +109,7 @@ declare module "child_process" {
|
|
109
109
|
* refer to the same value.
|
110
110
|
*
|
111
111
|
* ```js
|
112
|
-
*
|
112
|
+
* import { spawn } from 'node:child_process';
|
113
113
|
*
|
114
114
|
* const subprocess = spawn('ls');
|
115
115
|
*
|
@@ -152,9 +152,9 @@ declare module "child_process" {
|
|
152
152
|
* in the array are `null`.
|
153
153
|
*
|
154
154
|
* ```js
|
155
|
-
*
|
156
|
-
*
|
157
|
-
*
|
155
|
+
* import assert from 'node:assert';
|
156
|
+
* import fs from 'node:fs';
|
157
|
+
* import child_process from 'node:child_process';
|
158
158
|
*
|
159
159
|
* const subprocess = child_process.spawn('ls', {
|
160
160
|
* stdio: [
|
@@ -202,7 +202,7 @@ declare module "child_process" {
|
|
202
202
|
* emitted.
|
203
203
|
*
|
204
204
|
* ```js
|
205
|
-
*
|
205
|
+
* import { spawn } from 'node:child_process';
|
206
206
|
* const grep = spawn('grep', ['ssh']);
|
207
207
|
*
|
208
208
|
* console.log(`Spawned child pid: ${grep.pid}`);
|
@@ -249,7 +249,7 @@ declare module "child_process" {
|
|
249
249
|
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
|
250
250
|
*
|
251
251
|
* ```js
|
252
|
-
*
|
252
|
+
* import { spawn } from 'node:child_process';
|
253
253
|
* const grep = spawn('grep', ['ssh']);
|
254
254
|
*
|
255
255
|
* grep.on('close', (code, signal) => {
|
@@ -282,7 +282,7 @@ declare module "child_process" {
|
|
282
282
|
*
|
283
283
|
* ```js
|
284
284
|
* 'use strict';
|
285
|
-
*
|
285
|
+
* import { spawn } from 'node:child_process';
|
286
286
|
*
|
287
287
|
* const subprocess = spawn(
|
288
288
|
* 'sh',
|
@@ -320,7 +320,7 @@ declare module "child_process" {
|
|
320
320
|
* For example, in the parent script:
|
321
321
|
*
|
322
322
|
* ```js
|
323
|
-
*
|
323
|
+
* import cp from 'node:child_process';
|
324
324
|
* const n = cp.fork(`${__dirname}/sub.js`);
|
325
325
|
*
|
326
326
|
* n.on('message', (m) => {
|
@@ -374,10 +374,12 @@ declare module "child_process" {
|
|
374
374
|
* a TCP server object to the child process as illustrated in the example below:
|
375
375
|
*
|
376
376
|
* ```js
|
377
|
-
*
|
377
|
+
* import child_process from 'node:child_process';
|
378
|
+
* const subprocess = child_process.fork('subprocess.js');
|
378
379
|
*
|
379
380
|
* // Open up the server object and send the handle.
|
380
|
-
*
|
381
|
+
* import net from 'node:net';
|
382
|
+
* const server = net.createServer();
|
381
383
|
* server.on('connection', (socket) => {
|
382
384
|
* socket.end('handled by parent');
|
383
385
|
* });
|
@@ -412,13 +414,14 @@ declare module "child_process" {
|
|
412
414
|
* handle connections with "normal" or "special" priority:
|
413
415
|
*
|
414
416
|
* ```js
|
415
|
-
*
|
417
|
+
* import { fork } from 'node:child_process';
|
416
418
|
* const normal = fork('subprocess.js', ['normal']);
|
417
419
|
* const special = fork('subprocess.js', ['special']);
|
418
420
|
*
|
419
421
|
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
420
422
|
* // the sockets from being read before they are sent to the child process.
|
421
|
-
*
|
423
|
+
* import net from 'node:net';
|
424
|
+
* const server = net.createServer({ pauseOnConnect: true });
|
422
425
|
* server.on('connection', (socket) => {
|
423
426
|
*
|
424
427
|
* // If this is special priority...
|
@@ -490,7 +493,7 @@ declare module "child_process" {
|
|
490
493
|
* the child and the parent.
|
491
494
|
*
|
492
495
|
* ```js
|
493
|
-
*
|
496
|
+
* import { spawn } from 'node:child_process';
|
494
497
|
*
|
495
498
|
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
496
499
|
* detached: true,
|
@@ -508,7 +511,7 @@ declare module "child_process" {
|
|
508
511
|
* to wait for the child to exit before exiting itself.
|
509
512
|
*
|
510
513
|
* ```js
|
511
|
-
*
|
514
|
+
* import { spawn } from 'node:child_process';
|
512
515
|
*
|
513
516
|
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
514
517
|
* detached: true,
|
@@ -711,7 +714,7 @@ declare module "child_process" {
|
|
711
714
|
* exit code:
|
712
715
|
*
|
713
716
|
* ```js
|
714
|
-
*
|
717
|
+
* import { spawn } from 'node:child_process';
|
715
718
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
716
719
|
*
|
717
720
|
* ls.stdout.on('data', (data) => {
|
@@ -730,7 +733,7 @@ declare module "child_process" {
|
|
730
733
|
* Example: A very elaborate way to run `ps ax | grep ssh`
|
731
734
|
*
|
732
735
|
* ```js
|
733
|
-
*
|
736
|
+
* import { spawn } from 'node:child_process';
|
734
737
|
* const ps = spawn('ps', ['ax']);
|
735
738
|
* const grep = spawn('grep', ['ssh']);
|
736
739
|
*
|
@@ -767,7 +770,7 @@ declare module "child_process" {
|
|
767
770
|
* Example of checking for failed `spawn`:
|
768
771
|
*
|
769
772
|
* ```js
|
770
|
-
*
|
773
|
+
* import { spawn } from 'node:child_process';
|
771
774
|
* const subprocess = spawn('bad_command');
|
772
775
|
*
|
773
776
|
* subprocess.on('error', (err) => {
|
@@ -785,7 +788,7 @@ declare module "child_process" {
|
|
785
788
|
* the error passed to the callback will be an `AbortError`:
|
786
789
|
*
|
787
790
|
* ```js
|
788
|
-
*
|
791
|
+
* import { spawn } from 'node:child_process';
|
789
792
|
* const controller = new AbortController();
|
790
793
|
* const { signal } = controller;
|
791
794
|
* const grep = spawn('grep', ['ssh'], { signal });
|
@@ -906,7 +909,7 @@ declare module "child_process" {
|
|
906
909
|
* need to be dealt with accordingly:
|
907
910
|
*
|
908
911
|
* ```js
|
909
|
-
*
|
912
|
+
* import { exec } from 'node:child_process';
|
910
913
|
*
|
911
914
|
* exec('"/path/to/test file/test.sh" arg1 arg2');
|
912
915
|
* // Double quotes are used so that the space in the path is not interpreted as
|
@@ -932,7 +935,7 @@ declare module "child_process" {
|
|
932
935
|
* encoding, `Buffer` objects will be passed to the callback instead.
|
933
936
|
*
|
934
937
|
* ```js
|
935
|
-
*
|
938
|
+
* import { exec } from 'node:child_process';
|
936
939
|
* exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
|
937
940
|
* if (error) {
|
938
941
|
* console.error(`exec error: ${error}`);
|
@@ -957,8 +960,9 @@ declare module "child_process" {
|
|
957
960
|
* callback, but with two additional properties `stdout` and `stderr`.
|
958
961
|
*
|
959
962
|
* ```js
|
960
|
-
*
|
961
|
-
*
|
963
|
+
* import util from 'node:util';
|
964
|
+
* import child_process from 'node:child_process';
|
965
|
+
* const exec = util.promisify(child_process.exec);
|
962
966
|
*
|
963
967
|
* async function lsExample() {
|
964
968
|
* const { stdout, stderr } = await exec('ls');
|
@@ -972,7 +976,7 @@ declare module "child_process" {
|
|
972
976
|
* the error passed to the callback will be an `AbortError`:
|
973
977
|
*
|
974
978
|
* ```js
|
975
|
-
*
|
979
|
+
* import { exec } from 'node:child_process';
|
976
980
|
* const controller = new AbortController();
|
977
981
|
* const { signal } = controller;
|
978
982
|
* const child = exec('grep ssh', { signal }, (error) => {
|
@@ -1096,7 +1100,7 @@ declare module "child_process" {
|
|
1096
1100
|
* supported.
|
1097
1101
|
*
|
1098
1102
|
* ```js
|
1099
|
-
*
|
1103
|
+
* import { execFile } from 'node:child_process';
|
1100
1104
|
* const child = execFile('node', ['--version'], (error, stdout, stderr) => {
|
1101
1105
|
* if (error) {
|
1102
1106
|
* throw error;
|
@@ -1119,7 +1123,7 @@ declare module "child_process" {
|
|
1119
1123
|
* callback, but with two additional properties `stdout` and `stderr`.
|
1120
1124
|
*
|
1121
1125
|
* ```js
|
1122
|
-
*
|
1126
|
+
* import util from 'node:util';
|
1123
1127
|
* const execFile = util.promisify(require('node:child_process').execFile);
|
1124
1128
|
* async function getVersion() {
|
1125
1129
|
* const { stdout } = await execFile('node', ['--version']);
|
@@ -1136,7 +1140,7 @@ declare module "child_process" {
|
|
1136
1140
|
* the error passed to the callback will be an `AbortError`:
|
1137
1141
|
*
|
1138
1142
|
* ```js
|
1139
|
-
*
|
1143
|
+
* import { execFile } from 'node:child_process';
|
1140
1144
|
* const controller = new AbortController();
|
1141
1145
|
* const { signal } = controller;
|
1142
1146
|
* const child = execFile('node', ['--version'], { signal }, (error) => {
|
@@ -1377,7 +1381,7 @@ declare module "child_process" {
|
|
1377
1381
|
* console.log(`Hello from ${process.argv[2]}!`);
|
1378
1382
|
* }, 1_000);
|
1379
1383
|
* } else {
|
1380
|
-
*
|
1384
|
+
* import { fork } from 'node:child_process';
|
1381
1385
|
* const controller = new AbortController();
|
1382
1386
|
* const { signal } = controller;
|
1383
1387
|
* const child = fork(__filename, ['child'], { signal });
|
node v20.16/cluster.d.ts
CHANGED
@@ -231,6 +231,7 @@ declare module "cluster" {
|
|
231
231
|
* the `'disconnect'` event has not been emitted after some time.
|
232
232
|
*
|
233
233
|
* ```js
|
234
|
+
* import net from 'node:net';
|
234
235
|
* if (cluster.isPrimary) {
|
235
236
|
* const worker = cluster.fork();
|
236
237
|
* let timeout;
|
@@ -248,7 +249,6 @@ declare module "cluster" {
|
|
248
249
|
* });
|
249
250
|
*
|
250
251
|
* } else if (cluster.isWorker) {
|
251
|
-
* const net = require('node:net');
|
252
252
|
* const server = net.createServer((socket) => {
|
253
253
|
* // Connections never end
|
254
254
|
* });
|
node v20.16/console.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
*
|
7
7
|
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
8
8
|
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
|
9
|
-
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without
|
9
|
+
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
10
10
|
*
|
11
11
|
* _**Warning**_: The global console object's methods are neither consistently
|
12
12
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
@@ -362,7 +362,7 @@ declare module "node:console" {
|
|
362
362
|
*
|
363
363
|
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
364
364
|
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
|
365
|
-
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without
|
365
|
+
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
366
366
|
*
|
367
367
|
* _**Warning**_: The global console object's methods are neither consistently
|
368
368
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
node v20.16/crypto.d.ts
CHANGED
@@ -3389,8 +3389,8 @@ declare module "crypto" {
|
|
3389
3389
|
* Example:
|
3390
3390
|
*
|
3391
3391
|
* ```js
|
3392
|
-
*
|
3393
|
-
*
|
3392
|
+
* import crypto from 'node:crypto';
|
3393
|
+
* import { Buffer } from 'node:buffer';
|
3394
3394
|
*
|
3395
3395
|
* // Hashing a string and return the result as a hex-encoded string.
|
3396
3396
|
* const string = 'Node.js';
|
@@ -4107,7 +4107,7 @@ declare module "crypto" {
|
|
4107
4107
|
saltLength: number;
|
4108
4108
|
}
|
4109
4109
|
/**
|
4110
|
-
*
|
4110
|
+
* Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
|
4111
4111
|
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
4112
4112
|
* @since v15.0.0
|
4113
4113
|
*/
|
node v20.16/dns/promises.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
3
3
|
* that return `Promise` objects rather than using callbacks. The API is accessible
|
4
|
-
* via `
|
4
|
+
* via `import { promises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
|
5
5
|
* @since v10.6.0
|
6
6
|
*/
|
7
7
|
declare module "dns/promises" {
|
@@ -60,7 +60,7 @@ declare module "dns/promises" {
|
|
60
60
|
* Example usage:
|
61
61
|
*
|
62
62
|
* ```js
|
63
|
-
*
|
63
|
+
* import dns from 'node:dns';
|
64
64
|
* const dnsPromises = dns.promises;
|
65
65
|
* const options = {
|
66
66
|
* family: 6,
|
@@ -96,8 +96,8 @@ declare module "dns/promises" {
|
|
96
96
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
97
97
|
*
|
98
98
|
* ```js
|
99
|
-
*
|
100
|
-
*
|
99
|
+
* import dns from 'node:dns';
|
100
|
+
* dns.promises.lookupService('127.0.0.1', 22).then((result) => {
|
101
101
|
* console.log(result.hostname, result.service);
|
102
102
|
* // Prints: localhost ssh
|
103
103
|
* });
|
@@ -394,7 +394,8 @@ declare module "dns/promises" {
|
|
394
394
|
* other resolvers:
|
395
395
|
*
|
396
396
|
* ```js
|
397
|
-
*
|
397
|
+
* import dns from 'node:dns';
|
398
|
+
* const { Resolver } = dns.promises;
|
398
399
|
* const resolver = new Resolver();
|
399
400
|
* resolver.setServers(['4.4.4.4']);
|
400
401
|
*
|
node v20.16/dns.d.ts
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
* system do, use {@link lookup}.
|
10
10
|
*
|
11
11
|
* ```js
|
12
|
-
*
|
12
|
+
* import dns from 'node:dns';
|
13
13
|
*
|
14
14
|
* dns.lookup('example.org', (err, address, family) => {
|
15
15
|
* console.log('address: %j family: IPv%s', address, family);
|
@@ -23,7 +23,7 @@
|
|
23
23
|
* DNS queries, bypassing other name-resolution facilities.
|
24
24
|
*
|
25
25
|
* ```js
|
26
|
-
*
|
26
|
+
* import dns from 'node:dns';
|
27
27
|
*
|
28
28
|
* dns.resolve4('archive.org', (err, addresses) => {
|
29
29
|
* if (err) throw err;
|
@@ -138,7 +138,7 @@ declare module "dns" {
|
|
138
138
|
* Example usage:
|
139
139
|
*
|
140
140
|
* ```js
|
141
|
-
*
|
141
|
+
* import dns from 'node:dns';
|
142
142
|
* const options = {
|
143
143
|
* family: 6,
|
144
144
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
@@ -198,7 +198,7 @@ declare module "dns" {
|
|
198
198
|
* where `err.code` is the error code.
|
199
199
|
*
|
200
200
|
* ```js
|
201
|
-
*
|
201
|
+
* import dns from 'node:dns';
|
202
202
|
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
203
203
|
* console.log(hostname, service);
|
204
204
|
* // Prints: localhost ssh
|
@@ -786,7 +786,7 @@ declare module "dns" {
|
|
786
786
|
* other resolvers:
|
787
787
|
*
|
788
788
|
* ```js
|
789
|
-
*
|
789
|
+
* import { Resolver } from 'node:dns';
|
790
790
|
* const resolver = new Resolver();
|
791
791
|
* resolver.setServers(['4.4.4.4']);
|
792
792
|
*
|
node v20.16/domain.d.ts
CHANGED
@@ -63,8 +63,8 @@ declare module "domain" {
|
|
63
63
|
* This is the most basic way to use a domain.
|
64
64
|
*
|
65
65
|
* ```js
|
66
|
-
*
|
67
|
-
*
|
66
|
+
* import domain from 'node:domain';
|
67
|
+
* import fs from 'node:fs';
|
68
68
|
* const d = domain.create();
|
69
69
|
* d.on('error', (er) => {
|
70
70
|
* console.error('Caught error!', er);
|
node v20.16/fs/promises.d.ts
CHANGED
@@ -929,7 +929,7 @@ declare module "fs/promises" {
|
|
929
929
|
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
930
930
|
* characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing
|
931
931
|
* platform-specific path separator
|
932
|
-
* (`
|
932
|
+
* (`import { sep } from 'node:node:path'`).
|
933
933
|
* @since v10.0.0
|
934
934
|
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
|
935
935
|
*/
|
@@ -1171,7 +1171,7 @@ declare module "fs/promises" {
|
|
1171
1171
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
1172
1172
|
*
|
1173
1173
|
* ```js
|
1174
|
-
*
|
1174
|
+
* import { watch } from 'node:fs/promises';
|
1175
1175
|
*
|
1176
1176
|
* const ac = new AbortController();
|
1177
1177
|
* const { signal } = ac;
|
node v20.16/fs.d.ts
CHANGED
@@ -1898,7 +1898,7 @@ declare module "fs" {
|
|
1898
1898
|
* The `fs.mkdtemp()` method will append the six randomly selected characters
|
1899
1899
|
* directly to the `prefix` string. For instance, given a directory `/tmp`, if the
|
1900
1900
|
* intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator
|
1901
|
-
* (`
|
1901
|
+
* (`import { sep } from 'node:node:path'`).
|
1902
1902
|
*
|
1903
1903
|
* ```js
|
1904
1904
|
* import { tmpdir } from 'node:os';
|
node v20.16/globals.d.ts
CHANGED
@@ -400,20 +400,6 @@ declare global {
|
|
400
400
|
unref(): this;
|
401
401
|
}
|
402
402
|
|
403
|
-
type TypedArray =
|
404
|
-
| Uint8Array
|
405
|
-
| Uint8ClampedArray
|
406
|
-
| Uint16Array
|
407
|
-
| Uint32Array
|
408
|
-
| Int8Array
|
409
|
-
| Int16Array
|
410
|
-
| Int32Array
|
411
|
-
| BigUint64Array
|
412
|
-
| BigInt64Array
|
413
|
-
| Float32Array
|
414
|
-
| Float64Array;
|
415
|
-
type ArrayBufferView = TypedArray | DataView;
|
416
|
-
|
417
403
|
interface Require {
|
418
404
|
(id: string): any;
|
419
405
|
resolve: RequireResolve;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export {}; // Make this a module
|
2
|
+
|
3
|
+
declare global {
|
4
|
+
namespace NodeJS {
|
5
|
+
type TypedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
6
|
+
| Uint8Array<TArrayBuffer>
|
7
|
+
| Uint8ClampedArray<TArrayBuffer>
|
8
|
+
| Uint16Array<TArrayBuffer>
|
9
|
+
| Uint32Array<TArrayBuffer>
|
10
|
+
| Int8Array<TArrayBuffer>
|
11
|
+
| Int16Array<TArrayBuffer>
|
12
|
+
| Int32Array<TArrayBuffer>
|
13
|
+
| BigUint64Array<TArrayBuffer>
|
14
|
+
| BigInt64Array<TArrayBuffer>
|
15
|
+
| Float32Array<TArrayBuffer>
|
16
|
+
| Float64Array<TArrayBuffer>;
|
17
|
+
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
18
|
+
| TypedArray<TArrayBuffer>
|
19
|
+
| DataView<TArrayBuffer>;
|
20
|
+
}
|
21
|
+
}
|
node v20.16/http.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* To use the HTTP server and client one must `
|
2
|
+
* To use the HTTP server and client one must import the `node:http` module.
|
3
3
|
*
|
4
4
|
* The HTTP interfaces in Node.js are designed to support many features
|
5
5
|
* of the protocol which have been traditionally difficult to use.
|
@@ -1447,7 +1447,7 @@ declare module "http" {
|
|
1447
1447
|
* To configure any of them, a custom {@link Agent} instance must be created.
|
1448
1448
|
*
|
1449
1449
|
* ```js
|
1450
|
-
*
|
1450
|
+
* import http from 'node:http';
|
1451
1451
|
* const keepAliveAgent = new http.Agent({ keepAlive: true });
|
1452
1452
|
* options.agent = keepAliveAgent;
|
1453
1453
|
* http.request(options, onResponseCallback)
|
node v20.16/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/v20.13.1/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
|