@types/node 18.19.52 → 18.19.54
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 v18.19/README.md +1 -1
- node v18.19/buffer.buffer.d.ts +385 -0
- node v18.19/buffer.d.ts +10 -384
- node v18.19/child_process.d.ts +35 -30
- node v18.19/cluster.d.ts +1 -1
- node v18.19/console.d.ts +2 -2
- node v18.19/crypto.d.ts +1 -1
- node v18.19/dns/promises.d.ts +6 -5
- node v18.19/dns.d.ts +5 -5
- node v18.19/domain.d.ts +2 -2
- node v18.19/events.d.ts +13 -13
- node v18.19/fs/promises.d.ts +2 -2
- node v18.19/fs.d.ts +1 -1
- node v18.19/globals.d.ts +0 -14
- node v18.19/globals.typedarray.d.ts +21 -0
- node v18.19/http.d.ts +4 -4
- node v18.19/http2.d.ts +24 -24
- node v18.19/https.d.ts +9 -9
- node v18.19/index.d.ts +5 -1
- node v18.19/inspector.d.ts +1 -1
- node v18.19/module.d.ts +3 -3
- node v18.19/net.d.ts +2 -2
- node v18.19/os.d.ts +1 -1
- node v18.19/package.json +9 -2
- node v18.19/path.d.ts +1 -1
- node v18.19/perf_hooks.d.ts +11 -11
- node v18.19/punycode.d.ts +1 -1
- node v18.19/querystring.d.ts +1 -1
- node v18.19/readline/promises.d.ts +1 -1
- node v18.19/readline.d.ts +18 -18
- node v18.19/repl.d.ts +4 -4
- node v18.19/stream.d.ts +21 -21
- node v18.19/string_decoder.d.ts +3 -3
- node v18.19/timers/promises.d.ts +1 -1
- node v18.19/timers.d.ts +1 -1
- node v18.19/tls.d.ts +5 -5
- node v18.19/trace_events.d.ts +3 -3
- node v18.19/ts5.6/buffer.buffer.d.ts +385 -0
- node v18.19/ts5.6/globals.typedarray.d.ts +19 -0
- node v18.19/ts5.6/index.d.ts +91 -0
- node v18.19/tty.d.ts +1 -1
- node v18.19/url.d.ts +7 -7
- node v18.19/util.d.ts +41 -41
- node v18.19/v8.d.ts +12 -12
- node v18.19/vm.d.ts +11 -12
- node v18.19/worker_threads.d.ts +22 -22
- node v18.19/zlib.d.ts +8 -8
node v18.19/worker_threads.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* in parallel. To access it:
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
*
|
|
6
|
+
* import worker from 'node:worker_threads';
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
9
|
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer`instances.
|
|
15
15
|
*
|
|
16
16
|
* ```js
|
|
17
|
-
*
|
|
17
|
+
* import {
|
|
18
18
|
* Worker, isMainThread, parentPort, workerData
|
|
19
|
-
* }
|
|
19
|
+
* } from 'node:worker_threads';
|
|
20
|
+
* import { parse } from 'some-js-parsing-library';
|
|
20
21
|
*
|
|
21
22
|
* if (isMainThread) {
|
|
22
23
|
* module.exports = function parseJSAsync(script) {
|
|
@@ -33,7 +34,6 @@
|
|
|
33
34
|
* });
|
|
34
35
|
* };
|
|
35
36
|
* } else {
|
|
36
|
-
* const { parse } = require('some-js-parsing-library');
|
|
37
37
|
* const script = workerData;
|
|
38
38
|
* parentPort.postMessage(parse(script));
|
|
39
39
|
* }
|
|
@@ -72,7 +72,7 @@ declare module "worker_threads" {
|
|
|
72
72
|
* The `MessageChannel` has no methods of its own. `new MessageChannel()`yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
|
|
73
73
|
*
|
|
74
74
|
* ```js
|
|
75
|
-
*
|
|
75
|
+
* import { MessageChannel } from 'node:worker_threads';
|
|
76
76
|
*
|
|
77
77
|
* const { port1, port2 } = new MessageChannel();
|
|
78
78
|
* port1.on('message', (message) => console.log('received', message));
|
|
@@ -121,7 +121,7 @@ declare module "worker_threads" {
|
|
|
121
121
|
* * `value` may not contain native (C++-backed) objects other than:
|
|
122
122
|
*
|
|
123
123
|
* ```js
|
|
124
|
-
*
|
|
124
|
+
* import { MessageChannel } from 'node:worker_threads';
|
|
125
125
|
* const { port1, port2 } = new MessageChannel();
|
|
126
126
|
*
|
|
127
127
|
* port1.on('message', (message) => console.log(message));
|
|
@@ -143,7 +143,7 @@ declare module "worker_threads" {
|
|
|
143
143
|
* `value` may still contain `ArrayBuffer` instances that are not in`transferList`; in that case, the underlying memory is copied rather than moved.
|
|
144
144
|
*
|
|
145
145
|
* ```js
|
|
146
|
-
*
|
|
146
|
+
* import { MessageChannel } from 'node:worker_threads';
|
|
147
147
|
* const { port1, port2 } = new MessageChannel();
|
|
148
148
|
*
|
|
149
149
|
* port1.on('message', (message) => console.log(message));
|
|
@@ -298,8 +298,8 @@ declare module "worker_threads" {
|
|
|
298
298
|
* Notable differences inside a Worker environment are:
|
|
299
299
|
*
|
|
300
300
|
* * The `process.stdin`, `process.stdout` and `process.stderr` may be redirected by the parent thread.
|
|
301
|
-
* * The `
|
|
302
|
-
* * The `
|
|
301
|
+
* * The `import { isMainThread } from 'node:worker_threads'` property is set to `false`.
|
|
302
|
+
* * The `import { parentPort } from 'node:worker_threads'` message port is available.
|
|
303
303
|
* * `process.exit()` does not stop the whole program, just the single thread,
|
|
304
304
|
* and `process.abort()` is not available.
|
|
305
305
|
* * `process.chdir()` and `process` methods that set group or user ids
|
|
@@ -333,10 +333,10 @@ declare module "worker_threads" {
|
|
|
333
333
|
* the thread barrier.
|
|
334
334
|
*
|
|
335
335
|
* ```js
|
|
336
|
-
*
|
|
337
|
-
*
|
|
336
|
+
* import assert from 'node:assert';
|
|
337
|
+
* import {
|
|
338
338
|
* Worker, MessageChannel, MessagePort, isMainThread, parentPort
|
|
339
|
-
* }
|
|
339
|
+
* } from 'node:worker_threads';
|
|
340
340
|
* if (isMainThread) {
|
|
341
341
|
* const worker = new Worker(__filename);
|
|
342
342
|
* const subChannel = new MessageChannel();
|
|
@@ -376,7 +376,7 @@ declare module "worker_threads" {
|
|
|
376
376
|
readonly stderr: Readable;
|
|
377
377
|
/**
|
|
378
378
|
* An integer identifier for the referenced thread. Inside the worker thread,
|
|
379
|
-
* it is available as `
|
|
379
|
+
* it is available as `import { threadId } from 'node:worker_threads'`.
|
|
380
380
|
* This value is unique for each `Worker` instance inside a single process.
|
|
381
381
|
* @since v10.5.0
|
|
382
382
|
*/
|
|
@@ -494,11 +494,11 @@ declare module "worker_threads" {
|
|
|
494
494
|
* ```js
|
|
495
495
|
* 'use strict';
|
|
496
496
|
*
|
|
497
|
-
*
|
|
497
|
+
* import {
|
|
498
498
|
* isMainThread,
|
|
499
499
|
* BroadcastChannel,
|
|
500
500
|
* Worker
|
|
501
|
-
* }
|
|
501
|
+
* } from 'node:worker_threads';
|
|
502
502
|
*
|
|
503
503
|
* const bc = new BroadcastChannel('hello');
|
|
504
504
|
*
|
|
@@ -552,7 +552,7 @@ declare module "worker_threads" {
|
|
|
552
552
|
* This operation cannot be undone.
|
|
553
553
|
*
|
|
554
554
|
* ```js
|
|
555
|
-
*
|
|
555
|
+
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
|
|
556
556
|
*
|
|
557
557
|
* const pooledBuffer = new ArrayBuffer(8);
|
|
558
558
|
* const typedArray1 = new Uint8Array(pooledBuffer);
|
|
@@ -597,7 +597,7 @@ declare module "worker_threads" {
|
|
|
597
597
|
* that contains the message payload, corresponding to the oldest message in the`MessagePort`’s queue.
|
|
598
598
|
*
|
|
599
599
|
* ```js
|
|
600
|
-
*
|
|
600
|
+
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
|
|
601
601
|
* const { port1, port2 } = new MessageChannel();
|
|
602
602
|
* port1.postMessage({ hello: 'world' });
|
|
603
603
|
*
|
|
@@ -623,12 +623,12 @@ declare module "worker_threads" {
|
|
|
623
623
|
* automatically.
|
|
624
624
|
*
|
|
625
625
|
* ```js
|
|
626
|
-
*
|
|
626
|
+
* import {
|
|
627
627
|
* Worker,
|
|
628
628
|
* isMainThread,
|
|
629
629
|
* setEnvironmentData,
|
|
630
630
|
* getEnvironmentData,
|
|
631
|
-
* }
|
|
631
|
+
* } from 'node:worker_threads';
|
|
632
632
|
*
|
|
633
633
|
* if (isMainThread) {
|
|
634
634
|
* setEnvironmentData('Hello', 'World!');
|
|
@@ -657,7 +657,7 @@ declare module "worker_threads" {
|
|
|
657
657
|
} from "worker_threads";
|
|
658
658
|
global {
|
|
659
659
|
/**
|
|
660
|
-
* `BroadcastChannel` class is a global reference for `
|
|
660
|
+
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
|
|
661
661
|
* https://nodejs.org/api/globals.html#broadcastchannel
|
|
662
662
|
* @since v18.0.0
|
|
663
663
|
*/
|
|
@@ -668,7 +668,7 @@ declare module "worker_threads" {
|
|
|
668
668
|
: typeof _BroadcastChannel;
|
|
669
669
|
|
|
670
670
|
/**
|
|
671
|
-
* `MessageChannel` class is a global reference for `
|
|
671
|
+
* `MessageChannel` class is a global reference for `import { MessageChannel } from 'node:worker_threads'`
|
|
672
672
|
* https://nodejs.org/api/globals.html#messagechannel
|
|
673
673
|
* @since v15.0.0
|
|
674
674
|
*/
|
|
@@ -679,7 +679,7 @@ declare module "worker_threads" {
|
|
|
679
679
|
: typeof _MessageChannel;
|
|
680
680
|
|
|
681
681
|
/**
|
|
682
|
-
* `MessagePort` class is a global reference for `
|
|
682
|
+
* `MessagePort` class is a global reference for `import { MessagePort } from 'node:worker_threads'`
|
|
683
683
|
* https://nodejs.org/api/globals.html#messageport
|
|
684
684
|
* @since v15.0.0
|
|
685
685
|
*/
|
node v18.19/zlib.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* To access it:
|
|
6
6
|
*
|
|
7
7
|
* ```js
|
|
8
|
-
*
|
|
8
|
+
* import zlib from 'node:zlib';
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
11
|
* Compression and decompression are built around the Node.js `Streams API`.
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* stream:
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* import { createGzip } from 'node:zlib';
|
|
19
|
+
* import { pipeline } from 'node:stream';
|
|
20
|
+
* import {
|
|
21
21
|
* createReadStream,
|
|
22
22
|
* createWriteStream
|
|
23
|
-
* }
|
|
23
|
+
* } from 'node:fs';
|
|
24
24
|
*
|
|
25
25
|
* const gzip = createGzip();
|
|
26
26
|
* const source = createReadStream('input.txt');
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* // Or, Promisified
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* import { promisify } from 'node:util';
|
|
39
39
|
* const pipe = promisify(pipeline);
|
|
40
40
|
*
|
|
41
41
|
* async function do_gzip(input, output) {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* It is also possible to compress or decompress data in a single step:
|
|
56
56
|
*
|
|
57
57
|
* ```js
|
|
58
|
-
*
|
|
58
|
+
* import { deflate, unzip } from 'node:zlib';
|
|
59
59
|
*
|
|
60
60
|
* const input = '.................................';
|
|
61
61
|
* deflate(input, (err, buffer) => {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
*
|
|
78
78
|
* // Or, Promisified
|
|
79
79
|
*
|
|
80
|
-
*
|
|
80
|
+
* import { promisify } from 'node:util';
|
|
81
81
|
* const do_unzip = promisify(unzip);
|
|
82
82
|
*
|
|
83
83
|
* do_unzip(buffer)
|