cdk-common 2.1.11 → 2.1.13
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.
- package/.jsii +81 -3
- package/API.md +78 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +14 -1
- package/lib/managed-policies.js +14 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert/strict.d.ts +0 -46
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +0 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +18 -38
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +0 -45
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +0 -67
- package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +0 -54
- package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +0 -58
- package/node_modules/@types/concat-stream/node_modules/@types/node/constants.d.ts +0 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +0 -18
- package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +0 -27
- package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +0 -24
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +0 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +0 -46
- package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +0 -16
- package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +0 -36
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +0 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +0 -20
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +0 -41
- package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +0 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +0 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector/promises.d.ts +0 -6
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +0 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +0 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +53 -16
- package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +0 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +0 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +0 -31
- package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +0 -28
- package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +0 -13
- package/node_modules/@types/concat-stream/node_modules/@types/node/quic.d.ts +0 -13
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +0 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +0 -35
- package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +0 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +0 -115
- package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +0 -44
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/consumers.d.ts +81 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +27 -23
- package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +0 -40
- package/node_modules/@types/concat-stream/node_modules/@types/node/test/reporters.d.ts +0 -38
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +7 -80
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +0 -15
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +0 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +6 -16
- package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +0 -94
- package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +0 -25
- package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +0 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +0 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +0 -8
- package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +0 -38
- package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +0 -71
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +15 -61
- package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +0 -93
- package/node_modules/@types/concat-stream/node_modules/undici-types/cache-interceptor.d.ts +6 -0
- package/node_modules/@types/concat-stream/node_modules/undici-types/client.d.ts +10 -0
- package/node_modules/@types/concat-stream/node_modules/undici-types/package.json +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/assert/strict.d.ts +0 -46
- package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +0 -5
- package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +18 -38
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +0 -45
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +0 -67
- package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +0 -54
- package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +0 -58
- package/node_modules/@types/form-data/node_modules/@types/node/constants.d.ts +0 -6
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +0 -18
- package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +0 -27
- package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +0 -24
- package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +0 -6
- package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +0 -46
- package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +0 -16
- package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +0 -36
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +0 -10
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +0 -20
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +0 -41
- package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +0 -10
- package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +0 -5
- package/node_modules/@types/form-data/node_modules/@types/node/inspector/promises.d.ts +0 -6
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +0 -5
- package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +0 -3
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +53 -16
- package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +0 -9
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +0 -9
- package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +0 -31
- package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +0 -28
- package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +0 -13
- package/node_modules/@types/form-data/node_modules/@types/node/quic.d.ts +0 -13
- package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +0 -3
- package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +0 -35
- package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +0 -10
- package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +0 -115
- package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +0 -44
- package/node_modules/@types/form-data/node_modules/@types/node/stream/consumers.d.ts +81 -5
- package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +27 -23
- package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +0 -40
- package/node_modules/@types/form-data/node_modules/@types/node/test/reporters.d.ts +0 -38
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +7 -80
- package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +0 -15
- package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +0 -10
- package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +6 -16
- package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +0 -94
- package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +0 -25
- package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +0 -9
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +0 -10
- package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +0 -8
- package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +0 -38
- package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +0 -71
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +15 -61
- package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +0 -93
- package/node_modules/@types/form-data/node_modules/undici-types/cache-interceptor.d.ts +6 -0
- package/node_modules/@types/form-data/node_modules/undici-types/client.d.ts +10 -0
- package/node_modules/@types/form-data/node_modules/undici-types/package.json +1 -1
- package/node_modules/qs/CHANGELOG.md +6 -0
- package/node_modules/qs/dist/qs.js +16 -16
- package/node_modules/qs/lib/parse.js +2 -2
- package/node_modules/qs/package.json +3 -3
- package/node_modules/qs/test/parse.js +86 -0
- package/node_modules/qs/test/stringify.js +9 -0
- package/node_modules/qs/test/utils.js +31 -3
- package/node_modules/side-channel-list/CHANGELOG.md +25 -4
- package/node_modules/side-channel-list/index.js +1 -3
- package/node_modules/side-channel-list/package.json +8 -8
- package/node_modules/side-channel-list/test/index.js +50 -0
- package/package.json +27 -27
|
@@ -1,83 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:test` module facilitates the creation of JavaScript tests.
|
|
3
|
-
* To access it:
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import test from 'node:test';
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* This module is only available under the `node:` scheme. The following will not
|
|
10
|
-
* work:
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
* import test from 'node:test';
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Tests created via the `test` module consist of a single function that is
|
|
17
|
-
* processed in one of three ways:
|
|
18
|
-
*
|
|
19
|
-
* 1. A synchronous function that is considered failing if it throws an exception,
|
|
20
|
-
* and is considered passing otherwise.
|
|
21
|
-
* 2. A function that returns a `Promise` that is considered failing if the `Promise` rejects, and is considered passing if the `Promise` fulfills.
|
|
22
|
-
* 3. A function that receives a callback function. If the callback receives any
|
|
23
|
-
* truthy value as its first argument, the test is considered failing. If a
|
|
24
|
-
* falsy value is passed as the first argument to the callback, the test is
|
|
25
|
-
* considered passing. If the test function receives a callback function and
|
|
26
|
-
* also returns a `Promise`, the test will fail.
|
|
27
|
-
*
|
|
28
|
-
* The following example illustrates how tests are written using the `test` module.
|
|
29
|
-
*
|
|
30
|
-
* ```js
|
|
31
|
-
* test('synchronous passing test', (t) => {
|
|
32
|
-
* // This test passes because it does not throw an exception.
|
|
33
|
-
* assert.strictEqual(1, 1);
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* test('synchronous failing test', (t) => {
|
|
37
|
-
* // This test fails because it throws an exception.
|
|
38
|
-
* assert.strictEqual(1, 2);
|
|
39
|
-
* });
|
|
40
|
-
*
|
|
41
|
-
* test('asynchronous passing test', async (t) => {
|
|
42
|
-
* // This test passes because the Promise returned by the async
|
|
43
|
-
* // function is settled and not rejected.
|
|
44
|
-
* assert.strictEqual(1, 1);
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* test('asynchronous failing test', async (t) => {
|
|
48
|
-
* // This test fails because the Promise returned by the async
|
|
49
|
-
* // function is rejected.
|
|
50
|
-
* assert.strictEqual(1, 2);
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* test('failing test using Promises', (t) => {
|
|
54
|
-
* // Promises can be used directly as well.
|
|
55
|
-
* return new Promise((resolve, reject) => {
|
|
56
|
-
* setImmediate(() => {
|
|
57
|
-
* reject(new Error('this will cause the test to fail'));
|
|
58
|
-
* });
|
|
59
|
-
* });
|
|
60
|
-
* });
|
|
61
|
-
*
|
|
62
|
-
* test('callback passing test', (t, done) => {
|
|
63
|
-
* // done() is the callback function. When the setImmediate() runs, it invokes
|
|
64
|
-
* // done() with no arguments.
|
|
65
|
-
* setImmediate(done);
|
|
66
|
-
* });
|
|
67
|
-
*
|
|
68
|
-
* test('callback failing test', (t, done) => {
|
|
69
|
-
* // When the setImmediate() runs, done() is invoked with an Error object and
|
|
70
|
-
* // the test fails.
|
|
71
|
-
* setImmediate(() => {
|
|
72
|
-
* done(new Error('callback failure'));
|
|
73
|
-
* });
|
|
74
|
-
* });
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* If any tests fail, the process exit code is set to `1`.
|
|
78
|
-
* @since v18.0.0, v16.17.0
|
|
79
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test.js)
|
|
80
|
-
*/
|
|
81
1
|
declare module "node:test" {
|
|
82
2
|
import { AssertMethodNames } from "node:assert";
|
|
83
3
|
import { Readable, ReadableEventMap } from "node:stream";
|
|
@@ -409,6 +329,13 @@ declare module "node:test" {
|
|
|
409
329
|
* @default 0
|
|
410
330
|
*/
|
|
411
331
|
functionCoverage?: number | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Specify environment variables to be passed along to the test process.
|
|
334
|
+
* This options is not compatible with `isolation='none'`. These variables will override
|
|
335
|
+
* those from the main process, and are not merged with `process.env`.
|
|
336
|
+
* @since v25.6.0
|
|
337
|
+
*/
|
|
338
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
412
339
|
}
|
|
413
340
|
interface TestsStreamEventMap extends ReadableEventMap {
|
|
414
341
|
"data": [data: TestEvent];
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
-
* that return `Promise` objects. The API is accessible via
|
|
4
|
-
* `require('node:timers/promises')`.
|
|
5
|
-
*
|
|
6
|
-
* ```js
|
|
7
|
-
* import {
|
|
8
|
-
* setTimeout,
|
|
9
|
-
* setImmediate,
|
|
10
|
-
* setInterval,
|
|
11
|
-
* } from 'node:timers/promises';
|
|
12
|
-
* ```
|
|
13
|
-
* @since v15.0.0
|
|
14
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js)
|
|
15
|
-
*/
|
|
16
1
|
declare module "node:timers/promises" {
|
|
17
2
|
import { TimerOptions } from "node:timers";
|
|
18
3
|
/**
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `timer` module exposes a global API for scheduling functions to
|
|
3
|
-
* be called at some future period of time. Because the timer functions are
|
|
4
|
-
* globals, there is no need to import `node:timers` to use the API.
|
|
5
|
-
*
|
|
6
|
-
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
|
-
* provided by Web Browsers but use a different internal implementation that is
|
|
8
|
-
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers.js)
|
|
10
|
-
*/
|
|
11
1
|
declare module "node:timers" {
|
|
12
2
|
import { Abortable } from "node:events";
|
|
13
3
|
import * as promises from "node:timers/promises";
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:tls` module provides an implementation of the Transport Layer Security
|
|
3
|
-
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
|
|
4
|
-
* The module can be accessed using:
|
|
5
|
-
*
|
|
6
|
-
* ```js
|
|
7
|
-
* import tls from 'node:tls';
|
|
8
|
-
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tls.js)
|
|
10
|
-
*/
|
|
11
1
|
declare module "node:tls" {
|
|
12
2
|
import { NonSharedBuffer } from "node:buffer";
|
|
13
3
|
import { X509Certificate } from "node:crypto";
|
|
@@ -200,12 +190,6 @@ declare module "node:tls" {
|
|
|
200
190
|
* An optional Buffer instance containing a TLS session.
|
|
201
191
|
*/
|
|
202
192
|
session?: Buffer | undefined;
|
|
203
|
-
/**
|
|
204
|
-
* If true, specifies that the OCSP status request extension will be
|
|
205
|
-
* added to the client hello and an 'OCSPResponse' event will be
|
|
206
|
-
* emitted on the socket before establishing a secure communication
|
|
207
|
-
*/
|
|
208
|
-
requestOCSP?: boolean | undefined;
|
|
209
193
|
}
|
|
210
194
|
interface TLSSocketEventMap extends net.SocketEventMap {
|
|
211
195
|
"keylog": [line: NonSharedBuffer];
|
|
@@ -577,6 +561,12 @@ declare module "node:tls" {
|
|
|
577
561
|
* @default true
|
|
578
562
|
*/
|
|
579
563
|
rejectUnauthorized?: boolean | undefined;
|
|
564
|
+
/**
|
|
565
|
+
* If true, specifies that the OCSP status request extension will be
|
|
566
|
+
* added to the client hello and an 'OCSPResponse' event will be
|
|
567
|
+
* emitted on the socket before establishing a secure communication.
|
|
568
|
+
*/
|
|
569
|
+
requestOCSP?: boolean | undefined;
|
|
580
570
|
}
|
|
581
571
|
interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
|
|
582
572
|
/**
|
|
@@ -1,97 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:trace_events` module provides a mechanism to centralize tracing information
|
|
3
|
-
* generated by V8, Node.js core, and userspace code.
|
|
4
|
-
*
|
|
5
|
-
* Tracing can be enabled with the `--trace-event-categories` command-line flag
|
|
6
|
-
* or by using the `trace_events` module. The `--trace-event-categories` flag
|
|
7
|
-
* accepts a list of comma-separated category names.
|
|
8
|
-
*
|
|
9
|
-
* The available categories are:
|
|
10
|
-
*
|
|
11
|
-
* * `node`: An empty placeholder.
|
|
12
|
-
* * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) trace data.
|
|
13
|
-
* The [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
|
|
14
|
-
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
|
|
15
|
-
* * `node.console`: Enables capture of `console.time()` and `console.count()` output.
|
|
16
|
-
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
|
|
17
|
-
* * `node.threadpoolwork.async`: Enables capture of trace data for threadpool asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
|
|
18
|
-
* * `node.dns.native`: Enables capture of trace data for DNS queries.
|
|
19
|
-
* * `node.net.native`: Enables capture of trace data for network.
|
|
20
|
-
* * `node.environment`: Enables capture of Node.js Environment milestones.
|
|
21
|
-
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
|
|
22
|
-
* * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods.
|
|
23
|
-
* * `node.fs.async`: Enables capture of trace data for file system async methods.
|
|
24
|
-
* * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods.
|
|
25
|
-
* * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v25.x/api/perf_hooks.html) measurements.
|
|
26
|
-
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
|
|
27
|
-
* measures and marks.
|
|
28
|
-
* * `node.perf.timerify`: Enables capture of only Performance API timerify
|
|
29
|
-
* measurements.
|
|
30
|
-
* * `node.promises.rejections`: Enables capture of trace data tracking the number
|
|
31
|
-
* of unhandled Promise rejections and handled-after-rejections.
|
|
32
|
-
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
|
|
33
|
-
* * `v8`: The [V8](https://nodejs.org/docs/latest-v25.x/api/v8.html) events are GC, compiling, and execution related.
|
|
34
|
-
* * `node.http`: Enables capture of trace data for http request / response.
|
|
35
|
-
*
|
|
36
|
-
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
|
|
37
|
-
*
|
|
38
|
-
* ```bash
|
|
39
|
-
* node --trace-event-categories v8,node,node.async_hooks server.js
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be
|
|
43
|
-
* used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default.
|
|
44
|
-
*
|
|
45
|
-
* ```bash
|
|
46
|
-
* node --trace-events-enabled
|
|
47
|
-
*
|
|
48
|
-
* # is equivalent to
|
|
49
|
-
*
|
|
50
|
-
* node --trace-event-categories v8,node,node.async_hooks
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* Alternatively, trace events may be enabled using the `node:trace_events` module:
|
|
54
|
-
*
|
|
55
|
-
* ```js
|
|
56
|
-
* import trace_events from 'node:trace_events';
|
|
57
|
-
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
|
58
|
-
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
|
59
|
-
*
|
|
60
|
-
* // do work
|
|
61
|
-
*
|
|
62
|
-
* tracing.disable(); // Disable trace event capture for the 'node.perf' category
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* Running Node.js with tracing enabled will produce log files that can be opened
|
|
66
|
-
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
|
|
67
|
-
*
|
|
68
|
-
* The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can
|
|
69
|
-
* be specified with `--trace-event-file-pattern` that accepts a template
|
|
70
|
-
* string that supports `${rotation}` and `${pid}`:
|
|
71
|
-
*
|
|
72
|
-
* ```bash
|
|
73
|
-
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* To guarantee that the log file is properly generated after signal events like `SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
|
|
77
|
-
* in your code, such as:
|
|
78
|
-
*
|
|
79
|
-
* ```js
|
|
80
|
-
* process.on('SIGINT', function onSigint() {
|
|
81
|
-
* console.info('Received SIGINT.');
|
|
82
|
-
* process.exit(130); // Or applicable exit code depending on OS and signal
|
|
83
|
-
* });
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* The tracing system uses the same time source
|
|
87
|
-
* as the one used by `process.hrtime()`.
|
|
88
|
-
* However the trace-event timestamps are expressed in microseconds,
|
|
89
|
-
* unlike `process.hrtime()` which returns nanoseconds.
|
|
90
|
-
*
|
|
91
|
-
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#class-worker) threads.
|
|
92
|
-
* @experimental
|
|
93
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/trace_events.js)
|
|
94
|
-
*/
|
|
95
1
|
declare module "node:trace_events" {
|
|
96
2
|
/**
|
|
97
3
|
* The `Tracing` object is used to enable or disable tracing for sets of
|
|
@@ -172,7 +172,7 @@ declare module "node:buffer" {
|
|
|
172
172
|
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
|
173
173
|
* in `list` by adding their lengths.
|
|
174
174
|
*
|
|
175
|
-
* If `totalLength` is provided, it
|
|
175
|
+
* If `totalLength` is provided, it must be an unsigned integer. If the
|
|
176
176
|
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
177
177
|
* truncated to `totalLength`.
|
|
178
178
|
*
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module
|
|
3
|
-
* directly. However, it can be accessed using:
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import tty from 'node:tty';
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* When Node.js detects that it is being run with a text terminal ("TTY")
|
|
10
|
-
* attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
|
|
11
|
-
* default, be instances of `tty.WriteStream`. The preferred method of determining
|
|
12
|
-
* whether Node.js is being run within a TTY context is to check that the value of
|
|
13
|
-
* the `process.stdout.isTTY` property is `true`:
|
|
14
|
-
*
|
|
15
|
-
* ```console
|
|
16
|
-
* $ node -p -e "Boolean(process.stdout.isTTY)"
|
|
17
|
-
* true
|
|
18
|
-
* $ node -p -e "Boolean(process.stdout.isTTY)" | cat
|
|
19
|
-
* false
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* In most cases, there should be little to no reason for an application to
|
|
23
|
-
* manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
|
|
24
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tty.js)
|
|
25
|
-
*/
|
|
26
1
|
declare module "node:tty" {
|
|
27
2
|
import * as net from "node:net";
|
|
28
3
|
/**
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:url` module provides utilities for URL resolution and parsing. It can
|
|
3
|
-
* be accessed using:
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import url from 'node:url';
|
|
7
|
-
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js)
|
|
9
|
-
*/
|
|
10
1
|
declare module "node:url" {
|
|
11
2
|
import { Blob, NonSharedBuffer } from "node:buffer";
|
|
12
3
|
import { ClientRequestArgs } from "node:http";
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:util` module supports the needs of Node.js internal APIs. Many of the
|
|
3
|
-
* utilities are useful for application and module developers as well. To access
|
|
4
|
-
* it:
|
|
5
|
-
*
|
|
6
|
-
* ```js
|
|
7
|
-
* import util from 'node:util';
|
|
8
|
-
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/util.js)
|
|
10
|
-
*/
|
|
11
1
|
declare module "node:util" {
|
|
12
2
|
export * as types from "node:util/types";
|
|
13
3
|
export type InspectStyle =
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
|
3
|
-
*
|
|
4
|
-
* ```js
|
|
5
|
-
* import v8 from 'node:v8';
|
|
6
|
-
* ```
|
|
7
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js)
|
|
8
|
-
*/
|
|
9
1
|
declare module "node:v8" {
|
|
10
2
|
import { NonSharedBuffer } from "node:buffer";
|
|
11
3
|
import { Readable } from "node:stream";
|
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:vm` module enables compiling and running code within V8 Virtual
|
|
3
|
-
* Machine contexts.
|
|
4
|
-
*
|
|
5
|
-
* **The `node:vm` module is not a security**
|
|
6
|
-
* **mechanism. Do not use it to run untrusted code.**
|
|
7
|
-
*
|
|
8
|
-
* JavaScript code can be compiled and run immediately or
|
|
9
|
-
* compiled, saved, and run later.
|
|
10
|
-
*
|
|
11
|
-
* A common use case is to run the code in a different V8 Context. This means
|
|
12
|
-
* invoked code has a different global object than the invoking code.
|
|
13
|
-
*
|
|
14
|
-
* One can provide the context by `contextifying` an
|
|
15
|
-
* object. The invoked code treats any property in the context like a
|
|
16
|
-
* global variable. Any changes to global variables caused by the invoked
|
|
17
|
-
* code are reflected in the context object.
|
|
18
|
-
*
|
|
19
|
-
* ```js
|
|
20
|
-
* import vm from 'node:vm';
|
|
21
|
-
*
|
|
22
|
-
* const x = 1;
|
|
23
|
-
*
|
|
24
|
-
* const context = { x: 2 };
|
|
25
|
-
* vm.createContext(context); // Contextify the object.
|
|
26
|
-
*
|
|
27
|
-
* const code = 'x += 40; var y = 17;';
|
|
28
|
-
* // `x` and `y` are global variables in the context.
|
|
29
|
-
* // Initially, x has the value 2 because that is the value of context.x.
|
|
30
|
-
* vm.runInContext(code, context);
|
|
31
|
-
*
|
|
32
|
-
* console.log(context.x); // 42
|
|
33
|
-
* console.log(context.y); // 17
|
|
34
|
-
*
|
|
35
|
-
* console.log(x); // 1; y is not defined.
|
|
36
|
-
* ```
|
|
37
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js)
|
|
38
|
-
*/
|
|
39
1
|
declare module "node:vm" {
|
|
40
2
|
import { NonSharedBuffer } from "node:buffer";
|
|
41
3
|
import { ImportAttributes, ImportPhase } from "node:module";
|
|
@@ -1,74 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **The `node:wasi` module does not currently provide the**
|
|
3
|
-
* **comprehensive file system security properties provided by some WASI runtimes.**
|
|
4
|
-
* **Full support for secure file system sandboxing may or may not be implemented in**
|
|
5
|
-
* **future. In the mean time, do not rely on it to run untrusted code.**
|
|
6
|
-
*
|
|
7
|
-
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives WebAssembly applications access to the underlying
|
|
8
|
-
* operating system via a collection of POSIX-like functions.
|
|
9
|
-
*
|
|
10
|
-
* ```js
|
|
11
|
-
* import { readFile } from 'node:fs/promises';
|
|
12
|
-
* import { WASI } from 'node:wasi';
|
|
13
|
-
* import { argv, env } from 'node:process';
|
|
14
|
-
*
|
|
15
|
-
* const wasi = new WASI({
|
|
16
|
-
* version: 'preview1',
|
|
17
|
-
* args: argv,
|
|
18
|
-
* env,
|
|
19
|
-
* preopens: {
|
|
20
|
-
* '/local': '/some/real/path/that/wasm/can/access',
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* const wasm = await WebAssembly.compile(
|
|
25
|
-
* await readFile(new URL('./demo.wasm', import.meta.url)),
|
|
26
|
-
* );
|
|
27
|
-
* const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject());
|
|
28
|
-
*
|
|
29
|
-
* wasi.start(instance);
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* To run the above example, create a new WebAssembly text format file named `demo.wat`:
|
|
33
|
-
*
|
|
34
|
-
* ```text
|
|
35
|
-
* (module
|
|
36
|
-
* ;; Import the required fd_write WASI function which will write the given io vectors to stdout
|
|
37
|
-
* ;; The function signature for fd_write is:
|
|
38
|
-
* ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
|
|
39
|
-
* (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
|
|
40
|
-
*
|
|
41
|
-
* (memory 1)
|
|
42
|
-
* (export "memory" (memory 0))
|
|
43
|
-
*
|
|
44
|
-
* ;; Write 'hello world\n' to memory at an offset of 8 bytes
|
|
45
|
-
* ;; Note the trailing newline which is required for the text to appear
|
|
46
|
-
* (data (i32.const 8) "hello world\n")
|
|
47
|
-
*
|
|
48
|
-
* (func $main (export "_start")
|
|
49
|
-
* ;; Creating a new io vector within linear memory
|
|
50
|
-
* (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
|
|
51
|
-
* (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
|
|
52
|
-
*
|
|
53
|
-
* (call $fd_write
|
|
54
|
-
* (i32.const 1) ;; file_descriptor - 1 for stdout
|
|
55
|
-
* (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
|
|
56
|
-
* (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
|
|
57
|
-
* (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
|
|
58
|
-
* )
|
|
59
|
-
* drop ;; Discard the number of bytes written from the top of the stack
|
|
60
|
-
* )
|
|
61
|
-
* )
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
|
|
65
|
-
*
|
|
66
|
-
* ```bash
|
|
67
|
-
* wat2wasm demo.wat
|
|
68
|
-
* ```
|
|
69
|
-
* @experimental
|
|
70
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js)
|
|
71
|
-
*/
|
|
72
1
|
declare module "node:wasi" {
|
|
73
2
|
interface WASIOptions {
|
|
74
3
|
/**
|
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:worker_threads` module enables the use of threads that execute
|
|
3
|
-
* JavaScript in parallel. To access it:
|
|
4
|
-
*
|
|
5
|
-
* ```js
|
|
6
|
-
* import worker from 'node:worker_threads';
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
|
|
10
|
-
* They do not help much with I/O-intensive work. The Node.js built-in
|
|
11
|
-
* asynchronous I/O operations are more efficient than Workers can be.
|
|
12
|
-
*
|
|
13
|
-
* Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
|
|
14
|
-
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
|
|
15
|
-
*
|
|
16
|
-
* ```js
|
|
17
|
-
* import {
|
|
18
|
-
* Worker,
|
|
19
|
-
* isMainThread,
|
|
20
|
-
* parentPort,
|
|
21
|
-
* workerData,
|
|
22
|
-
* } from 'node:worker_threads';
|
|
23
|
-
*
|
|
24
|
-
* if (!isMainThread) {
|
|
25
|
-
* const { parse } = await import('some-js-parsing-library');
|
|
26
|
-
* const script = workerData;
|
|
27
|
-
* parentPort.postMessage(parse(script));
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* export default function parseJSAsync(script) {
|
|
31
|
-
* return new Promise((resolve, reject) => {
|
|
32
|
-
* const worker = new Worker(new URL(import.meta.url), {
|
|
33
|
-
* workerData: script,
|
|
34
|
-
* });
|
|
35
|
-
* worker.on('message', resolve);
|
|
36
|
-
* worker.once('error', reject);
|
|
37
|
-
* worker.once('exit', (code) => {
|
|
38
|
-
* if (code !== 0)
|
|
39
|
-
* reject(new Error(`Worker stopped with exit code ${code}`));
|
|
40
|
-
* });
|
|
41
|
-
* });
|
|
42
|
-
* };
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
|
46
|
-
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
|
|
47
|
-
* overhead of creating Workers would likely exceed their benefit.
|
|
48
|
-
*
|
|
49
|
-
* When implementing a worker pool, use the `AsyncResource` API to inform
|
|
50
|
-
* diagnostic tools (e.g. to provide asynchronous stack traces) about the
|
|
51
|
-
* correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
|
|
52
|
-
*
|
|
53
|
-
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
|
54
|
-
* specifically `argv` and `execArgv` options.
|
|
55
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/worker_threads.js)
|
|
56
|
-
*/
|
|
57
1
|
declare module "node:worker_threads" {
|
|
58
2
|
import {
|
|
59
3
|
EventEmitter,
|
|
@@ -396,11 +340,15 @@ declare module "node:worker_threads" {
|
|
|
396
340
|
interface Worker extends InternalEventEmitter<WorkerEventMap> {}
|
|
397
341
|
/**
|
|
398
342
|
* Mark an object as not transferable. If `object` occurs in the transfer list of
|
|
399
|
-
* a `port.postMessage()` call,
|
|
343
|
+
* a [`port.postMessage()`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist) call, an error is thrown. This is a no-op if
|
|
344
|
+
* `object` is a primitive value.
|
|
400
345
|
*
|
|
401
346
|
* In particular, this makes sense for objects that can be cloned, rather than
|
|
402
347
|
* transferred, and which are used by other objects on the sending side.
|
|
403
|
-
* For example, Node.js marks the `ArrayBuffer`s it uses for its
|
|
348
|
+
* For example, Node.js marks the `ArrayBuffer`s it uses for its
|
|
349
|
+
* [`Buffer` pool](https://nodejs.org/docs/latest-v25.x/api/buffer.html#static-method-bufferallocunsafesize) with this.
|
|
350
|
+
* `ArrayBuffer.prototype.transfer()` is disallowed on such array buffer
|
|
351
|
+
* instances.
|
|
404
352
|
*
|
|
405
353
|
* This operation cannot be undone.
|
|
406
354
|
*
|
|
@@ -414,11 +362,17 @@ declare module "node:worker_threads" {
|
|
|
414
362
|
* markAsUntransferable(pooledBuffer);
|
|
415
363
|
*
|
|
416
364
|
* const { port1 } = new MessageChannel();
|
|
417
|
-
*
|
|
365
|
+
* try {
|
|
366
|
+
* // This will throw an error, because pooledBuffer is not transferable.
|
|
367
|
+
* port1.postMessage(typedArray1, [ typedArray1.buffer ]);
|
|
368
|
+
* } catch (error) {
|
|
369
|
+
* // error.name === 'DataCloneError'
|
|
370
|
+
* }
|
|
418
371
|
*
|
|
419
372
|
* // The following line prints the contents of typedArray1 -- it still owns
|
|
420
|
-
* // its memory and has been
|
|
421
|
-
* // `markAsUntransferable()`, this would print an empty Uint8Array
|
|
373
|
+
* // its memory and has not been transferred. Without
|
|
374
|
+
* // `markAsUntransferable()`, this would print an empty Uint8Array and the
|
|
375
|
+
* // postMessage call would have succeeded.
|
|
422
376
|
* // typedArray2 is intact as well.
|
|
423
377
|
* console.log(typedArray1);
|
|
424
378
|
* console.log(typedArray2);
|
|
@@ -1,96 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `node:zlib` module provides compression functionality implemented using
|
|
3
|
-
* Gzip, Deflate/Inflate, and Brotli.
|
|
4
|
-
*
|
|
5
|
-
* To access it:
|
|
6
|
-
*
|
|
7
|
-
* ```js
|
|
8
|
-
* import zlib from 'node:zlib';
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* Compression and decompression are built around the Node.js
|
|
12
|
-
* [Streams API](https://nodejs.org/docs/latest-v25.x/api/stream.html).
|
|
13
|
-
*
|
|
14
|
-
* Compressing or decompressing a stream (such as a file) can be accomplished by
|
|
15
|
-
* piping the source stream through a `zlib` `Transform` stream into a destination
|
|
16
|
-
* stream:
|
|
17
|
-
*
|
|
18
|
-
* ```js
|
|
19
|
-
* import { createGzip } from 'node:zlib';
|
|
20
|
-
* import { pipeline } from 'node:stream';
|
|
21
|
-
* import {
|
|
22
|
-
* createReadStream,
|
|
23
|
-
* createWriteStream,
|
|
24
|
-
* } from 'node:fs';
|
|
25
|
-
*
|
|
26
|
-
* const gzip = createGzip();
|
|
27
|
-
* const source = createReadStream('input.txt');
|
|
28
|
-
* const destination = createWriteStream('input.txt.gz');
|
|
29
|
-
*
|
|
30
|
-
* pipeline(source, gzip, destination, (err) => {
|
|
31
|
-
* if (err) {
|
|
32
|
-
* console.error('An error occurred:', err);
|
|
33
|
-
* process.exitCode = 1;
|
|
34
|
-
* }
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Or, Promisified
|
|
38
|
-
*
|
|
39
|
-
* import { promisify } from 'node:util';
|
|
40
|
-
* const pipe = promisify(pipeline);
|
|
41
|
-
*
|
|
42
|
-
* async function do_gzip(input, output) {
|
|
43
|
-
* const gzip = createGzip();
|
|
44
|
-
* const source = createReadStream(input);
|
|
45
|
-
* const destination = createWriteStream(output);
|
|
46
|
-
* await pipe(source, gzip, destination);
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* do_gzip('input.txt', 'input.txt.gz')
|
|
50
|
-
* .catch((err) => {
|
|
51
|
-
* console.error('An error occurred:', err);
|
|
52
|
-
* process.exitCode = 1;
|
|
53
|
-
* });
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* It is also possible to compress or decompress data in a single step:
|
|
57
|
-
*
|
|
58
|
-
* ```js
|
|
59
|
-
* import { deflate, unzip } from 'node:zlib';
|
|
60
|
-
*
|
|
61
|
-
* const input = '.................................';
|
|
62
|
-
* deflate(input, (err, buffer) => {
|
|
63
|
-
* if (err) {
|
|
64
|
-
* console.error('An error occurred:', err);
|
|
65
|
-
* process.exitCode = 1;
|
|
66
|
-
* }
|
|
67
|
-
* console.log(buffer.toString('base64'));
|
|
68
|
-
* });
|
|
69
|
-
*
|
|
70
|
-
* const buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');
|
|
71
|
-
* unzip(buffer, (err, buffer) => {
|
|
72
|
-
* if (err) {
|
|
73
|
-
* console.error('An error occurred:', err);
|
|
74
|
-
* process.exitCode = 1;
|
|
75
|
-
* }
|
|
76
|
-
* console.log(buffer.toString());
|
|
77
|
-
* });
|
|
78
|
-
*
|
|
79
|
-
* // Or, Promisified
|
|
80
|
-
*
|
|
81
|
-
* import { promisify } from 'node:util';
|
|
82
|
-
* const do_unzip = promisify(unzip);
|
|
83
|
-
*
|
|
84
|
-
* do_unzip(buffer)
|
|
85
|
-
* .then((buf) => console.log(buf.toString()))
|
|
86
|
-
* .catch((err) => {
|
|
87
|
-
* console.error('An error occurred:', err);
|
|
88
|
-
* process.exitCode = 1;
|
|
89
|
-
* });
|
|
90
|
-
* ```
|
|
91
|
-
* @since v0.5.8
|
|
92
|
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/zlib.js)
|
|
93
|
-
*/
|
|
94
1
|
declare module "node:zlib" {
|
|
95
2
|
import { NonSharedBuffer } from "node:buffer";
|
|
96
3
|
import * as stream from "node:stream";
|
|
@@ -39,6 +39,12 @@ declare namespace CacheHandler {
|
|
|
39
39
|
*/
|
|
40
40
|
type?: 'shared' | 'private'
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Array of origins to cache. Only requests to these origins will be cached.
|
|
44
|
+
* Supports strings (case insensitive) and RegExp patterns.
|
|
45
|
+
* @default undefined (cache all origins)
|
|
46
|
+
*/
|
|
47
|
+
origins?: (string | RegExp)[]
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export interface CacheControlDirectives {
|