@emulsify/cli 1.11.0 → 1.11.1
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/dist/node_modules/.package-lock.json +18 -18
- package/dist/node_modules/@types/node/README.md +1 -1
- package/dist/node_modules/@types/node/assert.d.ts +2 -2
- package/dist/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/dist/node_modules/@types/node/buffer.d.ts +30 -390
- package/dist/node_modules/@types/node/child_process.d.ts +32 -28
- package/dist/node_modules/@types/node/cluster.d.ts +1 -1
- package/dist/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/dist/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/dist/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/dist/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/dist/node_modules/@types/node/console.d.ts +2 -2
- package/dist/node_modules/@types/node/crypto.d.ts +3 -3
- package/dist/node_modules/@types/node/dns/promises.d.ts +6 -5
- package/dist/node_modules/@types/node/dns.d.ts +5 -5
- package/dist/node_modules/@types/node/domain.d.ts +2 -2
- package/dist/node_modules/@types/node/events.d.ts +3 -3
- package/dist/node_modules/@types/node/fs/promises.d.ts +2 -2
- package/dist/node_modules/@types/node/fs.d.ts +2 -2
- package/dist/node_modules/@types/node/globals.d.ts +124 -68
- package/dist/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/dist/node_modules/@types/node/http.d.ts +43 -7
- package/dist/node_modules/@types/node/http2.d.ts +238 -101
- package/dist/node_modules/@types/node/https.d.ts +17 -23
- package/dist/node_modules/@types/node/index.d.ts +11 -9
- package/dist/node_modules/@types/node/module.d.ts +3 -3
- package/dist/node_modules/@types/node/net.d.ts +8 -2
- package/dist/node_modules/@types/node/os.d.ts +1 -1
- package/dist/node_modules/@types/node/package.json +10 -2
- package/dist/node_modules/@types/node/path.d.ts +10 -1
- package/dist/node_modules/@types/node/perf_hooks.d.ts +19 -19
- package/dist/node_modules/@types/node/punycode.d.ts +1 -1
- package/dist/node_modules/@types/node/querystring.d.ts +1 -1
- package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/dist/node_modules/@types/node/readline.d.ts +10 -10
- package/dist/node_modules/@types/node/repl.d.ts +4 -4
- package/dist/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/dist/node_modules/@types/node/stream/web.d.ts +182 -25
- package/dist/node_modules/@types/node/stream.d.ts +36 -17
- package/dist/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/dist/node_modules/@types/node/test.d.ts +85 -12
- package/dist/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/dist/node_modules/@types/node/timers.d.ts +1 -1
- package/dist/node_modules/@types/node/tls.d.ts +5 -5
- package/dist/node_modules/@types/node/trace_events.d.ts +4 -4
- package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/dist/node_modules/@types/node/ts5.6/index.d.ts +91 -0
- package/dist/node_modules/@types/node/tty.d.ts +1 -1
- package/dist/node_modules/@types/node/url.d.ts +14 -11
- package/dist/node_modules/@types/node/util.d.ts +49 -49
- package/dist/node_modules/@types/node/v8.d.ts +12 -12
- package/dist/node_modules/@types/node/vm.d.ts +11 -12
- package/dist/node_modules/@types/node/worker_threads.d.ts +22 -22
- package/dist/node_modules/@types/node/zlib.d.ts +8 -8
- package/dist/node_modules/debug/README.md +1 -1
- package/dist/node_modules/debug/package.json +2 -2
- package/dist/node_modules/fast-uri/.github/workflows/ci.yml +2 -2
- package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +1 -1
- package/dist/node_modules/fast-uri/index.js +3 -9
- package/dist/node_modules/fast-uri/package.json +4 -4
- package/dist/node_modules/fast-uri/test/ajv.test.js +1 -1
- package/dist/node_modules/fast-uri/test/compatibility.test.js +3 -2
- package/dist/node_modules/fast-uri/test/equal.test.js +1 -2
- package/dist/node_modules/fast-uri/test/parse.test.js +1 -2
- package/dist/node_modules/fast-uri/test/resolve.test.js +1 -2
- package/dist/node_modules/fast-uri/test/serialize.test.js +1 -2
- package/dist/node_modules/fast-uri/test/uri-js.test.js +539 -567
- package/dist/node_modules/fast-uri/test/util.test.js +2 -3
- package/dist/node_modules/ms/index.js +1 -1
- package/dist/node_modules/ms/license.md +1 -1
- package/dist/node_modules/ms/package.json +5 -4
- package/dist/node_modules/ms/readme.md +1 -2
- package/dist/node_modules/simple-git/dist/cjs/index.js +14 -15
- package/dist/node_modules/simple-git/dist/cjs/index.js.map +2 -2
- package/dist/node_modules/simple-git/dist/esm/index.js +14 -15
- package/dist/node_modules/simple-git/dist/esm/index.js.map +2 -2
- package/dist/node_modules/simple-git/dist/typings/response.d.ts +7 -6
- package/dist/node_modules/simple-git/package.json +5 -5
- package/dist/package-lock.json +720 -643
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/node_modules/@types/node/globals.global.d.ts +0 -1
- package/dist/node_modules/fast-uri/.taprc +0 -3
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
|
|
2
|
+
// Otherwise, use the types from node.
|
|
3
|
+
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
|
|
4
|
+
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
|
3
8
|
* Node.js APIs support `Buffer`s.
|
|
@@ -129,7 +134,7 @@ declare module "buffer" {
|
|
|
129
134
|
export interface BlobOptions {
|
|
130
135
|
/**
|
|
131
136
|
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
|
|
132
|
-
* will be converted to the platform native line-ending as specified by `
|
|
137
|
+
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:node:os'`.
|
|
133
138
|
*/
|
|
134
139
|
endings?: "transparent" | "native";
|
|
135
140
|
/**
|
|
@@ -206,7 +211,7 @@ declare module "buffer" {
|
|
|
206
211
|
export interface FileOptions {
|
|
207
212
|
/**
|
|
208
213
|
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
|
209
|
-
* converted to the platform native line-ending as specified by `
|
|
214
|
+
* converted to the platform native line-ending as specified by `import { EOL } from 'node:node:os'`.
|
|
210
215
|
*/
|
|
211
216
|
endings?: "native" | "transparent";
|
|
212
217
|
/** The File content-type. */
|
|
@@ -233,10 +238,7 @@ declare module "buffer" {
|
|
|
233
238
|
}
|
|
234
239
|
export import atob = globalThis.atob;
|
|
235
240
|
export import btoa = globalThis.btoa;
|
|
236
|
-
|
|
237
|
-
// This conditional type will be the existing global Blob in a browser, or
|
|
238
|
-
// the copy below in a Node environment.
|
|
239
|
-
type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
|
|
241
|
+
|
|
240
242
|
global {
|
|
241
243
|
namespace NodeJS {
|
|
242
244
|
export { BufferEncoding };
|
|
@@ -266,100 +268,9 @@ declare module "buffer" {
|
|
|
266
268
|
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
|
|
267
269
|
*/
|
|
268
270
|
interface BufferConstructor {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
* @param str String to store in buffer.
|
|
273
|
-
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
274
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
|
275
|
-
*/
|
|
276
|
-
new(str: string, encoding?: BufferEncoding): Buffer;
|
|
277
|
-
/**
|
|
278
|
-
* Allocates a new buffer of {size} octets.
|
|
279
|
-
*
|
|
280
|
-
* @param size count of octets to allocate.
|
|
281
|
-
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
|
282
|
-
*/
|
|
283
|
-
new(size: number): Buffer;
|
|
284
|
-
/**
|
|
285
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
286
|
-
*
|
|
287
|
-
* @param array The octets to store.
|
|
288
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
289
|
-
*/
|
|
290
|
-
new(array: Uint8Array): Buffer;
|
|
291
|
-
/**
|
|
292
|
-
* Produces a Buffer backed by the same allocated memory as
|
|
293
|
-
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
|
294
|
-
*
|
|
295
|
-
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
296
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
|
297
|
-
*/
|
|
298
|
-
new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
|
|
299
|
-
/**
|
|
300
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
301
|
-
*
|
|
302
|
-
* @param array The octets to store.
|
|
303
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
304
|
-
*/
|
|
305
|
-
new(array: readonly any[]): Buffer;
|
|
306
|
-
/**
|
|
307
|
-
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
308
|
-
*
|
|
309
|
-
* @param buffer The buffer to copy.
|
|
310
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
|
311
|
-
*/
|
|
312
|
-
new(buffer: Buffer): Buffer;
|
|
313
|
-
/**
|
|
314
|
-
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
|
315
|
-
* Array entries outside that range will be truncated to fit into it.
|
|
316
|
-
*
|
|
317
|
-
* ```js
|
|
318
|
-
* import { Buffer } from 'node:buffer';
|
|
319
|
-
*
|
|
320
|
-
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
|
321
|
-
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
|
322
|
-
* ```
|
|
323
|
-
*
|
|
324
|
-
* If `array` is an `Array`\-like object (that is, one with a `length` property of
|
|
325
|
-
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
|
326
|
-
* 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()`.
|
|
327
|
-
*
|
|
328
|
-
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
|
329
|
-
* appropriate for `Buffer.from()` variants.
|
|
330
|
-
*
|
|
331
|
-
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
332
|
-
* @since v5.10.0
|
|
333
|
-
*/
|
|
334
|
-
from(
|
|
335
|
-
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
|
|
336
|
-
byteOffset?: number,
|
|
337
|
-
length?: number,
|
|
338
|
-
): Buffer;
|
|
339
|
-
/**
|
|
340
|
-
* Creates a new Buffer using the passed {data}
|
|
341
|
-
* @param data data to create a new Buffer
|
|
342
|
-
*/
|
|
343
|
-
from(data: Uint8Array | readonly number[]): Buffer;
|
|
344
|
-
from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer;
|
|
345
|
-
/**
|
|
346
|
-
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
347
|
-
* If provided, the {encoding} parameter identifies the character encoding.
|
|
348
|
-
* If not provided, {encoding} defaults to 'utf8'.
|
|
349
|
-
*/
|
|
350
|
-
from(
|
|
351
|
-
str:
|
|
352
|
-
| WithImplicitCoercion<string>
|
|
353
|
-
| {
|
|
354
|
-
[Symbol.toPrimitive](hint: "string"): string;
|
|
355
|
-
},
|
|
356
|
-
encoding?: BufferEncoding,
|
|
357
|
-
): Buffer;
|
|
358
|
-
/**
|
|
359
|
-
* Creates a new Buffer using the passed {data}
|
|
360
|
-
* @param values to create a new Buffer
|
|
361
|
-
*/
|
|
362
|
-
of(...items: number[]): Buffer;
|
|
271
|
+
// see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
|
|
272
|
+
// see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
|
|
273
|
+
|
|
363
274
|
/**
|
|
364
275
|
* Returns `true` if `obj` is a `Buffer`, `false` otherwise.
|
|
365
276
|
*
|
|
@@ -431,62 +342,6 @@ declare module "buffer" {
|
|
|
431
342
|
string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
|
432
343
|
encoding?: BufferEncoding,
|
|
433
344
|
): number;
|
|
434
|
-
/**
|
|
435
|
-
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
|
436
|
-
*
|
|
437
|
-
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
|
438
|
-
*
|
|
439
|
-
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
|
440
|
-
* in `list` by adding their lengths.
|
|
441
|
-
*
|
|
442
|
-
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
|
443
|
-
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
444
|
-
* truncated to `totalLength`.
|
|
445
|
-
*
|
|
446
|
-
* ```js
|
|
447
|
-
* import { Buffer } from 'node:buffer';
|
|
448
|
-
*
|
|
449
|
-
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
|
450
|
-
*
|
|
451
|
-
* const buf1 = Buffer.alloc(10);
|
|
452
|
-
* const buf2 = Buffer.alloc(14);
|
|
453
|
-
* const buf3 = Buffer.alloc(18);
|
|
454
|
-
* const totalLength = buf1.length + buf2.length + buf3.length;
|
|
455
|
-
*
|
|
456
|
-
* console.log(totalLength);
|
|
457
|
-
* // Prints: 42
|
|
458
|
-
*
|
|
459
|
-
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
|
460
|
-
*
|
|
461
|
-
* console.log(bufA);
|
|
462
|
-
* // Prints: <Buffer 00 00 00 00 ...>
|
|
463
|
-
* console.log(bufA.length);
|
|
464
|
-
* // Prints: 42
|
|
465
|
-
* ```
|
|
466
|
-
*
|
|
467
|
-
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
468
|
-
* @since v0.7.11
|
|
469
|
-
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
|
470
|
-
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
|
471
|
-
*/
|
|
472
|
-
concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
|
|
473
|
-
/**
|
|
474
|
-
* Copies the underlying memory of `view` into a new `Buffer`.
|
|
475
|
-
*
|
|
476
|
-
* ```js
|
|
477
|
-
* const u16 = new Uint16Array([0, 0xffff]);
|
|
478
|
-
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
|
479
|
-
* u16[1] = 0;
|
|
480
|
-
* console.log(buf.length); // 2
|
|
481
|
-
* console.log(buf[0]); // 255
|
|
482
|
-
* console.log(buf[1]); // 255
|
|
483
|
-
* ```
|
|
484
|
-
* @since v19.8.0
|
|
485
|
-
* @param view The {TypedArray} to copy.
|
|
486
|
-
* @param [offset=0] The starting offset within `view`.
|
|
487
|
-
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
|
488
|
-
*/
|
|
489
|
-
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
|
|
490
345
|
/**
|
|
491
346
|
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
|
492
347
|
*
|
|
@@ -505,135 +360,6 @@ declare module "buffer" {
|
|
|
505
360
|
* @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
|
|
506
361
|
*/
|
|
507
362
|
compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
|
|
508
|
-
/**
|
|
509
|
-
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
|
510
|
-
*
|
|
511
|
-
* ```js
|
|
512
|
-
* import { Buffer } from 'node:buffer';
|
|
513
|
-
*
|
|
514
|
-
* const buf = Buffer.alloc(5);
|
|
515
|
-
*
|
|
516
|
-
* console.log(buf);
|
|
517
|
-
* // Prints: <Buffer 00 00 00 00 00>
|
|
518
|
-
* ```
|
|
519
|
-
*
|
|
520
|
-
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
|
521
|
-
*
|
|
522
|
-
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
|
523
|
-
*
|
|
524
|
-
* ```js
|
|
525
|
-
* import { Buffer } from 'node:buffer';
|
|
526
|
-
*
|
|
527
|
-
* const buf = Buffer.alloc(5, 'a');
|
|
528
|
-
*
|
|
529
|
-
* console.log(buf);
|
|
530
|
-
* // Prints: <Buffer 61 61 61 61 61>
|
|
531
|
-
* ```
|
|
532
|
-
*
|
|
533
|
-
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
|
534
|
-
* initialized by calling `buf.fill(fill, encoding)`.
|
|
535
|
-
*
|
|
536
|
-
* ```js
|
|
537
|
-
* import { Buffer } from 'node:buffer';
|
|
538
|
-
*
|
|
539
|
-
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
|
540
|
-
*
|
|
541
|
-
* console.log(buf);
|
|
542
|
-
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
|
543
|
-
* ```
|
|
544
|
-
*
|
|
545
|
-
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
|
546
|
-
* contents will never contain sensitive data from previous allocations, including
|
|
547
|
-
* data that might not have been allocated for `Buffer`s.
|
|
548
|
-
*
|
|
549
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
550
|
-
* @since v5.10.0
|
|
551
|
-
* @param size The desired length of the new `Buffer`.
|
|
552
|
-
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
|
553
|
-
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
|
554
|
-
*/
|
|
555
|
-
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
|
|
556
|
-
/**
|
|
557
|
-
* 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.
|
|
558
|
-
*
|
|
559
|
-
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
560
|
-
* _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.
|
|
561
|
-
*
|
|
562
|
-
* ```js
|
|
563
|
-
* import { Buffer } from 'node:buffer';
|
|
564
|
-
*
|
|
565
|
-
* const buf = Buffer.allocUnsafe(10);
|
|
566
|
-
*
|
|
567
|
-
* console.log(buf);
|
|
568
|
-
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
|
569
|
-
*
|
|
570
|
-
* buf.fill(0);
|
|
571
|
-
*
|
|
572
|
-
* console.log(buf);
|
|
573
|
-
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
|
574
|
-
* ```
|
|
575
|
-
*
|
|
576
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
577
|
-
*
|
|
578
|
-
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
|
579
|
-
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
|
580
|
-
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
|
581
|
-
*
|
|
582
|
-
* Use of this pre-allocated internal memory pool is a key difference between
|
|
583
|
-
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
|
584
|
-
* 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
|
|
585
|
-
* than or equal to half `Buffer.poolSize`. The
|
|
586
|
-
* difference is subtle but can be important when an application requires the
|
|
587
|
-
* additional performance that `Buffer.allocUnsafe()` provides.
|
|
588
|
-
* @since v5.10.0
|
|
589
|
-
* @param size The desired length of the new `Buffer`.
|
|
590
|
-
*/
|
|
591
|
-
allocUnsafe(size: number): Buffer;
|
|
592
|
-
/**
|
|
593
|
-
* 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
|
|
594
|
-
* `size` is 0.
|
|
595
|
-
*
|
|
596
|
-
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
597
|
-
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
|
598
|
-
* such `Buffer` instances with zeroes.
|
|
599
|
-
*
|
|
600
|
-
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
|
601
|
-
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
|
602
|
-
* allows applications to avoid the garbage collection overhead of creating many
|
|
603
|
-
* individually allocated `Buffer` instances. This approach improves both
|
|
604
|
-
* performance and memory usage by eliminating the need to track and clean up as
|
|
605
|
-
* many individual `ArrayBuffer` objects.
|
|
606
|
-
*
|
|
607
|
-
* However, in the case where a developer may need to retain a small chunk of
|
|
608
|
-
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
|
609
|
-
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
|
610
|
-
* then copying out the relevant bits.
|
|
611
|
-
*
|
|
612
|
-
* ```js
|
|
613
|
-
* import { Buffer } from 'node:buffer';
|
|
614
|
-
*
|
|
615
|
-
* // Need to keep around a few small chunks of memory.
|
|
616
|
-
* const store = [];
|
|
617
|
-
*
|
|
618
|
-
* socket.on('readable', () => {
|
|
619
|
-
* let data;
|
|
620
|
-
* while (null !== (data = readable.read())) {
|
|
621
|
-
* // Allocate for retained data.
|
|
622
|
-
* const sb = Buffer.allocUnsafeSlow(10);
|
|
623
|
-
*
|
|
624
|
-
* // Copy the data into the new allocation.
|
|
625
|
-
* data.copy(sb, 0, 0, 10);
|
|
626
|
-
*
|
|
627
|
-
* store.push(sb);
|
|
628
|
-
* }
|
|
629
|
-
* });
|
|
630
|
-
* ```
|
|
631
|
-
*
|
|
632
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
633
|
-
* @since v5.12.0
|
|
634
|
-
* @param size The desired length of the new `Buffer`.
|
|
635
|
-
*/
|
|
636
|
-
allocUnsafeSlow(size: number): Buffer;
|
|
637
363
|
/**
|
|
638
364
|
* This is the size (in bytes) of pre-allocated internal `Buffer` instances used
|
|
639
365
|
* for pooling. This value may be modified.
|
|
@@ -641,7 +367,10 @@ declare module "buffer" {
|
|
|
641
367
|
*/
|
|
642
368
|
poolSize: number;
|
|
643
369
|
}
|
|
644
|
-
interface Buffer
|
|
370
|
+
interface Buffer {
|
|
371
|
+
// see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
|
|
372
|
+
// see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
|
|
373
|
+
|
|
645
374
|
/**
|
|
646
375
|
* Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did
|
|
647
376
|
* not contain enough space to fit the entire string, only part of `string` will be
|
|
@@ -878,100 +607,6 @@ declare module "buffer" {
|
|
|
878
607
|
* @return The number of bytes copied.
|
|
879
608
|
*/
|
|
880
609
|
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
881
|
-
/**
|
|
882
|
-
* Returns a new `Buffer` that references the same memory as the original, but
|
|
883
|
-
* offset and cropped by the `start` and `end` indices.
|
|
884
|
-
*
|
|
885
|
-
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
|
886
|
-
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
|
887
|
-
*
|
|
888
|
-
* ```js
|
|
889
|
-
* import { Buffer } from 'node:buffer';
|
|
890
|
-
*
|
|
891
|
-
* const buf = Buffer.from('buffer');
|
|
892
|
-
*
|
|
893
|
-
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
|
894
|
-
* copiedBuf[0]++;
|
|
895
|
-
* console.log(copiedBuf.toString());
|
|
896
|
-
* // Prints: cuffer
|
|
897
|
-
*
|
|
898
|
-
* console.log(buf.toString());
|
|
899
|
-
* // Prints: buffer
|
|
900
|
-
*
|
|
901
|
-
* // With buf.slice(), the original buffer is modified.
|
|
902
|
-
* const notReallyCopiedBuf = buf.slice();
|
|
903
|
-
* notReallyCopiedBuf[0]++;
|
|
904
|
-
* console.log(notReallyCopiedBuf.toString());
|
|
905
|
-
* // Prints: cuffer
|
|
906
|
-
* console.log(buf.toString());
|
|
907
|
-
* // Also prints: cuffer (!)
|
|
908
|
-
* ```
|
|
909
|
-
* @since v0.3.0
|
|
910
|
-
* @deprecated Use `subarray` instead.
|
|
911
|
-
* @param [start=0] Where the new `Buffer` will start.
|
|
912
|
-
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
913
|
-
*/
|
|
914
|
-
slice(start?: number, end?: number): Buffer;
|
|
915
|
-
/**
|
|
916
|
-
* Returns a new `Buffer` that references the same memory as the original, but
|
|
917
|
-
* offset and cropped by the `start` and `end` indices.
|
|
918
|
-
*
|
|
919
|
-
* Specifying `end` greater than `buf.length` will return the same result as
|
|
920
|
-
* that of `end` equal to `buf.length`.
|
|
921
|
-
*
|
|
922
|
-
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
|
923
|
-
*
|
|
924
|
-
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
|
925
|
-
*
|
|
926
|
-
* ```js
|
|
927
|
-
* import { Buffer } from 'node:buffer';
|
|
928
|
-
*
|
|
929
|
-
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
|
930
|
-
* // from the original `Buffer`.
|
|
931
|
-
*
|
|
932
|
-
* const buf1 = Buffer.allocUnsafe(26);
|
|
933
|
-
*
|
|
934
|
-
* for (let i = 0; i < 26; i++) {
|
|
935
|
-
* // 97 is the decimal ASCII value for 'a'.
|
|
936
|
-
* buf1[i] = i + 97;
|
|
937
|
-
* }
|
|
938
|
-
*
|
|
939
|
-
* const buf2 = buf1.subarray(0, 3);
|
|
940
|
-
*
|
|
941
|
-
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
942
|
-
* // Prints: abc
|
|
943
|
-
*
|
|
944
|
-
* buf1[0] = 33;
|
|
945
|
-
*
|
|
946
|
-
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
947
|
-
* // Prints: !bc
|
|
948
|
-
* ```
|
|
949
|
-
*
|
|
950
|
-
* Specifying negative indexes causes the slice to be generated relative to the
|
|
951
|
-
* end of `buf` rather than the beginning.
|
|
952
|
-
*
|
|
953
|
-
* ```js
|
|
954
|
-
* import { Buffer } from 'node:buffer';
|
|
955
|
-
*
|
|
956
|
-
* const buf = Buffer.from('buffer');
|
|
957
|
-
*
|
|
958
|
-
* console.log(buf.subarray(-6, -1).toString());
|
|
959
|
-
* // Prints: buffe
|
|
960
|
-
* // (Equivalent to buf.subarray(0, 5).)
|
|
961
|
-
*
|
|
962
|
-
* console.log(buf.subarray(-6, -2).toString());
|
|
963
|
-
* // Prints: buff
|
|
964
|
-
* // (Equivalent to buf.subarray(0, 4).)
|
|
965
|
-
*
|
|
966
|
-
* console.log(buf.subarray(-5, -2).toString());
|
|
967
|
-
* // Prints: uff
|
|
968
|
-
* // (Equivalent to buf.subarray(1, 4).)
|
|
969
|
-
* ```
|
|
970
|
-
* @since v3.0.0
|
|
971
|
-
* @param [start=0] Where the new `Buffer` will start.
|
|
972
|
-
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
973
|
-
*/
|
|
974
|
-
subarray(start?: number, end?: number): Buffer;
|
|
975
610
|
/**
|
|
976
611
|
* Writes `value` to `buf` at the specified `offset` as big-endian.
|
|
977
612
|
*
|
|
@@ -1629,7 +1264,7 @@ declare module "buffer" {
|
|
|
1629
1264
|
* @since v5.10.0
|
|
1630
1265
|
* @return A reference to `buf`.
|
|
1631
1266
|
*/
|
|
1632
|
-
swap16():
|
|
1267
|
+
swap16(): this;
|
|
1633
1268
|
/**
|
|
1634
1269
|
* Interprets `buf` as an array of unsigned 32-bit integers and swaps the
|
|
1635
1270
|
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
|
|
@@ -1655,7 +1290,7 @@ declare module "buffer" {
|
|
|
1655
1290
|
* @since v5.10.0
|
|
1656
1291
|
* @return A reference to `buf`.
|
|
1657
1292
|
*/
|
|
1658
|
-
swap32():
|
|
1293
|
+
swap32(): this;
|
|
1659
1294
|
/**
|
|
1660
1295
|
* Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
|
|
1661
1296
|
* Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
|
|
@@ -1681,7 +1316,7 @@ declare module "buffer" {
|
|
|
1681
1316
|
* @since v6.3.0
|
|
1682
1317
|
* @return A reference to `buf`.
|
|
1683
1318
|
*/
|
|
1684
|
-
swap64():
|
|
1319
|
+
swap64(): this;
|
|
1685
1320
|
/**
|
|
1686
1321
|
* Writes `value` to `buf` at the specified `offset`. `value` must be a
|
|
1687
1322
|
* valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
|
|
@@ -2276,17 +1911,22 @@ declare module "buffer" {
|
|
|
2276
1911
|
* @param data An ASCII (Latin1) string.
|
|
2277
1912
|
*/
|
|
2278
1913
|
function btoa(data: string): string;
|
|
2279
|
-
interface Blob extends
|
|
1914
|
+
interface Blob extends _Blob {}
|
|
2280
1915
|
/**
|
|
2281
|
-
* `Blob` class is a global reference for `
|
|
1916
|
+
* `Blob` class is a global reference for `import { Blob } from 'node:node:buffer'`
|
|
2282
1917
|
* https://nodejs.org/api/buffer.html#class-blob
|
|
2283
1918
|
* @since v18.0.0
|
|
2284
1919
|
*/
|
|
2285
|
-
var Blob: typeof globalThis extends {
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
1920
|
+
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
|
|
1921
|
+
: typeof import("buffer").Blob;
|
|
1922
|
+
interface File extends _File {}
|
|
1923
|
+
/**
|
|
1924
|
+
* `File` class is a global reference for `import { File } from 'node:node:buffer'`
|
|
1925
|
+
* https://nodejs.org/api/buffer.html#class-file
|
|
1926
|
+
* @since v20.0.0
|
|
1927
|
+
*/
|
|
1928
|
+
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
|
|
1929
|
+
: typeof import("buffer").File;
|
|
2290
1930
|
}
|
|
2291
1931
|
}
|
|
2292
1932
|
declare module "node:buffer" {
|