cdk-ecr-deployment 3.0.111 → 3.0.113
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 +2 -2
- package/lib/index.js +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +14 -381
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +34 -29
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +2 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +17 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +7 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +238 -101
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +17 -23
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +5 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +270 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +11 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +9 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +9 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +4 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +17 -17
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +34 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +86 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +4 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/index.d.ts +94 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +7 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +44 -44
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +12 -12
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +8 -8
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +14 -381
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +34 -29
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +2 -1
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +17 -15
- package/node_modules/@types/keyv/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +7 -7
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +238 -101
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +17 -23
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +5 -1
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +270 -0
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +11 -15
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +9 -2
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +9 -9
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +4 -4
- package/node_modules/@types/keyv/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +17 -17
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +34 -15
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +86 -3
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +5 -5
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +5 -5
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +4 -4
- package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/index.d.ts +94 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +7 -7
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +44 -44
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +12 -12
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +8 -8
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +14 -381
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +34 -29
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +2 -1
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +17 -15
- package/node_modules/@types/responselike/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +7 -7
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +238 -101
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +17 -23
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +5 -1
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +270 -0
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +11 -15
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +9 -2
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +9 -9
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +4 -4
- package/node_modules/@types/responselike/node_modules/@types/node/sqlite.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +17 -17
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +34 -15
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +86 -3
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +5 -5
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +5 -5
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +4 -4
- package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/index.d.ts +94 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +7 -7
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +44 -44
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +12 -12
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +13 -13
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +8 -8
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* work:
|
|
11
11
|
*
|
|
12
12
|
* ```js
|
|
13
|
-
* import test from 'test';
|
|
13
|
+
* import test from 'node:test';
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* Tests created via the `test` module consist of a single function that is
|
|
@@ -331,6 +331,13 @@ declare module "node:test" {
|
|
|
331
331
|
* @default false
|
|
332
332
|
*/
|
|
333
333
|
forceExit?: boolean | undefined;
|
|
334
|
+
/**
|
|
335
|
+
* An array containing the list of glob patterns to match test files.
|
|
336
|
+
* This option cannot be used together with `files`. If omitted, files are run according to the
|
|
337
|
+
* [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
|
|
338
|
+
* @since v22.6.0
|
|
339
|
+
*/
|
|
340
|
+
globPatterns?: readonly string[] | undefined;
|
|
334
341
|
/**
|
|
335
342
|
* Sets inspector port of test child process.
|
|
336
343
|
* If a nullish value is provided, each process gets its own port,
|
|
@@ -479,7 +486,7 @@ declare module "node:test" {
|
|
|
479
486
|
/**
|
|
480
487
|
* An object containing assertion methods bound to the test context.
|
|
481
488
|
* The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
|
|
482
|
-
* @since v22.2.0
|
|
489
|
+
* @since v22.2.0, v20.15.0
|
|
483
490
|
*/
|
|
484
491
|
readonly assert: TestContextAssert;
|
|
485
492
|
/**
|
|
@@ -528,6 +535,12 @@ declare module "node:test" {
|
|
|
528
535
|
* @param message Message to be reported.
|
|
529
536
|
*/
|
|
530
537
|
diagnostic(message: string): void;
|
|
538
|
+
/**
|
|
539
|
+
* The absolute path of the test file that created the current test. If a test file imports
|
|
540
|
+
* additional modules that generate tests, the imported tests will return the path of the root test file.
|
|
541
|
+
* @since v22.6.0
|
|
542
|
+
*/
|
|
543
|
+
readonly filePath: string | undefined;
|
|
531
544
|
/**
|
|
532
545
|
* The name of the test and each of its ancestors, separated by `>`.
|
|
533
546
|
* @since v22.3.0
|
|
@@ -657,6 +670,22 @@ declare module "node:test" {
|
|
|
657
670
|
deepEqual: typeof import("node:assert").deepEqual;
|
|
658
671
|
/**
|
|
659
672
|
* Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context.
|
|
673
|
+
*
|
|
674
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
675
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
676
|
+
* ```ts
|
|
677
|
+
* import { test, type TestContext } from 'node:test';
|
|
678
|
+
*
|
|
679
|
+
* // The test function's context parameter must have a type annotation.
|
|
680
|
+
* test('example', (t: TestContext) => {
|
|
681
|
+
* t.assert.deepStrictEqual(actual, expected);
|
|
682
|
+
* });
|
|
683
|
+
*
|
|
684
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
685
|
+
* test('example', t => {
|
|
686
|
+
* t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
|
687
|
+
* });
|
|
688
|
+
* ```
|
|
660
689
|
*/
|
|
661
690
|
deepStrictEqual: typeof import("node:assert").deepStrictEqual;
|
|
662
691
|
/**
|
|
@@ -681,6 +710,22 @@ declare module "node:test" {
|
|
|
681
710
|
fail: typeof import("node:assert").fail;
|
|
682
711
|
/**
|
|
683
712
|
* Identical to the `ifError` function from the `node:assert` module, but bound to the test context.
|
|
713
|
+
*
|
|
714
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
715
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
716
|
+
* ```ts
|
|
717
|
+
* import { test, type TestContext } from 'node:test';
|
|
718
|
+
*
|
|
719
|
+
* // The test function's context parameter must have a type annotation.
|
|
720
|
+
* test('example', (t: TestContext) => {
|
|
721
|
+
* t.assert.ifError(err);
|
|
722
|
+
* });
|
|
723
|
+
*
|
|
724
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
725
|
+
* test('example', t => {
|
|
726
|
+
* t.assert.ifError(err); // Error: 't' needs an explicit type annotation.
|
|
727
|
+
* });
|
|
728
|
+
* ```
|
|
684
729
|
*/
|
|
685
730
|
ifError: typeof import("node:assert").ifError;
|
|
686
731
|
/**
|
|
@@ -705,6 +750,22 @@ declare module "node:test" {
|
|
|
705
750
|
notStrictEqual: typeof import("node:assert").notStrictEqual;
|
|
706
751
|
/**
|
|
707
752
|
* Identical to the `ok` function from the `node:assert` module, but bound to the test context.
|
|
753
|
+
*
|
|
754
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
755
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
756
|
+
* ```ts
|
|
757
|
+
* import { test, type TestContext } from 'node:test';
|
|
758
|
+
*
|
|
759
|
+
* // The test function's context parameter must have a type annotation.
|
|
760
|
+
* test('example', (t: TestContext) => {
|
|
761
|
+
* t.assert.ok(condition);
|
|
762
|
+
* });
|
|
763
|
+
*
|
|
764
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
765
|
+
* test('example', t => {
|
|
766
|
+
* t.assert.ok(condition)); // Error: 't' needs an explicit type annotation.
|
|
767
|
+
* });
|
|
768
|
+
* ```
|
|
708
769
|
*/
|
|
709
770
|
ok: typeof import("node:assert").ok;
|
|
710
771
|
/**
|
|
@@ -713,6 +774,22 @@ declare module "node:test" {
|
|
|
713
774
|
rejects: typeof import("node:assert").rejects;
|
|
714
775
|
/**
|
|
715
776
|
* Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context.
|
|
777
|
+
*
|
|
778
|
+
* **Note:** as this method returns a type assertion, the context parameter in the callback signature must have a
|
|
779
|
+
* type annotation, otherwise an error will be raised by the TypeScript compiler:
|
|
780
|
+
* ```ts
|
|
781
|
+
* import { test, type TestContext } from 'node:test';
|
|
782
|
+
*
|
|
783
|
+
* // The test function's context parameter must have a type annotation.
|
|
784
|
+
* test('example', (t: TestContext) => {
|
|
785
|
+
* t.assert.strictEqual(actual, expected);
|
|
786
|
+
* });
|
|
787
|
+
*
|
|
788
|
+
* // Omitting the type annotation will result in a compilation error.
|
|
789
|
+
* test('example', t => {
|
|
790
|
+
* t.assert.strictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
|
|
791
|
+
* });
|
|
792
|
+
* ```
|
|
716
793
|
*/
|
|
717
794
|
strictEqual: typeof import("node:assert").strictEqual;
|
|
718
795
|
/**
|
|
@@ -758,6 +835,12 @@ declare module "node:test" {
|
|
|
758
835
|
* @since v18.7.0, v16.17.0
|
|
759
836
|
*/
|
|
760
837
|
class SuiteContext {
|
|
838
|
+
/**
|
|
839
|
+
* The absolute path of the test file that created the current suite. If a test file imports
|
|
840
|
+
* additional modules that generate suites, the imported suites will return the path of the root test file.
|
|
841
|
+
* @since v22.6.0
|
|
842
|
+
*/
|
|
843
|
+
readonly filePath: string | undefined;
|
|
761
844
|
/**
|
|
762
845
|
* The name of the suite.
|
|
763
846
|
* @since v18.8.0, v16.18.0
|
|
@@ -1946,7 +2029,7 @@ interface TestStdout {
|
|
|
1946
2029
|
* work:
|
|
1947
2030
|
*
|
|
1948
2031
|
* ```js
|
|
1949
|
-
* import test from 'test/reporters';
|
|
2032
|
+
* import test from 'node:test/reporters';
|
|
1950
2033
|
* ```
|
|
1951
2034
|
* @since v19.9.0
|
|
1952
2035
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
-
* that return `Promise` objects. The API is accessible via `
|
|
3
|
+
* that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`.
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
6
|
* import {
|
|
7
7
|
* setTimeout,
|
|
8
8
|
* setImmediate,
|
|
9
9
|
* setInterval,
|
|
10
|
-
* } from 'timers/promises';
|
|
10
|
+
* } from 'node:timers/promises';
|
|
11
11
|
* ```
|
|
12
12
|
* @since v15.0.0
|
|
13
13
|
*/
|
|
@@ -17,7 +17,7 @@ declare module "timers/promises" {
|
|
|
17
17
|
* ```js
|
|
18
18
|
* import {
|
|
19
19
|
* setTimeout,
|
|
20
|
-
* } from 'timers/promises';
|
|
20
|
+
* } from 'node:timers/promises';
|
|
21
21
|
*
|
|
22
22
|
* const res = await setTimeout(100, 'result');
|
|
23
23
|
*
|
|
@@ -32,7 +32,7 @@ declare module "timers/promises" {
|
|
|
32
32
|
* ```js
|
|
33
33
|
* import {
|
|
34
34
|
* setImmediate,
|
|
35
|
-
* } from 'timers/promises';
|
|
35
|
+
* } from 'node:timers/promises';
|
|
36
36
|
*
|
|
37
37
|
* const res = await setImmediate('result');
|
|
38
38
|
*
|
|
@@ -50,7 +50,7 @@ declare module "timers/promises" {
|
|
|
50
50
|
* ```js
|
|
51
51
|
* import {
|
|
52
52
|
* setInterval,
|
|
53
|
-
* } from 'timers/promises';
|
|
53
|
+
* } from 'node:timers/promises';
|
|
54
54
|
*
|
|
55
55
|
* const interval = 100;
|
|
56
56
|
* for await (const startTime of setInterval(interval, Date.now())) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timer` module exposes a global API for scheduling functions to
|
|
3
3
|
* be called at some future period of time. Because the timer functions are
|
|
4
|
-
* globals, there is no need to
|
|
4
|
+
* globals, there is no need to import `node:timers` to use the API.
|
|
5
5
|
*
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The module can be accessed using:
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
*
|
|
7
|
+
* import tls from 'node:tls';
|
|
8
8
|
* ```
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js)
|
|
10
10
|
*/
|
|
@@ -1003,8 +1003,8 @@ declare module "tls" {
|
|
|
1003
1003
|
* The following illustrates a simple echo server:
|
|
1004
1004
|
*
|
|
1005
1005
|
* ```js
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1006
|
+
* import tls from 'node:tls';
|
|
1007
|
+
* import fs from 'node:fs';
|
|
1008
1008
|
*
|
|
1009
1009
|
* const options = {
|
|
1010
1010
|
* key: fs.readFileSync('server-key.pem'),
|
|
@@ -1049,8 +1049,8 @@ declare module "tls" {
|
|
|
1049
1049
|
*
|
|
1050
1050
|
* ```js
|
|
1051
1051
|
* // Assumes an echo server that is listening on port 8000.
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1052
|
+
* import tls from 'node:tls';
|
|
1053
|
+
* import fs from 'node:fs';
|
|
1054
1054
|
*
|
|
1055
1055
|
* const options = {
|
|
1056
1056
|
* // Necessary only if the server requires client certificate authentication.
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
* Alternatively, trace events may be enabled using the `node:trace_events` module:
|
|
54
54
|
*
|
|
55
55
|
* ```js
|
|
56
|
-
*
|
|
56
|
+
* import trace_events from 'node:trace_events';
|
|
57
57
|
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
|
58
58
|
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
|
59
59
|
*
|
|
@@ -118,7 +118,7 @@ declare module "trace_events" {
|
|
|
118
118
|
* will be disabled.
|
|
119
119
|
*
|
|
120
120
|
* ```js
|
|
121
|
-
*
|
|
121
|
+
* import trace_events from 'node:trace_events';
|
|
122
122
|
* const t1 = trace_events.createTracing({ categories: ['node', 'v8'] });
|
|
123
123
|
* const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] });
|
|
124
124
|
* t1.enable();
|
|
@@ -159,7 +159,7 @@ declare module "trace_events" {
|
|
|
159
159
|
* Creates and returns a `Tracing` object for the given set of `categories`.
|
|
160
160
|
*
|
|
161
161
|
* ```js
|
|
162
|
-
*
|
|
162
|
+
* import trace_events from 'node:trace_events';
|
|
163
163
|
* const categories = ['node.perf', 'node.async_hooks'];
|
|
164
164
|
* const tracing = trace_events.createTracing({ categories });
|
|
165
165
|
* tracing.enable();
|
|
@@ -178,7 +178,7 @@ declare module "trace_events" {
|
|
|
178
178
|
* Given the file `test.js` below, the command `node --trace-event-categories node.perf test.js` will print `'node.async_hooks,node.perf'` to the console.
|
|
179
179
|
*
|
|
180
180
|
* ```js
|
|
181
|
-
*
|
|
181
|
+
* import trace_events from 'node:trace_events';
|
|
182
182
|
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
|
183
183
|
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
|
184
184
|
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
declare module "buffer" {
|
|
2
|
+
global {
|
|
3
|
+
interface BufferConstructor {
|
|
4
|
+
// see ../buffer.d.ts for implementation shared with all TypeScript versions
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Allocates a new buffer containing the given {str}.
|
|
8
|
+
*
|
|
9
|
+
* @param str String to store in buffer.
|
|
10
|
+
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
11
|
+
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
|
12
|
+
*/
|
|
13
|
+
new(str: string, encoding?: BufferEncoding): Buffer;
|
|
14
|
+
/**
|
|
15
|
+
* Allocates a new buffer of {size} octets.
|
|
16
|
+
*
|
|
17
|
+
* @param size count of octets to allocate.
|
|
18
|
+
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
|
19
|
+
*/
|
|
20
|
+
new(size: number): Buffer;
|
|
21
|
+
/**
|
|
22
|
+
* Allocates a new buffer containing the given {array} of octets.
|
|
23
|
+
*
|
|
24
|
+
* @param array The octets to store.
|
|
25
|
+
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
26
|
+
*/
|
|
27
|
+
new(array: Uint8Array): Buffer;
|
|
28
|
+
/**
|
|
29
|
+
* Produces a Buffer backed by the same allocated memory as
|
|
30
|
+
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
|
31
|
+
*
|
|
32
|
+
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
33
|
+
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
|
34
|
+
*/
|
|
35
|
+
new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
|
|
36
|
+
/**
|
|
37
|
+
* Allocates a new buffer containing the given {array} of octets.
|
|
38
|
+
*
|
|
39
|
+
* @param array The octets to store.
|
|
40
|
+
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
41
|
+
*/
|
|
42
|
+
new(array: readonly any[]): Buffer;
|
|
43
|
+
/**
|
|
44
|
+
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
45
|
+
*
|
|
46
|
+
* @param buffer The buffer to copy.
|
|
47
|
+
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
|
48
|
+
*/
|
|
49
|
+
new(buffer: Buffer): Buffer;
|
|
50
|
+
/**
|
|
51
|
+
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
|
52
|
+
* Array entries outside that range will be truncated to fit into it.
|
|
53
|
+
*
|
|
54
|
+
* ```js
|
|
55
|
+
* import { Buffer } from 'node:buffer';
|
|
56
|
+
*
|
|
57
|
+
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
|
58
|
+
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* If `array` is an `Array`\-like object (that is, one with a `length` property of
|
|
62
|
+
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
|
63
|
+
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
|
|
64
|
+
*
|
|
65
|
+
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
|
66
|
+
* appropriate for `Buffer.from()` variants.
|
|
67
|
+
*
|
|
68
|
+
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
69
|
+
* @since v5.10.0
|
|
70
|
+
*/
|
|
71
|
+
from(
|
|
72
|
+
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
|
|
73
|
+
byteOffset?: number,
|
|
74
|
+
length?: number,
|
|
75
|
+
): Buffer;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a new Buffer using the passed {data}
|
|
78
|
+
* @param data data to create a new Buffer
|
|
79
|
+
*/
|
|
80
|
+
from(data: Uint8Array | readonly number[]): Buffer;
|
|
81
|
+
from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
84
|
+
* If provided, the {encoding} parameter identifies the character encoding.
|
|
85
|
+
* If not provided, {encoding} defaults to 'utf8'.
|
|
86
|
+
*/
|
|
87
|
+
from(
|
|
88
|
+
str:
|
|
89
|
+
| WithImplicitCoercion<string>
|
|
90
|
+
| {
|
|
91
|
+
[Symbol.toPrimitive](hint: "string"): string;
|
|
92
|
+
},
|
|
93
|
+
encoding?: BufferEncoding,
|
|
94
|
+
): Buffer;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new Buffer using the passed {data}
|
|
97
|
+
* @param values to create a new Buffer
|
|
98
|
+
*/
|
|
99
|
+
of(...items: number[]): Buffer;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
|
102
|
+
*
|
|
103
|
+
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
|
104
|
+
*
|
|
105
|
+
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
|
106
|
+
* in `list` by adding their lengths.
|
|
107
|
+
*
|
|
108
|
+
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
|
109
|
+
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
110
|
+
* truncated to `totalLength`.
|
|
111
|
+
*
|
|
112
|
+
* ```js
|
|
113
|
+
* import { Buffer } from 'node:buffer';
|
|
114
|
+
*
|
|
115
|
+
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
|
116
|
+
*
|
|
117
|
+
* const buf1 = Buffer.alloc(10);
|
|
118
|
+
* const buf2 = Buffer.alloc(14);
|
|
119
|
+
* const buf3 = Buffer.alloc(18);
|
|
120
|
+
* const totalLength = buf1.length + buf2.length + buf3.length;
|
|
121
|
+
*
|
|
122
|
+
* console.log(totalLength);
|
|
123
|
+
* // Prints: 42
|
|
124
|
+
*
|
|
125
|
+
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
|
126
|
+
*
|
|
127
|
+
* console.log(bufA);
|
|
128
|
+
* // Prints: <Buffer 00 00 00 00 ...>
|
|
129
|
+
* console.log(bufA.length);
|
|
130
|
+
* // Prints: 42
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
134
|
+
* @since v0.7.11
|
|
135
|
+
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
|
136
|
+
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
|
137
|
+
*/
|
|
138
|
+
concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
|
|
139
|
+
/**
|
|
140
|
+
* Copies the underlying memory of `view` into a new `Buffer`.
|
|
141
|
+
*
|
|
142
|
+
* ```js
|
|
143
|
+
* const u16 = new Uint16Array([0, 0xffff]);
|
|
144
|
+
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
|
145
|
+
* u16[1] = 0;
|
|
146
|
+
* console.log(buf.length); // 2
|
|
147
|
+
* console.log(buf[0]); // 255
|
|
148
|
+
* console.log(buf[1]); // 255
|
|
149
|
+
* ```
|
|
150
|
+
* @since v19.8.0
|
|
151
|
+
* @param view The {TypedArray} to copy.
|
|
152
|
+
* @param [offset=0] The starting offset within `view`.
|
|
153
|
+
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
|
154
|
+
*/
|
|
155
|
+
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
|
|
156
|
+
/**
|
|
157
|
+
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
|
158
|
+
*
|
|
159
|
+
* ```js
|
|
160
|
+
* import { Buffer } from 'node:buffer';
|
|
161
|
+
*
|
|
162
|
+
* const buf = Buffer.alloc(5);
|
|
163
|
+
*
|
|
164
|
+
* console.log(buf);
|
|
165
|
+
* // Prints: <Buffer 00 00 00 00 00>
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
|
169
|
+
*
|
|
170
|
+
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
|
171
|
+
*
|
|
172
|
+
* ```js
|
|
173
|
+
* import { Buffer } from 'node:buffer';
|
|
174
|
+
*
|
|
175
|
+
* const buf = Buffer.alloc(5, 'a');
|
|
176
|
+
*
|
|
177
|
+
* console.log(buf);
|
|
178
|
+
* // Prints: <Buffer 61 61 61 61 61>
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
|
182
|
+
* initialized by calling `buf.fill(fill, encoding)`.
|
|
183
|
+
*
|
|
184
|
+
* ```js
|
|
185
|
+
* import { Buffer } from 'node:buffer';
|
|
186
|
+
*
|
|
187
|
+
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
|
188
|
+
*
|
|
189
|
+
* console.log(buf);
|
|
190
|
+
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
|
194
|
+
* contents will never contain sensitive data from previous allocations, including
|
|
195
|
+
* data that might not have been allocated for `Buffer`s.
|
|
196
|
+
*
|
|
197
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
198
|
+
* @since v5.10.0
|
|
199
|
+
* @param size The desired length of the new `Buffer`.
|
|
200
|
+
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
|
201
|
+
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
|
202
|
+
*/
|
|
203
|
+
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
|
|
204
|
+
/**
|
|
205
|
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
|
206
|
+
*
|
|
207
|
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
208
|
+
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
|
209
|
+
*
|
|
210
|
+
* ```js
|
|
211
|
+
* import { Buffer } from 'node:buffer';
|
|
212
|
+
*
|
|
213
|
+
* const buf = Buffer.allocUnsafe(10);
|
|
214
|
+
*
|
|
215
|
+
* console.log(buf);
|
|
216
|
+
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
|
217
|
+
*
|
|
218
|
+
* buf.fill(0);
|
|
219
|
+
*
|
|
220
|
+
* console.log(buf);
|
|
221
|
+
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
225
|
+
*
|
|
226
|
+
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
|
227
|
+
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
|
228
|
+
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
|
229
|
+
*
|
|
230
|
+
* Use of this pre-allocated internal memory pool is a key difference between
|
|
231
|
+
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
|
232
|
+
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
|
233
|
+
* than or equal to half `Buffer.poolSize`. The
|
|
234
|
+
* difference is subtle but can be important when an application requires the
|
|
235
|
+
* additional performance that `Buffer.allocUnsafe()` provides.
|
|
236
|
+
* @since v5.10.0
|
|
237
|
+
* @param size The desired length of the new `Buffer`.
|
|
238
|
+
*/
|
|
239
|
+
allocUnsafe(size: number): Buffer;
|
|
240
|
+
/**
|
|
241
|
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
|
|
242
|
+
* `size` is 0.
|
|
243
|
+
*
|
|
244
|
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
245
|
+
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
|
246
|
+
* such `Buffer` instances with zeroes.
|
|
247
|
+
*
|
|
248
|
+
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
|
249
|
+
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
|
250
|
+
* allows applications to avoid the garbage collection overhead of creating many
|
|
251
|
+
* individually allocated `Buffer` instances. This approach improves both
|
|
252
|
+
* performance and memory usage by eliminating the need to track and clean up as
|
|
253
|
+
* many individual `ArrayBuffer` objects.
|
|
254
|
+
*
|
|
255
|
+
* However, in the case where a developer may need to retain a small chunk of
|
|
256
|
+
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
|
257
|
+
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
|
258
|
+
* then copying out the relevant bits.
|
|
259
|
+
*
|
|
260
|
+
* ```js
|
|
261
|
+
* import { Buffer } from 'node:buffer';
|
|
262
|
+
*
|
|
263
|
+
* // Need to keep around a few small chunks of memory.
|
|
264
|
+
* const store = [];
|
|
265
|
+
*
|
|
266
|
+
* socket.on('readable', () => {
|
|
267
|
+
* let data;
|
|
268
|
+
* while (null !== (data = readable.read())) {
|
|
269
|
+
* // Allocate for retained data.
|
|
270
|
+
* const sb = Buffer.allocUnsafeSlow(10);
|
|
271
|
+
*
|
|
272
|
+
* // Copy the data into the new allocation.
|
|
273
|
+
* data.copy(sb, 0, 0, 10);
|
|
274
|
+
*
|
|
275
|
+
* store.push(sb);
|
|
276
|
+
* }
|
|
277
|
+
* });
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* A `TypeError` will be thrown if `size` is not a number.
|
|
281
|
+
* @since v5.12.0
|
|
282
|
+
* @param size The desired length of the new `Buffer`.
|
|
283
|
+
*/
|
|
284
|
+
allocUnsafeSlow(size: number): Buffer;
|
|
285
|
+
}
|
|
286
|
+
interface Buffer extends Uint8Array {
|
|
287
|
+
// see ../buffer.d.ts for implementation shared with all TypeScript versions
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Returns a new `Buffer` that references the same memory as the original, but
|
|
291
|
+
* offset and cropped by the `start` and `end` indices.
|
|
292
|
+
*
|
|
293
|
+
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
|
294
|
+
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
|
295
|
+
*
|
|
296
|
+
* ```js
|
|
297
|
+
* import { Buffer } from 'node:buffer';
|
|
298
|
+
*
|
|
299
|
+
* const buf = Buffer.from('buffer');
|
|
300
|
+
*
|
|
301
|
+
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
|
302
|
+
* copiedBuf[0]++;
|
|
303
|
+
* console.log(copiedBuf.toString());
|
|
304
|
+
* // Prints: cuffer
|
|
305
|
+
*
|
|
306
|
+
* console.log(buf.toString());
|
|
307
|
+
* // Prints: buffer
|
|
308
|
+
*
|
|
309
|
+
* // With buf.slice(), the original buffer is modified.
|
|
310
|
+
* const notReallyCopiedBuf = buf.slice();
|
|
311
|
+
* notReallyCopiedBuf[0]++;
|
|
312
|
+
* console.log(notReallyCopiedBuf.toString());
|
|
313
|
+
* // Prints: cuffer
|
|
314
|
+
* console.log(buf.toString());
|
|
315
|
+
* // Also prints: cuffer (!)
|
|
316
|
+
* ```
|
|
317
|
+
* @since v0.3.0
|
|
318
|
+
* @deprecated Use `subarray` instead.
|
|
319
|
+
* @param [start=0] Where the new `Buffer` will start.
|
|
320
|
+
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
321
|
+
*/
|
|
322
|
+
slice(start?: number, end?: number): Buffer;
|
|
323
|
+
/**
|
|
324
|
+
* Returns a new `Buffer` that references the same memory as the original, but
|
|
325
|
+
* offset and cropped by the `start` and `end` indices.
|
|
326
|
+
*
|
|
327
|
+
* Specifying `end` greater than `buf.length` will return the same result as
|
|
328
|
+
* that of `end` equal to `buf.length`.
|
|
329
|
+
*
|
|
330
|
+
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
|
331
|
+
*
|
|
332
|
+
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
|
333
|
+
*
|
|
334
|
+
* ```js
|
|
335
|
+
* import { Buffer } from 'node:buffer';
|
|
336
|
+
*
|
|
337
|
+
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
|
338
|
+
* // from the original `Buffer`.
|
|
339
|
+
*
|
|
340
|
+
* const buf1 = Buffer.allocUnsafe(26);
|
|
341
|
+
*
|
|
342
|
+
* for (let i = 0; i < 26; i++) {
|
|
343
|
+
* // 97 is the decimal ASCII value for 'a'.
|
|
344
|
+
* buf1[i] = i + 97;
|
|
345
|
+
* }
|
|
346
|
+
*
|
|
347
|
+
* const buf2 = buf1.subarray(0, 3);
|
|
348
|
+
*
|
|
349
|
+
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
350
|
+
* // Prints: abc
|
|
351
|
+
*
|
|
352
|
+
* buf1[0] = 33;
|
|
353
|
+
*
|
|
354
|
+
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
355
|
+
* // Prints: !bc
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* Specifying negative indexes causes the slice to be generated relative to the
|
|
359
|
+
* end of `buf` rather than the beginning.
|
|
360
|
+
*
|
|
361
|
+
* ```js
|
|
362
|
+
* import { Buffer } from 'node:buffer';
|
|
363
|
+
*
|
|
364
|
+
* const buf = Buffer.from('buffer');
|
|
365
|
+
*
|
|
366
|
+
* console.log(buf.subarray(-6, -1).toString());
|
|
367
|
+
* // Prints: buffe
|
|
368
|
+
* // (Equivalent to buf.subarray(0, 5).)
|
|
369
|
+
*
|
|
370
|
+
* console.log(buf.subarray(-6, -2).toString());
|
|
371
|
+
* // Prints: buff
|
|
372
|
+
* // (Equivalent to buf.subarray(0, 4).)
|
|
373
|
+
*
|
|
374
|
+
* console.log(buf.subarray(-5, -2).toString());
|
|
375
|
+
* // Prints: uff
|
|
376
|
+
* // (Equivalent to buf.subarray(1, 4).)
|
|
377
|
+
* ```
|
|
378
|
+
* @since v3.0.0
|
|
379
|
+
* @param [start=0] Where the new `Buffer` will start.
|
|
380
|
+
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
381
|
+
*/
|
|
382
|
+
subarray(start?: number, end?: number): Buffer;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export {}; // Make this a module
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace NodeJS {
|
|
5
|
+
type TypedArray =
|
|
6
|
+
| Uint8Array
|
|
7
|
+
| Uint8ClampedArray
|
|
8
|
+
| Uint16Array
|
|
9
|
+
| Uint32Array
|
|
10
|
+
| Int8Array
|
|
11
|
+
| Int16Array
|
|
12
|
+
| Int32Array
|
|
13
|
+
| BigUint64Array
|
|
14
|
+
| BigInt64Array
|
|
15
|
+
| Float32Array
|
|
16
|
+
| Float64Array;
|
|
17
|
+
type ArrayBufferView = TypedArray | DataView;
|
|
18
|
+
}
|
|
19
|
+
}
|