aws-delivlib 14.15.34 → 14.15.35

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.
@@ -1,4 +1,6 @@
1
1
  declare module "buffer" {
2
+ type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
3
+ { valueOf(): infer V extends ArrayBufferLike } ? V : T;
2
4
  global {
3
5
  interface BufferConstructor {
4
6
  // see buffer.d.ts for implementation shared with all TypeScript versions
@@ -24,7 +26,7 @@ declare module "buffer" {
24
26
  * @param array The octets to store.
25
27
  * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
26
28
  */
27
- new(array: Uint8Array): Buffer<ArrayBuffer>;
29
+ new(array: ArrayLike<number>): Buffer<ArrayBuffer>;
28
30
  /**
29
31
  * Produces a Buffer backed by the same allocated memory as
30
32
  * the given {ArrayBuffer}/{SharedArrayBuffer}.
@@ -33,20 +35,6 @@ declare module "buffer" {
33
35
  * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
34
36
  */
35
37
  new<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(arrayBuffer: TArrayBuffer): Buffer<TArrayBuffer>;
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<ArrayBuffer>;
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<ArrayBuffer>;
50
38
  /**
51
39
  * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
52
40
  * Array entries outside that range will be truncated to fit into it.
@@ -58,40 +46,120 @@ declare module "buffer" {
58
46
  * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
59
47
  * ```
60
48
  *
61
- * If `array` is an `Array`\-like object (that is, one with a `length` property of
49
+ * If `array` is an `Array`-like object (that is, one with a `length` property of
62
50
  * 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()`.
51
+ * a `Uint8Array`. This means all other `TypedArray` variants get treated as an
52
+ * `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use
53
+ * `Buffer.copyBytesFrom()`.
64
54
  *
65
55
  * A `TypeError` will be thrown if `array` is not an `Array` or another type
66
56
  * appropriate for `Buffer.from()` variants.
67
57
  *
68
- * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
58
+ * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal
59
+ * `Buffer` pool like `Buffer.allocUnsafe()` does.
69
60
  * @since v5.10.0
70
61
  */
71
- from<TArrayBuffer extends ArrayBufferLike>(
72
- arrayBuffer: WithImplicitCoercion<TArrayBuffer>,
73
- byteOffset?: number,
74
- length?: number,
75
- ): Buffer<TArrayBuffer>;
62
+ from(array: WithImplicitCoercion<ArrayLike<number>>): Buffer<ArrayBuffer>;
76
63
  /**
77
- * Creates a new Buffer using the passed {data}
78
- * @param data data to create a new Buffer
64
+ * This creates a view of the `ArrayBuffer` without copying the underlying
65
+ * memory. For example, when passed a reference to the `.buffer` property of a
66
+ * `TypedArray` instance, the newly created `Buffer` will share the same
67
+ * allocated memory as the `TypedArray`'s underlying `ArrayBuffer`.
68
+ *
69
+ * ```js
70
+ * import { Buffer } from 'node:buffer';
71
+ *
72
+ * const arr = new Uint16Array(2);
73
+ *
74
+ * arr[0] = 5000;
75
+ * arr[1] = 4000;
76
+ *
77
+ * // Shares memory with `arr`.
78
+ * const buf = Buffer.from(arr.buffer);
79
+ *
80
+ * console.log(buf);
81
+ * // Prints: <Buffer 88 13 a0 0f>
82
+ *
83
+ * // Changing the original Uint16Array changes the Buffer also.
84
+ * arr[1] = 6000;
85
+ *
86
+ * console.log(buf);
87
+ * // Prints: <Buffer 88 13 70 17>
88
+ * ```
89
+ *
90
+ * The optional `byteOffset` and `length` arguments specify a memory range within
91
+ * the `arrayBuffer` that will be shared by the `Buffer`.
92
+ *
93
+ * ```js
94
+ * import { Buffer } from 'node:buffer';
95
+ *
96
+ * const ab = new ArrayBuffer(10);
97
+ * const buf = Buffer.from(ab, 0, 2);
98
+ *
99
+ * console.log(buf.length);
100
+ * // Prints: 2
101
+ * ```
102
+ *
103
+ * A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a
104
+ * `SharedArrayBuffer` or another type appropriate for `Buffer.from()`
105
+ * variants.
106
+ *
107
+ * It is important to remember that a backing `ArrayBuffer` can cover a range
108
+ * of memory that extends beyond the bounds of a `TypedArray` view. A new
109
+ * `Buffer` created using the `buffer` property of a `TypedArray` may extend
110
+ * beyond the range of the `TypedArray`:
111
+ *
112
+ * ```js
113
+ * import { Buffer } from 'node:buffer';
114
+ *
115
+ * const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements
116
+ * const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements
117
+ * console.log(arrA.buffer === arrB.buffer); // true
118
+ *
119
+ * const buf = Buffer.from(arrB.buffer);
120
+ * console.log(buf);
121
+ * // Prints: <Buffer 63 64 65 66>
122
+ * ```
123
+ * @since v5.10.0
124
+ * @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the
125
+ * `.buffer` property of a `TypedArray`.
126
+ * @param byteOffset Index of first byte to expose. **Default:** `0`.
127
+ * @param length Number of bytes to expose. **Default:**
128
+ * `arrayBuffer.byteLength - byteOffset`.
79
129
  */
80
- from(data: Uint8Array | readonly number[]): Buffer<ArrayBuffer>;
81
- from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer<ArrayBuffer>;
130
+ from<TArrayBuffer extends WithImplicitCoercion<ArrayBufferLike>>(
131
+ arrayBuffer: TArrayBuffer,
132
+ byteOffset?: number,
133
+ length?: number,
134
+ ): Buffer<ImplicitArrayBuffer<TArrayBuffer>>;
82
135
  /**
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'.
136
+ * Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
137
+ * the character encoding to be used when converting `string` into bytes.
138
+ *
139
+ * ```js
140
+ * import { Buffer } from 'node:buffer';
141
+ *
142
+ * const buf1 = Buffer.from('this is a tést');
143
+ * const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
144
+ *
145
+ * console.log(buf1.toString());
146
+ * // Prints: this is a tést
147
+ * console.log(buf2.toString());
148
+ * // Prints: this is a tést
149
+ * console.log(buf1.toString('latin1'));
150
+ * // Prints: this is a tést
151
+ * ```
152
+ *
153
+ * A `TypeError` will be thrown if `string` is not a string or another type
154
+ * appropriate for `Buffer.from()` variants.
155
+ *
156
+ * `Buffer.from(string)` may also use the internal `Buffer` pool like
157
+ * `Buffer.allocUnsafe()` does.
158
+ * @since v5.10.0
159
+ * @param string A string to encode.
160
+ * @param encoding The encoding of `string`. **Default:** `'utf8'`.
86
161
  */
87
- from(
88
- str:
89
- | WithImplicitCoercion<string>
90
- | {
91
- [Symbol.toPrimitive](hint: "string"): string;
92
- },
93
- encoding?: BufferEncoding,
94
- ): Buffer<ArrayBuffer>;
162
+ from(string: WithImplicitCoercion<string>, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
95
163
  /**
96
164
  * Creates a new Buffer using the passed {data}
97
165
  * @param values to create a new Buffer
@@ -383,4 +451,10 @@ declare module "buffer" {
383
451
  subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
384
452
  }
385
453
  }
454
+ /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
455
+ var SlowBuffer: {
456
+ /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
457
+ new(size: number): Buffer<ArrayBuffer>;
458
+ prototype: Buffer;
459
+ };
386
460
  }
@@ -114,11 +114,6 @@ declare module "buffer" {
114
114
  * @param toEnc To target encoding.
115
115
  */
116
116
  export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
117
- export const SlowBuffer: {
118
- /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
119
- new(size: number): Buffer;
120
- prototype: Buffer;
121
- };
122
117
  /**
123
118
  * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
124
119
  * a prior call to `URL.createObjectURL()`.
@@ -237,7 +232,10 @@ declare module "buffer" {
237
232
  }
238
233
  export import atob = globalThis.atob;
239
234
  export import btoa = globalThis.btoa;
240
-
235
+ export type WithImplicitCoercion<T> =
236
+ | T
237
+ | { valueOf(): T }
238
+ | (T extends string ? { [Symbol.toPrimitive](hint: "string"): T } : never);
241
239
  global {
242
240
  namespace NodeJS {
243
241
  export { BufferEncoding };
@@ -256,11 +254,6 @@ declare module "buffer" {
256
254
  | "latin1"
257
255
  | "binary"
258
256
  | "hex";
259
- type WithImplicitCoercion<T> =
260
- | T
261
- | {
262
- valueOf(): T;
263
- };
264
257
  /**
265
258
  * Raw data is stored in instances of the Buffer class.
266
259
  * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.13.5",
3
+ "version": "22.13.7",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.20.0"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "f50d94abf6b192ce8d4087c8e3714bfeea42915f01b0f6338f726e5286a67f3a",
218
+ "typesPublisherContentHash": "2a82522a8286b51734273b3e476927f8a6c664f51ebc143a52c4b99d2c9ff34d",
219
219
  "typeScriptVersion": "5.0"
220
220
  }