@emulsify/cli 1.10.2 → 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/README.md +6 -6
- package/dist/node_modules/.package-lock.json +22 -22
- 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 +42 -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/inspector.d.ts +1061 -111
- 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 +11 -3
- package/dist/node_modules/@types/node/path.d.ts +10 -1
- package/dist/node_modules/@types/node/perf_hooks.d.ts +49 -20
- package/dist/node_modules/@types/node/process.d.ts +142 -17
- 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 +313 -94
- 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 +55 -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 +17 -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/node_modules/undici-types/LICENSE +21 -0
- package/dist/node_modules/undici-types/balanced-pool.d.ts +11 -0
- package/dist/node_modules/undici-types/client.d.ts +12 -1
- package/dist/node_modules/undici-types/diagnostics-channel.d.ts +1 -2
- package/dist/node_modules/undici-types/dispatcher.d.ts +18 -4
- package/dist/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/dist/node_modules/undici-types/errors.d.ts +21 -0
- package/dist/node_modules/undici-types/eventsource.d.ts +63 -0
- package/dist/node_modules/undici-types/fetch.d.ts +25 -25
- package/dist/node_modules/undici-types/formdata.d.ts +1 -1
- package/dist/node_modules/undici-types/handlers.d.ts +10 -4
- package/dist/node_modules/undici-types/index.d.ts +10 -2
- package/dist/node_modules/undici-types/interceptors.d.ts +12 -2
- package/dist/node_modules/undici-types/mock-interceptor.d.ts +4 -4
- package/dist/node_modules/undici-types/package.json +1 -1
- package/dist/node_modules/undici-types/pool.d.ts +11 -0
- package/dist/node_modules/undici-types/proxy-agent.d.ts +0 -2
- package/dist/node_modules/undici-types/readable.d.ts +2 -3
- package/dist/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/dist/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/dist/node_modules/undici-types/util.d.ts +18 -0
- package/dist/node_modules/undici-types/webidl.d.ts +10 -8
- package/dist/node_modules/undici-types/websocket.d.ts +22 -1
- package/dist/package-lock.json +834 -700
- package/dist/package.json +2 -2
- package/dist/util/system/getAvailableSystems.js +5 -0
- 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
|
/**
|
|
@@ -170,6 +175,18 @@ declare module "buffer" {
|
|
|
170
175
|
* @since v15.7.0, v14.18.0
|
|
171
176
|
*/
|
|
172
177
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
178
|
+
/**
|
|
179
|
+
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
|
|
180
|
+
*
|
|
181
|
+
* ```js
|
|
182
|
+
* const blob = new Blob(['hello']);
|
|
183
|
+
* blob.bytes().then((bytes) => {
|
|
184
|
+
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
* @since v20.16.0
|
|
188
|
+
*/
|
|
189
|
+
bytes(): Promise<Uint8Array>;
|
|
173
190
|
/**
|
|
174
191
|
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
|
|
175
192
|
* data. The original `Blob` is not altered.
|
|
@@ -194,7 +211,7 @@ declare module "buffer" {
|
|
|
194
211
|
export interface FileOptions {
|
|
195
212
|
/**
|
|
196
213
|
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
|
197
|
-
* 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'`.
|
|
198
215
|
*/
|
|
199
216
|
endings?: "native" | "transparent";
|
|
200
217
|
/** The File content-type. */
|
|
@@ -221,10 +238,7 @@ declare module "buffer" {
|
|
|
221
238
|
}
|
|
222
239
|
export import atob = globalThis.atob;
|
|
223
240
|
export import btoa = globalThis.btoa;
|
|
224
|
-
|
|
225
|
-
// This conditional type will be the existing global Blob in a browser, or
|
|
226
|
-
// the copy below in a Node environment.
|
|
227
|
-
type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
|
|
241
|
+
|
|
228
242
|
global {
|
|
229
243
|
namespace NodeJS {
|
|
230
244
|
export { BufferEncoding };
|
|
@@ -254,100 +268,9 @@ declare module "buffer" {
|
|
|
254
268
|
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
|
|
255
269
|
*/
|
|
256
270
|
interface BufferConstructor {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
* @param str String to store in buffer.
|
|
261
|
-
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
262
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
|
263
|
-
*/
|
|
264
|
-
new(str: string, encoding?: BufferEncoding): Buffer;
|
|
265
|
-
/**
|
|
266
|
-
* Allocates a new buffer of {size} octets.
|
|
267
|
-
*
|
|
268
|
-
* @param size count of octets to allocate.
|
|
269
|
-
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
|
270
|
-
*/
|
|
271
|
-
new(size: number): Buffer;
|
|
272
|
-
/**
|
|
273
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
274
|
-
*
|
|
275
|
-
* @param array The octets to store.
|
|
276
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
277
|
-
*/
|
|
278
|
-
new(array: Uint8Array): Buffer;
|
|
279
|
-
/**
|
|
280
|
-
* Produces a Buffer backed by the same allocated memory as
|
|
281
|
-
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
|
282
|
-
*
|
|
283
|
-
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
284
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
|
285
|
-
*/
|
|
286
|
-
new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
|
|
287
|
-
/**
|
|
288
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
289
|
-
*
|
|
290
|
-
* @param array The octets to store.
|
|
291
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
292
|
-
*/
|
|
293
|
-
new(array: readonly any[]): Buffer;
|
|
294
|
-
/**
|
|
295
|
-
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
296
|
-
*
|
|
297
|
-
* @param buffer The buffer to copy.
|
|
298
|
-
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
|
299
|
-
*/
|
|
300
|
-
new(buffer: Buffer): Buffer;
|
|
301
|
-
/**
|
|
302
|
-
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
|
303
|
-
* Array entries outside that range will be truncated to fit into it.
|
|
304
|
-
*
|
|
305
|
-
* ```js
|
|
306
|
-
* import { Buffer } from 'node:buffer';
|
|
307
|
-
*
|
|
308
|
-
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
|
309
|
-
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
|
310
|
-
* ```
|
|
311
|
-
*
|
|
312
|
-
* If `array` is an `Array`\-like object (that is, one with a `length` property of
|
|
313
|
-
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
|
314
|
-
* 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()`.
|
|
315
|
-
*
|
|
316
|
-
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
|
317
|
-
* appropriate for `Buffer.from()` variants.
|
|
318
|
-
*
|
|
319
|
-
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
320
|
-
* @since v5.10.0
|
|
321
|
-
*/
|
|
322
|
-
from(
|
|
323
|
-
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
|
|
324
|
-
byteOffset?: number,
|
|
325
|
-
length?: number,
|
|
326
|
-
): Buffer;
|
|
327
|
-
/**
|
|
328
|
-
* Creates a new Buffer using the passed {data}
|
|
329
|
-
* @param data data to create a new Buffer
|
|
330
|
-
*/
|
|
331
|
-
from(data: Uint8Array | readonly number[]): Buffer;
|
|
332
|
-
from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer;
|
|
333
|
-
/**
|
|
334
|
-
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
335
|
-
* If provided, the {encoding} parameter identifies the character encoding.
|
|
336
|
-
* If not provided, {encoding} defaults to 'utf8'.
|
|
337
|
-
*/
|
|
338
|
-
from(
|
|
339
|
-
str:
|
|
340
|
-
| WithImplicitCoercion<string>
|
|
341
|
-
| {
|
|
342
|
-
[Symbol.toPrimitive](hint: "string"): string;
|
|
343
|
-
},
|
|
344
|
-
encoding?: BufferEncoding,
|
|
345
|
-
): Buffer;
|
|
346
|
-
/**
|
|
347
|
-
* Creates a new Buffer using the passed {data}
|
|
348
|
-
* @param values to create a new Buffer
|
|
349
|
-
*/
|
|
350
|
-
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
|
+
|
|
351
274
|
/**
|
|
352
275
|
* Returns `true` if `obj` is a `Buffer`, `false` otherwise.
|
|
353
276
|
*
|
|
@@ -419,62 +342,6 @@ declare module "buffer" {
|
|
|
419
342
|
string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
|
420
343
|
encoding?: BufferEncoding,
|
|
421
344
|
): number;
|
|
422
|
-
/**
|
|
423
|
-
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
|
424
|
-
*
|
|
425
|
-
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
|
426
|
-
*
|
|
427
|
-
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
|
428
|
-
* in `list` by adding their lengths.
|
|
429
|
-
*
|
|
430
|
-
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
|
431
|
-
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
|
432
|
-
* truncated to `totalLength`.
|
|
433
|
-
*
|
|
434
|
-
* ```js
|
|
435
|
-
* import { Buffer } from 'node:buffer';
|
|
436
|
-
*
|
|
437
|
-
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
|
438
|
-
*
|
|
439
|
-
* const buf1 = Buffer.alloc(10);
|
|
440
|
-
* const buf2 = Buffer.alloc(14);
|
|
441
|
-
* const buf3 = Buffer.alloc(18);
|
|
442
|
-
* const totalLength = buf1.length + buf2.length + buf3.length;
|
|
443
|
-
*
|
|
444
|
-
* console.log(totalLength);
|
|
445
|
-
* // Prints: 42
|
|
446
|
-
*
|
|
447
|
-
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
|
448
|
-
*
|
|
449
|
-
* console.log(bufA);
|
|
450
|
-
* // Prints: <Buffer 00 00 00 00 ...>
|
|
451
|
-
* console.log(bufA.length);
|
|
452
|
-
* // Prints: 42
|
|
453
|
-
* ```
|
|
454
|
-
*
|
|
455
|
-
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
|
456
|
-
* @since v0.7.11
|
|
457
|
-
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
|
458
|
-
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
|
459
|
-
*/
|
|
460
|
-
concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
|
|
461
|
-
/**
|
|
462
|
-
* Copies the underlying memory of `view` into a new `Buffer`.
|
|
463
|
-
*
|
|
464
|
-
* ```js
|
|
465
|
-
* const u16 = new Uint16Array([0, 0xffff]);
|
|
466
|
-
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
|
467
|
-
* u16[1] = 0;
|
|
468
|
-
* console.log(buf.length); // 2
|
|
469
|
-
* console.log(buf[0]); // 255
|
|
470
|
-
* console.log(buf[1]); // 255
|
|
471
|
-
* ```
|
|
472
|
-
* @since v19.8.0
|
|
473
|
-
* @param view The {TypedArray} to copy.
|
|
474
|
-
* @param [offset=0] The starting offset within `view`.
|
|
475
|
-
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
|
476
|
-
*/
|
|
477
|
-
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
|
|
478
345
|
/**
|
|
479
346
|
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
|
480
347
|
*
|
|
@@ -493,135 +360,6 @@ declare module "buffer" {
|
|
|
493
360
|
* @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
|
|
494
361
|
*/
|
|
495
362
|
compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
|
|
496
|
-
/**
|
|
497
|
-
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
|
498
|
-
*
|
|
499
|
-
* ```js
|
|
500
|
-
* import { Buffer } from 'node:buffer';
|
|
501
|
-
*
|
|
502
|
-
* const buf = Buffer.alloc(5);
|
|
503
|
-
*
|
|
504
|
-
* console.log(buf);
|
|
505
|
-
* // Prints: <Buffer 00 00 00 00 00>
|
|
506
|
-
* ```
|
|
507
|
-
*
|
|
508
|
-
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
|
509
|
-
*
|
|
510
|
-
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
|
511
|
-
*
|
|
512
|
-
* ```js
|
|
513
|
-
* import { Buffer } from 'node:buffer';
|
|
514
|
-
*
|
|
515
|
-
* const buf = Buffer.alloc(5, 'a');
|
|
516
|
-
*
|
|
517
|
-
* console.log(buf);
|
|
518
|
-
* // Prints: <Buffer 61 61 61 61 61>
|
|
519
|
-
* ```
|
|
520
|
-
*
|
|
521
|
-
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
|
522
|
-
* initialized by calling `buf.fill(fill, encoding)`.
|
|
523
|
-
*
|
|
524
|
-
* ```js
|
|
525
|
-
* import { Buffer } from 'node:buffer';
|
|
526
|
-
*
|
|
527
|
-
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
|
528
|
-
*
|
|
529
|
-
* console.log(buf);
|
|
530
|
-
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
|
531
|
-
* ```
|
|
532
|
-
*
|
|
533
|
-
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
|
534
|
-
* contents will never contain sensitive data from previous allocations, including
|
|
535
|
-
* data that might not have been allocated for `Buffer`s.
|
|
536
|
-
*
|
|
537
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
538
|
-
* @since v5.10.0
|
|
539
|
-
* @param size The desired length of the new `Buffer`.
|
|
540
|
-
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
|
541
|
-
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
|
542
|
-
*/
|
|
543
|
-
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
|
|
544
|
-
/**
|
|
545
|
-
* 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.
|
|
546
|
-
*
|
|
547
|
-
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
548
|
-
* _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.
|
|
549
|
-
*
|
|
550
|
-
* ```js
|
|
551
|
-
* import { Buffer } from 'node:buffer';
|
|
552
|
-
*
|
|
553
|
-
* const buf = Buffer.allocUnsafe(10);
|
|
554
|
-
*
|
|
555
|
-
* console.log(buf);
|
|
556
|
-
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
|
557
|
-
*
|
|
558
|
-
* buf.fill(0);
|
|
559
|
-
*
|
|
560
|
-
* console.log(buf);
|
|
561
|
-
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
|
562
|
-
* ```
|
|
563
|
-
*
|
|
564
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
565
|
-
*
|
|
566
|
-
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
|
567
|
-
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
|
568
|
-
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
|
569
|
-
*
|
|
570
|
-
* Use of this pre-allocated internal memory pool is a key difference between
|
|
571
|
-
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
|
572
|
-
* 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
|
|
573
|
-
* than or equal to half `Buffer.poolSize`. The
|
|
574
|
-
* difference is subtle but can be important when an application requires the
|
|
575
|
-
* additional performance that `Buffer.allocUnsafe()` provides.
|
|
576
|
-
* @since v5.10.0
|
|
577
|
-
* @param size The desired length of the new `Buffer`.
|
|
578
|
-
*/
|
|
579
|
-
allocUnsafe(size: number): Buffer;
|
|
580
|
-
/**
|
|
581
|
-
* 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
|
|
582
|
-
* `size` is 0.
|
|
583
|
-
*
|
|
584
|
-
* The underlying memory for `Buffer` instances created in this way is _not_
|
|
585
|
-
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
|
586
|
-
* such `Buffer` instances with zeroes.
|
|
587
|
-
*
|
|
588
|
-
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
|
589
|
-
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
|
590
|
-
* allows applications to avoid the garbage collection overhead of creating many
|
|
591
|
-
* individually allocated `Buffer` instances. This approach improves both
|
|
592
|
-
* performance and memory usage by eliminating the need to track and clean up as
|
|
593
|
-
* many individual `ArrayBuffer` objects.
|
|
594
|
-
*
|
|
595
|
-
* However, in the case where a developer may need to retain a small chunk of
|
|
596
|
-
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
|
597
|
-
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
|
598
|
-
* then copying out the relevant bits.
|
|
599
|
-
*
|
|
600
|
-
* ```js
|
|
601
|
-
* import { Buffer } from 'node:buffer';
|
|
602
|
-
*
|
|
603
|
-
* // Need to keep around a few small chunks of memory.
|
|
604
|
-
* const store = [];
|
|
605
|
-
*
|
|
606
|
-
* socket.on('readable', () => {
|
|
607
|
-
* let data;
|
|
608
|
-
* while (null !== (data = readable.read())) {
|
|
609
|
-
* // Allocate for retained data.
|
|
610
|
-
* const sb = Buffer.allocUnsafeSlow(10);
|
|
611
|
-
*
|
|
612
|
-
* // Copy the data into the new allocation.
|
|
613
|
-
* data.copy(sb, 0, 0, 10);
|
|
614
|
-
*
|
|
615
|
-
* store.push(sb);
|
|
616
|
-
* }
|
|
617
|
-
* });
|
|
618
|
-
* ```
|
|
619
|
-
*
|
|
620
|
-
* A `TypeError` will be thrown if `size` is not a number.
|
|
621
|
-
* @since v5.12.0
|
|
622
|
-
* @param size The desired length of the new `Buffer`.
|
|
623
|
-
*/
|
|
624
|
-
allocUnsafeSlow(size: number): Buffer;
|
|
625
363
|
/**
|
|
626
364
|
* This is the size (in bytes) of pre-allocated internal `Buffer` instances used
|
|
627
365
|
* for pooling. This value may be modified.
|
|
@@ -629,7 +367,10 @@ declare module "buffer" {
|
|
|
629
367
|
*/
|
|
630
368
|
poolSize: number;
|
|
631
369
|
}
|
|
632
|
-
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
|
+
|
|
633
374
|
/**
|
|
634
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
|
|
635
376
|
* not contain enough space to fit the entire string, only part of `string` will be
|
|
@@ -866,100 +607,6 @@ declare module "buffer" {
|
|
|
866
607
|
* @return The number of bytes copied.
|
|
867
608
|
*/
|
|
868
609
|
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
869
|
-
/**
|
|
870
|
-
* Returns a new `Buffer` that references the same memory as the original, but
|
|
871
|
-
* offset and cropped by the `start` and `end` indices.
|
|
872
|
-
*
|
|
873
|
-
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
|
874
|
-
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
|
875
|
-
*
|
|
876
|
-
* ```js
|
|
877
|
-
* import { Buffer } from 'node:buffer';
|
|
878
|
-
*
|
|
879
|
-
* const buf = Buffer.from('buffer');
|
|
880
|
-
*
|
|
881
|
-
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
|
882
|
-
* copiedBuf[0]++;
|
|
883
|
-
* console.log(copiedBuf.toString());
|
|
884
|
-
* // Prints: cuffer
|
|
885
|
-
*
|
|
886
|
-
* console.log(buf.toString());
|
|
887
|
-
* // Prints: buffer
|
|
888
|
-
*
|
|
889
|
-
* // With buf.slice(), the original buffer is modified.
|
|
890
|
-
* const notReallyCopiedBuf = buf.slice();
|
|
891
|
-
* notReallyCopiedBuf[0]++;
|
|
892
|
-
* console.log(notReallyCopiedBuf.toString());
|
|
893
|
-
* // Prints: cuffer
|
|
894
|
-
* console.log(buf.toString());
|
|
895
|
-
* // Also prints: cuffer (!)
|
|
896
|
-
* ```
|
|
897
|
-
* @since v0.3.0
|
|
898
|
-
* @deprecated Use `subarray` instead.
|
|
899
|
-
* @param [start=0] Where the new `Buffer` will start.
|
|
900
|
-
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
901
|
-
*/
|
|
902
|
-
slice(start?: number, end?: number): Buffer;
|
|
903
|
-
/**
|
|
904
|
-
* Returns a new `Buffer` that references the same memory as the original, but
|
|
905
|
-
* offset and cropped by the `start` and `end` indices.
|
|
906
|
-
*
|
|
907
|
-
* Specifying `end` greater than `buf.length` will return the same result as
|
|
908
|
-
* that of `end` equal to `buf.length`.
|
|
909
|
-
*
|
|
910
|
-
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
|
911
|
-
*
|
|
912
|
-
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
|
913
|
-
*
|
|
914
|
-
* ```js
|
|
915
|
-
* import { Buffer } from 'node:buffer';
|
|
916
|
-
*
|
|
917
|
-
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
|
918
|
-
* // from the original `Buffer`.
|
|
919
|
-
*
|
|
920
|
-
* const buf1 = Buffer.allocUnsafe(26);
|
|
921
|
-
*
|
|
922
|
-
* for (let i = 0; i < 26; i++) {
|
|
923
|
-
* // 97 is the decimal ASCII value for 'a'.
|
|
924
|
-
* buf1[i] = i + 97;
|
|
925
|
-
* }
|
|
926
|
-
*
|
|
927
|
-
* const buf2 = buf1.subarray(0, 3);
|
|
928
|
-
*
|
|
929
|
-
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
930
|
-
* // Prints: abc
|
|
931
|
-
*
|
|
932
|
-
* buf1[0] = 33;
|
|
933
|
-
*
|
|
934
|
-
* console.log(buf2.toString('ascii', 0, buf2.length));
|
|
935
|
-
* // Prints: !bc
|
|
936
|
-
* ```
|
|
937
|
-
*
|
|
938
|
-
* Specifying negative indexes causes the slice to be generated relative to the
|
|
939
|
-
* end of `buf` rather than the beginning.
|
|
940
|
-
*
|
|
941
|
-
* ```js
|
|
942
|
-
* import { Buffer } from 'node:buffer';
|
|
943
|
-
*
|
|
944
|
-
* const buf = Buffer.from('buffer');
|
|
945
|
-
*
|
|
946
|
-
* console.log(buf.subarray(-6, -1).toString());
|
|
947
|
-
* // Prints: buffe
|
|
948
|
-
* // (Equivalent to buf.subarray(0, 5).)
|
|
949
|
-
*
|
|
950
|
-
* console.log(buf.subarray(-6, -2).toString());
|
|
951
|
-
* // Prints: buff
|
|
952
|
-
* // (Equivalent to buf.subarray(0, 4).)
|
|
953
|
-
*
|
|
954
|
-
* console.log(buf.subarray(-5, -2).toString());
|
|
955
|
-
* // Prints: uff
|
|
956
|
-
* // (Equivalent to buf.subarray(1, 4).)
|
|
957
|
-
* ```
|
|
958
|
-
* @since v3.0.0
|
|
959
|
-
* @param [start=0] Where the new `Buffer` will start.
|
|
960
|
-
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
|
961
|
-
*/
|
|
962
|
-
subarray(start?: number, end?: number): Buffer;
|
|
963
610
|
/**
|
|
964
611
|
* Writes `value` to `buf` at the specified `offset` as big-endian.
|
|
965
612
|
*
|
|
@@ -1617,7 +1264,7 @@ declare module "buffer" {
|
|
|
1617
1264
|
* @since v5.10.0
|
|
1618
1265
|
* @return A reference to `buf`.
|
|
1619
1266
|
*/
|
|
1620
|
-
swap16():
|
|
1267
|
+
swap16(): this;
|
|
1621
1268
|
/**
|
|
1622
1269
|
* Interprets `buf` as an array of unsigned 32-bit integers and swaps the
|
|
1623
1270
|
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
|
|
@@ -1643,7 +1290,7 @@ declare module "buffer" {
|
|
|
1643
1290
|
* @since v5.10.0
|
|
1644
1291
|
* @return A reference to `buf`.
|
|
1645
1292
|
*/
|
|
1646
|
-
swap32():
|
|
1293
|
+
swap32(): this;
|
|
1647
1294
|
/**
|
|
1648
1295
|
* Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
|
|
1649
1296
|
* Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
|
|
@@ -1669,7 +1316,7 @@ declare module "buffer" {
|
|
|
1669
1316
|
* @since v6.3.0
|
|
1670
1317
|
* @return A reference to `buf`.
|
|
1671
1318
|
*/
|
|
1672
|
-
swap64():
|
|
1319
|
+
swap64(): this;
|
|
1673
1320
|
/**
|
|
1674
1321
|
* Writes `value` to `buf` at the specified `offset`. `value` must be a
|
|
1675
1322
|
* valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
|
|
@@ -2264,17 +1911,22 @@ declare module "buffer" {
|
|
|
2264
1911
|
* @param data An ASCII (Latin1) string.
|
|
2265
1912
|
*/
|
|
2266
1913
|
function btoa(data: string): string;
|
|
2267
|
-
interface Blob extends
|
|
1914
|
+
interface Blob extends _Blob {}
|
|
2268
1915
|
/**
|
|
2269
|
-
* `Blob` class is a global reference for `
|
|
1916
|
+
* `Blob` class is a global reference for `import { Blob } from 'node:node:buffer'`
|
|
2270
1917
|
* https://nodejs.org/api/buffer.html#class-blob
|
|
2271
1918
|
* @since v18.0.0
|
|
2272
1919
|
*/
|
|
2273
|
-
var Blob: typeof globalThis extends {
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
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;
|
|
2278
1930
|
}
|
|
2279
1931
|
}
|
|
2280
1932
|
declare module "node:buffer" {
|