@types/node 16.4.14 → 16.7.0
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/assert.d.ts +1 -531
- node/async_hooks.d.ts +16 -16
- node/base.d.ts +1 -1
- node/buffer.d.ts +398 -41
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +13 -7
- node/console.d.ts +1 -1
- node/crypto.d.ts +71 -882
- node/dgram.d.ts +17 -8
- node/diagnostics_channel.d.ts +24 -7
- node/dns.d.ts +5 -1
- node/domain.d.ts +2 -2
- node/events.d.ts +183 -4
- node/fs/promises.d.ts +36 -20
- node/fs.d.ts +127 -62
- node/globals.d.ts +24 -13
- node/http.d.ts +67 -13
- node/http2.d.ts +1 -1
- node/https.d.ts +1 -1
- node/index.d.ts +1 -1
- node/inspector.d.ts +4 -5
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +3 -3
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +110 -35
- node/punycode.d.ts +2 -3
- node/querystring.d.ts +2 -2
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream/web.d.ts +6 -0
- node/stream.d.ts +2 -2
- node/string_decoder.d.ts +1 -1
- node/timers/promises.d.ts +0 -45
- node/timers.d.ts +1 -1
- node/tls.d.ts +4 -4
- node/trace_events.d.ts +1 -1
- node/ts3.6/base.d.ts +2 -1
- node/tty.d.ts +4 -4
- node/url.d.ts +37 -76
- node/util.d.ts +3 -3
- node/v8.d.ts +1 -1
- node/vm.d.ts +2 -2
- node/wasi.d.ts +4 -24
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
node/http2.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* const http2 = require('http2');
|
|
7
7
|
* ```
|
|
8
8
|
* @since v8.4.0
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/http2.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'http2' {
|
|
12
12
|
import EventEmitter = require('node:events');
|
node/https.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
|
3
3
|
* separate module.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/https.js)
|
|
5
5
|
*/
|
|
6
6
|
declare module 'https' {
|
|
7
7
|
import { Duplex } from 'node:stream';
|
node/index.d.ts
CHANGED
node/inspector.d.ts
CHANGED
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
* ```js
|
|
16
16
|
* const inspector = require('inspector');
|
|
17
17
|
* ```
|
|
18
|
-
* @
|
|
19
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/inspector.js)
|
|
18
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/inspector.js)
|
|
20
19
|
*/
|
|
21
20
|
declare module 'inspector' {
|
|
22
21
|
import EventEmitter = require('node:events');
|
|
@@ -2697,9 +2696,9 @@ declare module 'inspector' {
|
|
|
2697
2696
|
* and flow control has been passed to the debugger client.
|
|
2698
2697
|
*
|
|
2699
2698
|
* See the `security warning` regarding the `host`parameter usage.
|
|
2700
|
-
* @param port Port to listen on for inspector connections. Optional.
|
|
2701
|
-
* @param host Host to listen on for inspector connections. Optional.
|
|
2702
|
-
* @param wait Block until a client has connected. Optional.
|
|
2699
|
+
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
|
|
2700
|
+
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
|
|
2701
|
+
* @param [wait=false] Block until a client has connected. Optional.
|
|
2703
2702
|
*/
|
|
2704
2703
|
function open(port?: number, host?: string, wait?: boolean): void;
|
|
2705
2704
|
/**
|
node/net.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ```js
|
|
11
11
|
* const net = require('net');
|
|
12
12
|
* ```
|
|
13
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/net.js)
|
|
14
14
|
*/
|
|
15
15
|
declare module 'net' {
|
|
16
16
|
import * as stream from 'node:stream';
|
|
@@ -99,7 +99,7 @@ declare module 'net' {
|
|
|
99
99
|
* * `socket.connect(options[, connectListener])`
|
|
100
100
|
* * `socket.connect(path[, connectListener])` for `IPC` connections.
|
|
101
101
|
* * `socket.connect(port[, host][, connectListener])` for TCP connections.
|
|
102
|
-
* * Returns:
|
|
102
|
+
* * Returns: `net.Socket` The socket itself.
|
|
103
103
|
*
|
|
104
104
|
* This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
|
|
105
105
|
* instead of a `'connect'` event, an `'error'` event will be emitted with
|
node/os.d.ts
CHANGED
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.7.0",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -237,6 +237,6 @@
|
|
|
237
237
|
},
|
|
238
238
|
"scripts": {},
|
|
239
239
|
"dependencies": {},
|
|
240
|
-
"typesPublisherContentHash": "
|
|
241
|
-
"typeScriptVersion": "3.
|
|
240
|
+
"typesPublisherContentHash": "7cd86199c47cc6326c3466fa04e6a7ddc2670bd283713c0c6ef81cfe9e715118",
|
|
241
|
+
"typeScriptVersion": "3.7"
|
|
242
242
|
}
|
node/path.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare module 'path/win32' {
|
|
|
13
13
|
* ```js
|
|
14
14
|
* const path = require('path');
|
|
15
15
|
* ```
|
|
16
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/path.js)
|
|
17
17
|
*/
|
|
18
18
|
declare module 'path' {
|
|
19
19
|
namespace path {
|
node/perf_hooks.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* performance.measure('A to B', 'A', 'B');
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
29
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/perf_hooks.js)
|
|
30
30
|
*/
|
|
31
31
|
declare module 'perf_hooks' {
|
|
32
32
|
import { AsyncResource } from 'node:async_hooks';
|
|
@@ -375,7 +375,7 @@ declare module 'perf_hooks' {
|
|
|
375
375
|
*/
|
|
376
376
|
disconnect(): void;
|
|
377
377
|
/**
|
|
378
|
-
* Subscribes the
|
|
378
|
+
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`:
|
|
379
379
|
*
|
|
380
380
|
* ```js
|
|
381
381
|
* const {
|
|
@@ -545,7 +545,7 @@ declare module 'perf_hooks' {
|
|
|
545
545
|
figures?: number | undefined;
|
|
546
546
|
}
|
|
547
547
|
/**
|
|
548
|
-
* Returns a
|
|
548
|
+
* Returns a `RecordableHistogram`.
|
|
549
549
|
* @since v15.9.0
|
|
550
550
|
*/
|
|
551
551
|
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
node/process.d.ts
CHANGED
|
@@ -87,12 +87,13 @@ declare module 'process' {
|
|
|
87
87
|
| 'SIGBREAK'
|
|
88
88
|
| 'SIGLOST'
|
|
89
89
|
| 'SIGINFO';
|
|
90
|
+
type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection';
|
|
90
91
|
type MultipleResolveType = 'resolve' | 'reject';
|
|
91
92
|
type BeforeExitListener = (code: number) => void;
|
|
92
93
|
type DisconnectListener = () => void;
|
|
93
94
|
type ExitListener = (code: number) => void;
|
|
94
95
|
type RejectionHandledListener = (promise: Promise<unknown>) => void;
|
|
95
|
-
type UncaughtExceptionListener = (error: Error) => void;
|
|
96
|
+
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
|
|
96
97
|
type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<unknown>) => void;
|
|
97
98
|
type WarningListener = (warning: Error) => void;
|
|
98
99
|
type MessageListener = (message: unknown, sendHandle: unknown) => void;
|
|
@@ -244,7 +245,9 @@ declare module 'process' {
|
|
|
244
245
|
* For example, to copy `process.stdin` to `process.stdout`:
|
|
245
246
|
*
|
|
246
247
|
* ```js
|
|
247
|
-
*
|
|
248
|
+
* import { stdin, stdout } from 'process';
|
|
249
|
+
*
|
|
250
|
+
* stdin.pipe(stdout);
|
|
248
251
|
* ```
|
|
249
252
|
*
|
|
250
253
|
* `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information.
|
|
@@ -289,8 +292,10 @@ declare module 'process' {
|
|
|
289
292
|
* For example, assuming the following script for `process-args.js`:
|
|
290
293
|
*
|
|
291
294
|
* ```js
|
|
295
|
+
* import { argv } from 'process';
|
|
296
|
+
*
|
|
292
297
|
* // print process.argv
|
|
293
|
-
*
|
|
298
|
+
* argv.forEach((val, index) => {
|
|
294
299
|
* console.log(`${index}: ${val}`);
|
|
295
300
|
* });
|
|
296
301
|
* ```
|
|
@@ -379,10 +384,12 @@ declare module 'process' {
|
|
|
379
384
|
* the specified `directory` does not exist).
|
|
380
385
|
*
|
|
381
386
|
* ```js
|
|
382
|
-
*
|
|
387
|
+
* import { chdir, cwd } from 'process';
|
|
388
|
+
*
|
|
389
|
+
* console.log(`Starting directory: ${cwd()}`);
|
|
383
390
|
* try {
|
|
384
|
-
*
|
|
385
|
-
* console.log(`New directory: ${
|
|
391
|
+
* chdir('/tmp');
|
|
392
|
+
* console.log(`New directory: ${cwd()}`);
|
|
386
393
|
* } catch (err) {
|
|
387
394
|
* console.error(`chdir: ${err}`);
|
|
388
395
|
* }
|
|
@@ -397,7 +404,9 @@ declare module 'process' {
|
|
|
397
404
|
* process.
|
|
398
405
|
*
|
|
399
406
|
* ```js
|
|
400
|
-
*
|
|
407
|
+
* import { cwd } from 'process';
|
|
408
|
+
*
|
|
409
|
+
* console.log(`Current directory: ${cwd()}`);
|
|
401
410
|
* ```
|
|
402
411
|
* @since v0.1.8
|
|
403
412
|
*/
|
|
@@ -406,6 +415,8 @@ declare module 'process' {
|
|
|
406
415
|
* The port used by the Node.js debugger when enabled.
|
|
407
416
|
*
|
|
408
417
|
* ```js
|
|
418
|
+
* import process from 'process';
|
|
419
|
+
*
|
|
409
420
|
* process.debugPort = 5858;
|
|
410
421
|
* ```
|
|
411
422
|
* @since v0.7.2
|
|
@@ -416,8 +427,10 @@ declare module 'process' {
|
|
|
416
427
|
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
|
|
417
428
|
*
|
|
418
429
|
* ```js
|
|
430
|
+
* import { emitWarning } from 'process';
|
|
431
|
+
*
|
|
419
432
|
* // Emit a warning with a code and additional detail.
|
|
420
|
-
*
|
|
433
|
+
* emitWarning('Something happened!', {
|
|
421
434
|
* code: 'MY_WARNING',
|
|
422
435
|
* detail: 'This is some additional information'
|
|
423
436
|
* });
|
|
@@ -429,6 +442,8 @@ declare module 'process' {
|
|
|
429
442
|
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
|
|
430
443
|
*
|
|
431
444
|
* ```js
|
|
445
|
+
* import process from 'process';
|
|
446
|
+
*
|
|
432
447
|
* process.on('warning', (warning) => {
|
|
433
448
|
* console.warn(warning.name); // 'Warning'
|
|
434
449
|
* console.warn(warning.message); // 'Something happened!'
|
|
@@ -479,8 +494,10 @@ declare module 'process' {
|
|
|
479
494
|
* While the following will:
|
|
480
495
|
*
|
|
481
496
|
* ```js
|
|
482
|
-
*
|
|
483
|
-
*
|
|
497
|
+
* import { env } from 'process';
|
|
498
|
+
*
|
|
499
|
+
* env.foo = 'bar';
|
|
500
|
+
* console.log(env.foo);
|
|
484
501
|
* ```
|
|
485
502
|
*
|
|
486
503
|
* Assigning a property on `process.env` will implicitly convert the value
|
|
@@ -488,28 +505,34 @@ declare module 'process' {
|
|
|
488
505
|
* throw an error when the value is not a string, number, or boolean.
|
|
489
506
|
*
|
|
490
507
|
* ```js
|
|
491
|
-
*
|
|
492
|
-
*
|
|
508
|
+
* import { env } from 'process';
|
|
509
|
+
*
|
|
510
|
+
* env.test = null;
|
|
511
|
+
* console.log(env.test);
|
|
493
512
|
* // => 'null'
|
|
494
|
-
*
|
|
495
|
-
* console.log(
|
|
513
|
+
* env.test = undefined;
|
|
514
|
+
* console.log(env.test);
|
|
496
515
|
* // => 'undefined'
|
|
497
516
|
* ```
|
|
498
517
|
*
|
|
499
518
|
* Use `delete` to delete a property from `process.env`.
|
|
500
519
|
*
|
|
501
520
|
* ```js
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
521
|
+
* import { env } from 'process';
|
|
522
|
+
*
|
|
523
|
+
* env.TEST = 1;
|
|
524
|
+
* delete env.TEST;
|
|
525
|
+
* console.log(env.TEST);
|
|
505
526
|
* // => undefined
|
|
506
527
|
* ```
|
|
507
528
|
*
|
|
508
529
|
* On Windows operating systems, environment variables are case-insensitive.
|
|
509
530
|
*
|
|
510
531
|
* ```js
|
|
511
|
-
*
|
|
512
|
-
*
|
|
532
|
+
* import { env } from 'process';
|
|
533
|
+
*
|
|
534
|
+
* env.TEST = 1;
|
|
535
|
+
* console.log(env.test);
|
|
513
536
|
* // => 1
|
|
514
537
|
* ```
|
|
515
538
|
*
|
|
@@ -532,7 +555,9 @@ declare module 'process' {
|
|
|
532
555
|
* To exit with a 'failure' code:
|
|
533
556
|
*
|
|
534
557
|
* ```js
|
|
535
|
-
* process
|
|
558
|
+
* import { exit } from 'process';
|
|
559
|
+
*
|
|
560
|
+
* exit(1);
|
|
536
561
|
* ```
|
|
537
562
|
*
|
|
538
563
|
* The shell that executed Node.js should see the exit code as `1`.
|
|
@@ -549,10 +574,12 @@ declare module 'process' {
|
|
|
549
574
|
* truncated and lost:
|
|
550
575
|
*
|
|
551
576
|
* ```js
|
|
577
|
+
* import { exit } from 'process';
|
|
578
|
+
*
|
|
552
579
|
* // This is an example of what *not* to do:
|
|
553
580
|
* if (someConditionNotMet()) {
|
|
554
581
|
* printUsageToStdout();
|
|
555
|
-
*
|
|
582
|
+
* exit(1);
|
|
556
583
|
* }
|
|
557
584
|
* ```
|
|
558
585
|
*
|
|
@@ -564,6 +591,8 @@ declare module 'process' {
|
|
|
564
591
|
* scheduling any additional work for the event loop:
|
|
565
592
|
*
|
|
566
593
|
* ```js
|
|
594
|
+
* import process from 'process';
|
|
595
|
+
*
|
|
567
596
|
* // How to properly set the exit code while letting
|
|
568
597
|
* // the process exit gracefully.
|
|
569
598
|
* if (someConditionNotMet()) {
|
|
@@ -597,6 +626,8 @@ declare module 'process' {
|
|
|
597
626
|
* process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).)
|
|
598
627
|
*
|
|
599
628
|
* ```js
|
|
629
|
+
* import process from 'process';
|
|
630
|
+
*
|
|
600
631
|
* if (process.getgid) {
|
|
601
632
|
* console.log(`Current gid: ${process.getgid()}`);
|
|
602
633
|
* }
|
|
@@ -614,6 +645,8 @@ declare module 'process' {
|
|
|
614
645
|
* associated numeric ID.
|
|
615
646
|
*
|
|
616
647
|
* ```js
|
|
648
|
+
* import process from 'process';
|
|
649
|
+
*
|
|
617
650
|
* if (process.getgid && process.setgid) {
|
|
618
651
|
* console.log(`Current gid: ${process.getgid()}`);
|
|
619
652
|
* try {
|
|
@@ -637,6 +670,8 @@ declare module 'process' {
|
|
|
637
670
|
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
|
|
638
671
|
*
|
|
639
672
|
* ```js
|
|
673
|
+
* import process from 'process';
|
|
674
|
+
*
|
|
640
675
|
* if (process.getuid) {
|
|
641
676
|
* console.log(`Current uid: ${process.getuid()}`);
|
|
642
677
|
* }
|
|
@@ -654,6 +689,8 @@ declare module 'process' {
|
|
|
654
689
|
* numeric ID.
|
|
655
690
|
*
|
|
656
691
|
* ```js
|
|
692
|
+
* import process from 'process';
|
|
693
|
+
*
|
|
657
694
|
* if (process.getuid && process.setuid) {
|
|
658
695
|
* console.log(`Current uid: ${process.getuid()}`);
|
|
659
696
|
* try {
|
|
@@ -676,6 +713,8 @@ declare module 'process' {
|
|
|
676
713
|
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
|
|
677
714
|
*
|
|
678
715
|
* ```js
|
|
716
|
+
* import process from 'process';
|
|
717
|
+
*
|
|
679
718
|
* if (process.geteuid) {
|
|
680
719
|
* console.log(`Current uid: ${process.geteuid()}`);
|
|
681
720
|
* }
|
|
@@ -693,6 +732,8 @@ declare module 'process' {
|
|
|
693
732
|
* associated numeric ID.
|
|
694
733
|
*
|
|
695
734
|
* ```js
|
|
735
|
+
* import process from 'process';
|
|
736
|
+
*
|
|
696
737
|
* if (process.geteuid && process.seteuid) {
|
|
697
738
|
* console.log(`Current uid: ${process.geteuid()}`);
|
|
698
739
|
* try {
|
|
@@ -716,6 +757,8 @@ declare module 'process' {
|
|
|
716
757
|
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
|
|
717
758
|
*
|
|
718
759
|
* ```js
|
|
760
|
+
* import process from 'process';
|
|
761
|
+
*
|
|
719
762
|
* if (process.getegid) {
|
|
720
763
|
* console.log(`Current gid: ${process.getegid()}`);
|
|
721
764
|
* }
|
|
@@ -733,6 +776,8 @@ declare module 'process' {
|
|
|
733
776
|
* the associated a numeric ID.
|
|
734
777
|
*
|
|
735
778
|
* ```js
|
|
779
|
+
* import process from 'process';
|
|
780
|
+
*
|
|
736
781
|
* if (process.getegid && process.setegid) {
|
|
737
782
|
* console.log(`Current gid: ${process.getegid()}`);
|
|
738
783
|
* try {
|
|
@@ -757,6 +802,8 @@ declare module 'process' {
|
|
|
757
802
|
* Node.js ensures it always is.
|
|
758
803
|
*
|
|
759
804
|
* ```js
|
|
805
|
+
* import process from 'process';
|
|
806
|
+
*
|
|
760
807
|
* if (process.getgroups) {
|
|
761
808
|
* console.log(process.getgroups()); // [ 16, 21, 297 ]
|
|
762
809
|
* }
|
|
@@ -775,6 +822,8 @@ declare module 'process' {
|
|
|
775
822
|
* The `groups` array can contain numeric group IDs, group names, or both.
|
|
776
823
|
*
|
|
777
824
|
* ```js
|
|
825
|
+
* import process from 'process';
|
|
826
|
+
*
|
|
778
827
|
* if (process.getgroups && process.setgroups) {
|
|
779
828
|
* try {
|
|
780
829
|
* process.setgroups([501]);
|
|
@@ -819,7 +868,9 @@ declare module 'process' {
|
|
|
819
868
|
* The `process.version` property contains the Node.js version string.
|
|
820
869
|
*
|
|
821
870
|
* ```js
|
|
822
|
-
*
|
|
871
|
+
* import { version } from 'process';
|
|
872
|
+
*
|
|
873
|
+
* console.log(`Version: ${version}`);
|
|
823
874
|
* // Version: v14.8.0
|
|
824
875
|
* ```
|
|
825
876
|
*
|
|
@@ -834,7 +885,9 @@ declare module 'process' {
|
|
|
834
885
|
* to load modules that were compiled against a different module ABI version.
|
|
835
886
|
*
|
|
836
887
|
* ```js
|
|
837
|
-
*
|
|
888
|
+
* import { versions } from 'process';
|
|
889
|
+
*
|
|
890
|
+
* console.log(versions);
|
|
838
891
|
* ```
|
|
839
892
|
*
|
|
840
893
|
* Will generate an object similar to:
|
|
@@ -919,6 +972,8 @@ declare module 'process' {
|
|
|
919
972
|
* other than kill the target process.
|
|
920
973
|
*
|
|
921
974
|
* ```js
|
|
975
|
+
* import process, { kill } from 'process';
|
|
976
|
+
*
|
|
922
977
|
* process.on('SIGHUP', () => {
|
|
923
978
|
* console.log('Got SIGHUP signal.');
|
|
924
979
|
* });
|
|
@@ -928,7 +983,7 @@ declare module 'process' {
|
|
|
928
983
|
* process.exit(0);
|
|
929
984
|
* }, 100);
|
|
930
985
|
*
|
|
931
|
-
*
|
|
986
|
+
* kill(process.pid, 'SIGHUP');
|
|
932
987
|
* ```
|
|
933
988
|
*
|
|
934
989
|
* When `SIGUSR1` is received by a Node.js process, Node.js will start the
|
|
@@ -942,7 +997,9 @@ declare module 'process' {
|
|
|
942
997
|
* The `process.pid` property returns the PID of the process.
|
|
943
998
|
*
|
|
944
999
|
* ```js
|
|
945
|
-
*
|
|
1000
|
+
* import { pid } from 'process';
|
|
1001
|
+
*
|
|
1002
|
+
* console.log(`This process is pid ${pid}`);
|
|
946
1003
|
* ```
|
|
947
1004
|
* @since v0.1.15
|
|
948
1005
|
*/
|
|
@@ -952,7 +1009,9 @@ declare module 'process' {
|
|
|
952
1009
|
* current process.
|
|
953
1010
|
*
|
|
954
1011
|
* ```js
|
|
955
|
-
*
|
|
1012
|
+
* import { ppid } from 'process';
|
|
1013
|
+
*
|
|
1014
|
+
* console.log(`The parent process is pid ${ppid}`);
|
|
956
1015
|
* ```
|
|
957
1016
|
* @since v9.2.0, v8.10.0, v6.13.0
|
|
958
1017
|
*/
|
|
@@ -980,7 +1039,9 @@ declare module 'process' {
|
|
|
980
1039
|
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
|
|
981
1040
|
*
|
|
982
1041
|
* ```js
|
|
983
|
-
*
|
|
1042
|
+
* import { arch } from 'process';
|
|
1043
|
+
*
|
|
1044
|
+
* console.log(`This processor architecture is ${arch}`);
|
|
984
1045
|
* ```
|
|
985
1046
|
* @since v0.5.0
|
|
986
1047
|
*/
|
|
@@ -1000,7 +1061,9 @@ declare module 'process' {
|
|
|
1000
1061
|
* * `'win32'`
|
|
1001
1062
|
*
|
|
1002
1063
|
* ```js
|
|
1003
|
-
*
|
|
1064
|
+
* import { platform } from 'process';
|
|
1065
|
+
*
|
|
1066
|
+
* console.log(`This platform is ${platform}`);
|
|
1004
1067
|
* ```
|
|
1005
1068
|
*
|
|
1006
1069
|
* The value `'android'` may also be returned if the Node.js is built on the
|
|
@@ -1032,14 +1095,16 @@ declare module 'process' {
|
|
|
1032
1095
|
* argument to the function, to get a diff reading.
|
|
1033
1096
|
*
|
|
1034
1097
|
* ```js
|
|
1035
|
-
*
|
|
1098
|
+
* import { cpuUsage } from 'process';
|
|
1099
|
+
*
|
|
1100
|
+
* const startUsage = cpuUsage();
|
|
1036
1101
|
* // { user: 38579, system: 6986 }
|
|
1037
1102
|
*
|
|
1038
1103
|
* // spin the CPU for 500 milliseconds
|
|
1039
1104
|
* const now = Date.now();
|
|
1040
1105
|
* while (Date.now() - now < 500);
|
|
1041
1106
|
*
|
|
1042
|
-
* console.log(
|
|
1107
|
+
* console.log(cpuUsage(startUsage));
|
|
1043
1108
|
* // { user: 514883, system: 11226 }
|
|
1044
1109
|
* ```
|
|
1045
1110
|
* @since v6.1.0
|
|
@@ -1054,8 +1119,10 @@ declare module 'process' {
|
|
|
1054
1119
|
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
|
|
1055
1120
|
*
|
|
1056
1121
|
* ```js
|
|
1122
|
+
* import { nextTick } from 'process';
|
|
1123
|
+
*
|
|
1057
1124
|
* console.log('start');
|
|
1058
|
-
*
|
|
1125
|
+
* nextTick(() => {
|
|
1059
1126
|
* console.log('nextTick callback');
|
|
1060
1127
|
* });
|
|
1061
1128
|
* console.log('scheduled');
|
|
@@ -1070,10 +1137,12 @@ declare module 'process' {
|
|
|
1070
1137
|
* I/O has occurred:
|
|
1071
1138
|
*
|
|
1072
1139
|
* ```js
|
|
1140
|
+
* import { nextTick } from 'process';
|
|
1141
|
+
*
|
|
1073
1142
|
* function MyThing(options) {
|
|
1074
1143
|
* this.setupOptions(options);
|
|
1075
1144
|
*
|
|
1076
|
-
*
|
|
1145
|
+
* nextTick(() => {
|
|
1077
1146
|
* this.startDoingStuff();
|
|
1078
1147
|
* });
|
|
1079
1148
|
* }
|
|
@@ -1116,9 +1185,11 @@ declare module 'process' {
|
|
|
1116
1185
|
* The following approach is much better:
|
|
1117
1186
|
*
|
|
1118
1187
|
* ```js
|
|
1188
|
+
* import { nextTick } from 'process';
|
|
1189
|
+
*
|
|
1119
1190
|
* function definitelyAsync(arg, cb) {
|
|
1120
1191
|
* if (arg) {
|
|
1121
|
-
*
|
|
1192
|
+
* nextTick(cb);
|
|
1122
1193
|
* return;
|
|
1123
1194
|
* }
|
|
1124
1195
|
*
|
|
@@ -1246,7 +1317,9 @@ declare module 'process' {
|
|
|
1246
1317
|
* dashes:
|
|
1247
1318
|
*
|
|
1248
1319
|
* ```js
|
|
1249
|
-
*
|
|
1320
|
+
* import { allowedNodeEnvironmentFlags } from 'process';
|
|
1321
|
+
*
|
|
1322
|
+
* allowedNodeEnvironmentFlags.forEach((flag) => {
|
|
1250
1323
|
* // -r
|
|
1251
1324
|
* // --inspect-brk
|
|
1252
1325
|
* // --abort_on_uncaught_exception
|
|
@@ -1270,7 +1343,9 @@ declare module 'process' {
|
|
|
1270
1343
|
report?: ProcessReport | undefined;
|
|
1271
1344
|
/**
|
|
1272
1345
|
* ```js
|
|
1273
|
-
*
|
|
1346
|
+
* import { resourceUsage } from 'process';
|
|
1347
|
+
*
|
|
1348
|
+
* console.log(resourceUsage());
|
|
1274
1349
|
* /*
|
|
1275
1350
|
* Will output:
|
|
1276
1351
|
* {
|
node/punycode.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **The version of the punycode module bundled in Node.js is being deprecated
|
|
3
|
-
* In a future major version of Node.js this module will be removed. Users
|
|
2
|
+
* **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users
|
|
4
3
|
* currently depending on the `punycode` module should switch to using the
|
|
5
4
|
* userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
|
|
6
5
|
* encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
* made available to developers as a convenience. Fixes or other modifications to
|
|
26
25
|
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
|
|
27
26
|
* @deprecated Since v7.0.0 - Deprecated
|
|
28
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
27
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/punycode.js)
|
|
29
28
|
*/
|
|
30
29
|
declare module 'punycode' {
|
|
31
30
|
/**
|
node/querystring.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
9
|
* The `querystring` API is considered Legacy. While it is still maintained,
|
|
10
|
-
* new code should use the
|
|
10
|
+
* new code should use the `URLSearchParams` API instead.
|
|
11
11
|
* @deprecated Legacy
|
|
12
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
12
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/querystring.js)
|
|
13
13
|
*/
|
|
14
14
|
declare module 'querystring' {
|
|
15
15
|
interface StringifyOptions {
|
node/readline.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*
|
|
27
27
|
* 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
|
|
28
28
|
* received on the `input` stream.
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
29
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/readline.js)
|
|
30
30
|
*/
|
|
31
31
|
declare module 'readline' {
|
|
32
32
|
import { Abortable, EventEmitter } from 'node:events';
|
node/repl.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* const repl = require('repl');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/repl.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'repl' {
|
|
12
12
|
import { Interface, Completer, AsyncCompleter } from 'node:readline';
|
node/stream/web.d.ts
ADDED
node/stream.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* The `stream` module is useful for creating new types of stream instances. It is
|
|
16
16
|
* usually not necessary to use the `stream` module to consume streams.
|
|
17
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
17
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/stream.js)
|
|
18
18
|
*/
|
|
19
19
|
declare module 'stream' {
|
|
20
20
|
import { EventEmitter, Abortable } from 'node:events';
|
|
@@ -1007,7 +1007,7 @@ declare module 'stream' {
|
|
|
1007
1007
|
* ```
|
|
1008
1008
|
*
|
|
1009
1009
|
* The `pipeline` API provides a promise version, which can also
|
|
1010
|
-
* receive an options argument as the last parameter with a`signal`
|
|
1010
|
+
* receive an options argument as the last parameter with a`signal` `AbortSignal` property. When the signal is aborted,`destroy` will be called on the underlying pipeline, with
|
|
1011
1011
|
* an`AbortError`.
|
|
1012
1012
|
*
|
|
1013
1013
|
* ```js
|
node/string_decoder.d.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* decoder.write(Buffer.from([0x82]));
|
|
37
37
|
* console.log(decoder.end(Buffer.from([0xAC])));
|
|
38
38
|
* ```
|
|
39
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
39
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/string_decoder.js)
|
|
40
40
|
*/
|
|
41
41
|
declare module 'string_decoder' {
|
|
42
42
|
class StringDecoder {
|