@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.1-alpha.0

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.
Files changed (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -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.
@@ -41,7 +46,7 @@
41
46
  * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
42
47
  * const buf7 = Buffer.from('tést', 'latin1');
43
48
  * ```
44
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js)
49
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js)
45
50
  */
46
51
  declare module "buffer" {
47
52
  import { BinaryLike } from "node:crypto";
@@ -54,7 +59,7 @@ declare module "buffer" {
54
59
  * @since v19.4.0, v18.14.0
55
60
  * @param input The input to validate.
56
61
  */
57
- export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
62
+ export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean;
58
63
  /**
59
64
  * This function returns `true` if `input` contains only valid ASCII-encoded data,
60
65
  * including the case in which `input` is empty.
@@ -63,8 +68,8 @@ declare module "buffer" {
63
68
  * @since v19.6.0, v18.15.0
64
69
  * @param input The input to validate.
65
70
  */
66
- export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
67
- export const INSPECT_MAX_BYTES: number;
71
+ export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean;
72
+ export let INSPECT_MAX_BYTES: number;
68
73
  export const kMaxLength: number;
69
74
  export const kStringMaxLength: number;
70
75
  export const constants: {
@@ -88,7 +93,7 @@ declare module "buffer" {
88
93
  * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
89
94
  * conversion from `fromEnc` to `toEnc` is not permitted.
90
95
  *
91
- * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
96
+ * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
92
97
  *
93
98
  * The transcoding process will use substitution characters if a given byte
94
99
  * sequence cannot be adequately represented in the target encoding. For instance:
@@ -108,29 +113,28 @@ declare module "buffer" {
108
113
  * @param fromEnc The current encoding.
109
114
  * @param toEnc To target encoding.
110
115
  */
111
- export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
112
- export const SlowBuffer: {
113
- /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
114
- new(size: number): Buffer;
115
- prototype: Buffer;
116
- };
116
+ export function transcode(
117
+ source: Uint8Array,
118
+ fromEnc: TranscodeEncoding,
119
+ toEnc: TranscodeEncoding,
120
+ ): NonSharedBuffer;
117
121
  /**
118
122
  * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
119
123
  * a prior call to `URL.createObjectURL()`.
120
124
  * @since v16.7.0
121
- * @experimental
122
125
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
123
126
  */
124
127
  export function resolveObjectURL(id: string): Blob | undefined;
125
- export { Buffer };
128
+ export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
126
129
  /**
127
130
  * @experimental
128
131
  */
129
132
  export interface BlobOptions {
130
133
  /**
131
- * @default 'utf8'
134
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
135
+ * will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
132
136
  */
133
- encoding?: BufferEncoding | undefined;
137
+ endings?: "transparent" | "native";
134
138
  /**
135
139
  * The Blob content-type. The intent is for `type` to convey
136
140
  * the MIME media type of the data, however no validation of the type format
@@ -139,7 +143,7 @@ declare module "buffer" {
139
143
  type?: string | undefined;
140
144
  }
141
145
  /**
142
- * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
146
+ * A `Blob` encapsulates immutable, raw data that can be safely shared across
143
147
  * multiple worker threads.
144
148
  * @since v15.7.0, v14.18.0
145
149
  */
@@ -162,13 +166,24 @@ declare module "buffer" {
162
166
  *
163
167
  * String sources are also copied into the `Blob`.
164
168
  */
165
- constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions);
169
+ constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
166
170
  /**
167
171
  * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
168
172
  * the `Blob` data.
169
173
  * @since v15.7.0, v14.18.0
170
174
  */
171
175
  arrayBuffer(): Promise<ArrayBuffer>;
176
+ /**
177
+ * The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
178
+ *
179
+ * ```js
180
+ * const blob = new Blob(['hello']);
181
+ * blob.bytes().then((bytes) => {
182
+ * console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
183
+ * });
184
+ * ```
185
+ */
186
+ bytes(): Promise<Uint8Array>;
172
187
  /**
173
188
  * Creates and returns a new `Blob` containing a subset of this `Blob` objects
174
189
  * data. The original `Blob` is not altered.
@@ -193,7 +208,7 @@ declare module "buffer" {
193
208
  export interface FileOptions {
194
209
  /**
195
210
  * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
196
- * converted to the platform native line-ending as specified by `require('node:os').EOL`.
211
+ * converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
197
212
  */
198
213
  endings?: "native" | "transparent";
199
214
  /** The File content-type. */
@@ -220,10 +235,10 @@ declare module "buffer" {
220
235
  }
221
236
  export import atob = globalThis.atob;
222
237
  export import btoa = globalThis.btoa;
223
- import { Blob as NodeBlob } from "buffer";
224
- // This conditional type will be the existing global Blob in a browser, or
225
- // the copy below in a Node environment.
226
- type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
238
+ export type WithImplicitCoercion<T> =
239
+ | T
240
+ | { valueOf(): T }
241
+ | (T extends string ? { [Symbol.toPrimitive](hint: "string"): T } : never);
227
242
  global {
228
243
  namespace NodeJS {
229
244
  export { BufferEncoding };
@@ -242,111 +257,15 @@ declare module "buffer" {
242
257
  | "latin1"
243
258
  | "binary"
244
259
  | "hex";
245
- type WithImplicitCoercion<T> =
246
- | T
247
- | {
248
- valueOf(): T;
249
- };
250
260
  /**
251
261
  * Raw data is stored in instances of the Buffer class.
252
262
  * 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.
253
263
  * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
254
264
  */
255
265
  interface BufferConstructor {
256
- /**
257
- * Allocates a new buffer containing the given {str}.
258
- *
259
- * @param str String to store in buffer.
260
- * @param encoding encoding to use, optional. Default is 'utf8'
261
- * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
262
- */
263
- new(str: string, encoding?: BufferEncoding): Buffer;
264
- /**
265
- * Allocates a new buffer of {size} octets.
266
- *
267
- * @param size count of octets to allocate.
268
- * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
269
- */
270
- new(size: number): Buffer;
271
- /**
272
- * Allocates a new buffer containing the given {array} of octets.
273
- *
274
- * @param array The octets to store.
275
- * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
276
- */
277
- new(array: Uint8Array): Buffer;
278
- /**
279
- * Produces a Buffer backed by the same allocated memory as
280
- * the given {ArrayBuffer}/{SharedArrayBuffer}.
281
- *
282
- * @param arrayBuffer The ArrayBuffer with which to share memory.
283
- * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
284
- */
285
- new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
286
- /**
287
- * Allocates a new buffer containing the given {array} of octets.
288
- *
289
- * @param array The octets to store.
290
- * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
291
- */
292
- new(array: readonly any[]): Buffer;
293
- /**
294
- * Copies the passed {buffer} data onto a new {Buffer} instance.
295
- *
296
- * @param buffer The buffer to copy.
297
- * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
298
- */
299
- new(buffer: Buffer): Buffer;
300
- /**
301
- * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
302
- * Array entries outside that range will be truncated to fit into it.
303
- *
304
- * ```js
305
- * import { Buffer } from 'node:buffer';
306
- *
307
- * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
308
- * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
309
- * ```
310
- *
311
- * If `array` is an `Array`\-like object (that is, one with a `length` property of
312
- * type `number`), it is treated as if it is an array, unless it is a `Buffer` or
313
- * 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()`.
314
- *
315
- * A `TypeError` will be thrown if `array` is not an `Array` or another type
316
- * appropriate for `Buffer.from()` variants.
317
- *
318
- * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
319
- * @since v5.10.0
320
- */
321
- from(
322
- arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
323
- byteOffset?: number,
324
- length?: number,
325
- ): Buffer;
326
- /**
327
- * Creates a new Buffer using the passed {data}
328
- * @param data data to create a new Buffer
329
- */
330
- from(data: Uint8Array | readonly number[]): Buffer;
331
- from(data: WithImplicitCoercion<Uint8Array | readonly number[] | string>): Buffer;
332
- /**
333
- * Creates a new Buffer containing the given JavaScript string {str}.
334
- * If provided, the {encoding} parameter identifies the character encoding.
335
- * If not provided, {encoding} defaults to 'utf8'.
336
- */
337
- from(
338
- str:
339
- | WithImplicitCoercion<string>
340
- | {
341
- [Symbol.toPrimitive](hint: "string"): string;
342
- },
343
- encoding?: BufferEncoding,
344
- ): Buffer;
345
- /**
346
- * Creates a new Buffer using the passed {data}
347
- * @param values to create a new Buffer
348
- */
349
- of(...items: number[]): Buffer;
266
+ // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
267
+ // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
268
+
350
269
  /**
351
270
  * Returns `true` if `obj` is a `Buffer`, `false` otherwise.
352
271
  *
@@ -415,67 +334,11 @@ declare module "buffer" {
415
334
  * @return The number of bytes contained within `string`.
416
335
  */
417
336
  byteLength(
418
- string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
337
+ string: string | NodeJS.ArrayBufferView | ArrayBufferLike,
419
338
  encoding?: BufferEncoding,
420
339
  ): number;
421
340
  /**
422
- * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
423
- *
424
- * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
425
- *
426
- * If `totalLength` is not provided, it is calculated from the `Buffer` instances
427
- * in `list` by adding their lengths.
428
- *
429
- * If `totalLength` is provided, it is coerced to an unsigned integer. If the
430
- * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
431
- * truncated to `totalLength`.
432
- *
433
- * ```js
434
- * import { Buffer } from 'node:buffer';
435
- *
436
- * // Create a single `Buffer` from a list of three `Buffer` instances.
437
- *
438
- * const buf1 = Buffer.alloc(10);
439
- * const buf2 = Buffer.alloc(14);
440
- * const buf3 = Buffer.alloc(18);
441
- * const totalLength = buf1.length + buf2.length + buf3.length;
442
- *
443
- * console.log(totalLength);
444
- * // Prints: 42
445
- *
446
- * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
447
- *
448
- * console.log(bufA);
449
- * // Prints: <Buffer 00 00 00 00 ...>
450
- * console.log(bufA.length);
451
- * // Prints: 42
452
- * ```
453
- *
454
- * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
455
- * @since v0.7.11
456
- * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
457
- * @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
458
- */
459
- concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
460
- /**
461
- * Copies the underlying memory of `view` into a new `Buffer`.
462
- *
463
- * ```js
464
- * const u16 = new Uint16Array([0, 0xffff]);
465
- * const buf = Buffer.copyBytesFrom(u16, 1, 1);
466
- * u16[1] = 0;
467
- * console.log(buf.length); // 2
468
- * console.log(buf[0]); // 255
469
- * console.log(buf[1]); // 255
470
- * ```
471
- * @since v19.8.0
472
- * @param view The {TypedArray} to copy.
473
- * @param [offset=': 0'] The starting offset within `view`.
474
- * @param [length=view.length - offset] The number of elements from `view` to copy.
475
- */
476
- copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
477
- /**
478
- * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
341
+ * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
479
342
  *
480
343
  * ```js
481
344
  * import { Buffer } from 'node:buffer';
@@ -492,135 +355,6 @@ declare module "buffer" {
492
355
  * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
493
356
  */
494
357
  compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
495
- /**
496
- * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
497
- *
498
- * ```js
499
- * import { Buffer } from 'node:buffer';
500
- *
501
- * const buf = Buffer.alloc(5);
502
- *
503
- * console.log(buf);
504
- * // Prints: <Buffer 00 00 00 00 00>
505
- * ```
506
- *
507
- * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
508
- *
509
- * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
510
- *
511
- * ```js
512
- * import { Buffer } from 'node:buffer';
513
- *
514
- * const buf = Buffer.alloc(5, 'a');
515
- *
516
- * console.log(buf);
517
- * // Prints: <Buffer 61 61 61 61 61>
518
- * ```
519
- *
520
- * If both `fill` and `encoding` are specified, the allocated `Buffer` will be
521
- * initialized by calling `buf.fill(fill, encoding)`.
522
- *
523
- * ```js
524
- * import { Buffer } from 'node:buffer';
525
- *
526
- * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
527
- *
528
- * console.log(buf);
529
- * // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
530
- * ```
531
- *
532
- * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
533
- * contents will never contain sensitive data from previous allocations, including
534
- * data that might not have been allocated for `Buffer`s.
535
- *
536
- * A `TypeError` will be thrown if `size` is not a number.
537
- * @since v5.10.0
538
- * @param size The desired length of the new `Buffer`.
539
- * @param [fill=0] A value to pre-fill the new `Buffer` with.
540
- * @param [encoding='utf8'] If `fill` is a string, this is its encoding.
541
- */
542
- alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
543
- /**
544
- * 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.
545
- *
546
- * The underlying memory for `Buffer` instances created in this way is _not_
547
- * _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.
548
- *
549
- * ```js
550
- * import { Buffer } from 'node:buffer';
551
- *
552
- * const buf = Buffer.allocUnsafe(10);
553
- *
554
- * console.log(buf);
555
- * // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
556
- *
557
- * buf.fill(0);
558
- *
559
- * console.log(buf);
560
- * // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
561
- * ```
562
- *
563
- * A `TypeError` will be thrown if `size` is not a number.
564
- *
565
- * The `Buffer` module pre-allocates an internal `Buffer` instance of
566
- * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
567
- * and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two).
568
- *
569
- * Use of this pre-allocated internal memory pool is a key difference between
570
- * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
571
- * 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
572
- * than or equal to half `Buffer.poolSize`. The
573
- * difference is subtle but can be important when an application requires the
574
- * additional performance that `Buffer.allocUnsafe()` provides.
575
- * @since v5.10.0
576
- * @param size The desired length of the new `Buffer`.
577
- */
578
- allocUnsafe(size: number): Buffer;
579
- /**
580
- * 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
581
- * `size` is 0.
582
- *
583
- * The underlying memory for `Buffer` instances created in this way is _not_
584
- * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
585
- * such `Buffer` instances with zeroes.
586
- *
587
- * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
588
- * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
589
- * allows applications to avoid the garbage collection overhead of creating many
590
- * individually allocated `Buffer` instances. This approach improves both
591
- * performance and memory usage by eliminating the need to track and clean up as
592
- * many individual `ArrayBuffer` objects.
593
- *
594
- * However, in the case where a developer may need to retain a small chunk of
595
- * memory from a pool for an indeterminate amount of time, it may be appropriate
596
- * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
597
- * then copying out the relevant bits.
598
- *
599
- * ```js
600
- * import { Buffer } from 'node:buffer';
601
- *
602
- * // Need to keep around a few small chunks of memory.
603
- * const store = [];
604
- *
605
- * socket.on('readable', () => {
606
- * let data;
607
- * while (null !== (data = readable.read())) {
608
- * // Allocate for retained data.
609
- * const sb = Buffer.allocUnsafeSlow(10);
610
- *
611
- * // Copy the data into the new allocation.
612
- * data.copy(sb, 0, 0, 10);
613
- *
614
- * store.push(sb);
615
- * }
616
- * });
617
- * ```
618
- *
619
- * A `TypeError` will be thrown if `size` is not a number.
620
- * @since v5.12.0
621
- * @param size The desired length of the new `Buffer`.
622
- */
623
- allocUnsafeSlow(size: number): Buffer;
624
358
  /**
625
359
  * This is the size (in bytes) of pre-allocated internal `Buffer` instances used
626
360
  * for pooling. This value may be modified.
@@ -628,7 +362,10 @@ declare module "buffer" {
628
362
  */
629
363
  poolSize: number;
630
364
  }
631
- interface Buffer extends Uint8Array {
365
+ interface Buffer {
366
+ // see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
367
+ // see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
368
+
632
369
  /**
633
370
  * 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
634
371
  * not contain enough space to fit the entire string, only part of `string` will be
@@ -780,7 +517,7 @@ declare module "buffer" {
780
517
  * // (This result is equal to: [buf1, buf3, buf2].)
781
518
  * ```
782
519
  *
783
- * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
520
+ * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively.
784
521
  *
785
522
  * ```js
786
523
  * import { Buffer } from 'node:buffer';
@@ -796,7 +533,7 @@ declare module "buffer" {
796
533
  * // Prints: 1
797
534
  * ```
798
535
  *
799
- * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
536
+ * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
800
537
  * @since v0.11.13
801
538
  * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
802
539
  * @param [targetStart=0] The offset within `target` at which to begin comparison.
@@ -865,100 +602,6 @@ declare module "buffer" {
865
602
  * @return The number of bytes copied.
866
603
  */
867
604
  copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
868
- /**
869
- * Returns a new `Buffer` that references the same memory as the original, but
870
- * offset and cropped by the `start` and `end` indices.
871
- *
872
- * This method is not compatible with the `Uint8Array.prototype.slice()`,
873
- * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
874
- *
875
- * ```js
876
- * import { Buffer } from 'node:buffer';
877
- *
878
- * const buf = Buffer.from('buffer');
879
- *
880
- * const copiedBuf = Uint8Array.prototype.slice.call(buf);
881
- * copiedBuf[0]++;
882
- * console.log(copiedBuf.toString());
883
- * // Prints: cuffer
884
- *
885
- * console.log(buf.toString());
886
- * // Prints: buffer
887
- *
888
- * // With buf.slice(), the original buffer is modified.
889
- * const notReallyCopiedBuf = buf.slice();
890
- * notReallyCopiedBuf[0]++;
891
- * console.log(notReallyCopiedBuf.toString());
892
- * // Prints: cuffer
893
- * console.log(buf.toString());
894
- * // Also prints: cuffer (!)
895
- * ```
896
- * @since v0.3.0
897
- * @deprecated Use `subarray` instead.
898
- * @param [start=0] Where the new `Buffer` will start.
899
- * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
900
- */
901
- slice(start?: number, end?: number): Buffer;
902
- /**
903
- * Returns a new `Buffer` that references the same memory as the original, but
904
- * offset and cropped by the `start` and `end` indices.
905
- *
906
- * Specifying `end` greater than `buf.length` will return the same result as
907
- * that of `end` equal to `buf.length`.
908
- *
909
- * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
910
- *
911
- * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
912
- *
913
- * ```js
914
- * import { Buffer } from 'node:buffer';
915
- *
916
- * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
917
- * // from the original `Buffer`.
918
- *
919
- * const buf1 = Buffer.allocUnsafe(26);
920
- *
921
- * for (let i = 0; i < 26; i++) {
922
- * // 97 is the decimal ASCII value for 'a'.
923
- * buf1[i] = i + 97;
924
- * }
925
- *
926
- * const buf2 = buf1.subarray(0, 3);
927
- *
928
- * console.log(buf2.toString('ascii', 0, buf2.length));
929
- * // Prints: abc
930
- *
931
- * buf1[0] = 33;
932
- *
933
- * console.log(buf2.toString('ascii', 0, buf2.length));
934
- * // Prints: !bc
935
- * ```
936
- *
937
- * Specifying negative indexes causes the slice to be generated relative to the
938
- * end of `buf` rather than the beginning.
939
- *
940
- * ```js
941
- * import { Buffer } from 'node:buffer';
942
- *
943
- * const buf = Buffer.from('buffer');
944
- *
945
- * console.log(buf.subarray(-6, -1).toString());
946
- * // Prints: buffe
947
- * // (Equivalent to buf.subarray(0, 5).)
948
- *
949
- * console.log(buf.subarray(-6, -2).toString());
950
- * // Prints: buff
951
- * // (Equivalent to buf.subarray(0, 4).)
952
- *
953
- * console.log(buf.subarray(-5, -2).toString());
954
- * // Prints: uff
955
- * // (Equivalent to buf.subarray(1, 4).)
956
- * ```
957
- * @since v3.0.0
958
- * @param [start=0] Where the new `Buffer` will start.
959
- * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
960
- */
961
- subarray(start?: number, end?: number): Buffer;
962
605
  /**
963
606
  * Writes `value` to `buf` at the specified `offset` as big-endian.
964
607
  *
@@ -1214,7 +857,7 @@ declare module "buffer" {
1214
857
  */
1215
858
  readBigInt64LE(offset?: number): bigint;
1216
859
  /**
1217
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
860
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting
1218
861
  * up to 48 bits of accuracy.
1219
862
  *
1220
863
  * This function is also available under the `readUintLE` alias.
@@ -1238,7 +881,7 @@ declare module "buffer" {
1238
881
  */
1239
882
  readUintLE(offset: number, byteLength: number): number;
1240
883
  /**
1241
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
884
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting
1242
885
  * up to 48 bits of accuracy.
1243
886
  *
1244
887
  * This function is also available under the `readUintBE` alias.
@@ -1264,7 +907,7 @@ declare module "buffer" {
1264
907
  */
1265
908
  readUintBE(offset: number, byteLength: number): number;
1266
909
  /**
1267
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value
910
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value
1268
911
  * supporting up to 48 bits of accuracy.
1269
912
  *
1270
913
  * ```js
@@ -1281,7 +924,7 @@ declare module "buffer" {
1281
924
  */
1282
925
  readIntLE(offset: number, byteLength: number): number;
1283
926
  /**
1284
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value
927
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value
1285
928
  * supporting up to 48 bits of accuracy.
1286
929
  *
1287
930
  * ```js
@@ -1328,7 +971,7 @@ declare module "buffer" {
1328
971
  */
1329
972
  readUint8(offset?: number): number;
1330
973
  /**
1331
- * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
974
+ * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`.
1332
975
  *
1333
976
  * This function is also available under the `readUint16LE` alias.
1334
977
  *
@@ -1616,7 +1259,7 @@ declare module "buffer" {
1616
1259
  * @since v5.10.0
1617
1260
  * @return A reference to `buf`.
1618
1261
  */
1619
- swap16(): Buffer;
1262
+ swap16(): this;
1620
1263
  /**
1621
1264
  * Interprets `buf` as an array of unsigned 32-bit integers and swaps the
1622
1265
  * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
@@ -1642,7 +1285,7 @@ declare module "buffer" {
1642
1285
  * @since v5.10.0
1643
1286
  * @return A reference to `buf`.
1644
1287
  */
1645
- swap32(): Buffer;
1288
+ swap32(): this;
1646
1289
  /**
1647
1290
  * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
1648
1291
  * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
@@ -1668,7 +1311,7 @@ declare module "buffer" {
1668
1311
  * @since v6.3.0
1669
1312
  * @return A reference to `buf`.
1670
1313
  */
1671
- swap64(): Buffer;
1314
+ swap64(): this;
1672
1315
  /**
1673
1316
  * Writes `value` to `buf` at the specified `offset`. `value` must be a
1674
1317
  * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
@@ -1701,7 +1344,7 @@ declare module "buffer" {
1701
1344
  */
1702
1345
  writeUint8(value: number, offset?: number): number;
1703
1346
  /**
1704
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
1347
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
1705
1348
  * anything other than an unsigned 16-bit integer.
1706
1349
  *
1707
1350
  * This function is also available under the `writeUint16LE` alias.
@@ -1729,7 +1372,7 @@ declare module "buffer" {
1729
1372
  */
1730
1373
  writeUint16LE(value: number, offset?: number): number;
1731
1374
  /**
1732
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
1375
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
1733
1376
  * unsigned 16-bit integer.
1734
1377
  *
1735
1378
  * This function is also available under the `writeUint16BE` alias.
@@ -1757,7 +1400,7 @@ declare module "buffer" {
1757
1400
  */
1758
1401
  writeUint16BE(value: number, offset?: number): number;
1759
1402
  /**
1760
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
1403
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
1761
1404
  * anything other than an unsigned 32-bit integer.
1762
1405
  *
1763
1406
  * This function is also available under the `writeUint32LE` alias.
@@ -1784,7 +1427,7 @@ declare module "buffer" {
1784
1427
  */
1785
1428
  writeUint32LE(value: number, offset?: number): number;
1786
1429
  /**
1787
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
1430
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
1788
1431
  * unsigned 32-bit integer.
1789
1432
  *
1790
1433
  * This function is also available under the `writeUint32BE` alias.
@@ -1835,7 +1478,7 @@ declare module "buffer" {
1835
1478
  */
1836
1479
  writeInt8(value: number, offset?: number): number;
1837
1480
  /**
1838
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
1481
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
1839
1482
  * anything other than a signed 16-bit integer.
1840
1483
  *
1841
1484
  * The `value` is interpreted and written as a two's complement signed integer.
@@ -1857,7 +1500,7 @@ declare module "buffer" {
1857
1500
  */
1858
1501
  writeInt16LE(value: number, offset?: number): number;
1859
1502
  /**
1860
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
1503
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
1861
1504
  * anything other than a signed 16-bit integer.
1862
1505
  *
1863
1506
  * The `value` is interpreted and written as a two's complement signed integer.
@@ -1879,7 +1522,7 @@ declare module "buffer" {
1879
1522
  */
1880
1523
  writeInt16BE(value: number, offset?: number): number;
1881
1524
  /**
1882
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
1525
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
1883
1526
  * anything other than a signed 32-bit integer.
1884
1527
  *
1885
1528
  * The `value` is interpreted and written as a two's complement signed integer.
@@ -1901,7 +1544,7 @@ declare module "buffer" {
1901
1544
  */
1902
1545
  writeInt32LE(value: number, offset?: number): number;
1903
1546
  /**
1904
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
1547
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
1905
1548
  * anything other than a signed 32-bit integer.
1906
1549
  *
1907
1550
  * The `value` is interpreted and written as a two's complement signed integer.
@@ -1963,7 +1606,7 @@ declare module "buffer" {
1963
1606
  */
1964
1607
  writeFloatBE(value: number, offset?: number): number;
1965
1608
  /**
1966
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
1609
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
1967
1610
  * other than a JavaScript number.
1968
1611
  *
1969
1612
  * ```js
@@ -1983,7 +1626,7 @@ declare module "buffer" {
1983
1626
  */
1984
1627
  writeDoubleLE(value: number, offset?: number): number;
1985
1628
  /**
1986
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
1629
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
1987
1630
  * other than a JavaScript number.
1988
1631
  *
1989
1632
  * ```js
@@ -2062,10 +1705,12 @@ declare module "buffer" {
2062
1705
  * @return A reference to `buf`.
2063
1706
  */
2064
1707
  fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
1708
+ fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
1709
+ fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
2065
1710
  /**
2066
1711
  * If `value` is:
2067
1712
  *
2068
- * * a string, `value` is interpreted according to the character encoding in`encoding`.
1713
+ * * a string, `value` is interpreted according to the character encoding in `encoding`.
2069
1714
  * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
2070
1715
  * To compare a partial `Buffer`, use `buf.subarray`.
2071
1716
  * * a number, `value` will be interpreted as an unsigned 8-bit integer
@@ -2097,7 +1742,7 @@ declare module "buffer" {
2097
1742
  * // Prints: 6
2098
1743
  * ```
2099
1744
  *
2100
- * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
1745
+ * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
2101
1746
  * an integer between 0 and 255.
2102
1747
  *
2103
1748
  * If `byteOffset` is not a number, it will be coerced to a number. If the result
@@ -2131,6 +1776,7 @@ declare module "buffer" {
2131
1776
  * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
2132
1777
  */
2133
1778
  indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
1779
+ indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
2134
1780
  /**
2135
1781
  * Identical to `buf.indexOf()`, except the last occurrence of `value` is found
2136
1782
  * rather than the first occurrence.
@@ -2163,7 +1809,7 @@ declare module "buffer" {
2163
1809
  * // Prints: 4
2164
1810
  * ```
2165
1811
  *
2166
- * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
1812
+ * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
2167
1813
  * an integer between 0 and 255.
2168
1814
  *
2169
1815
  * If `byteOffset` is not a number, it will be coerced to a number. Any arguments
@@ -2199,31 +1845,7 @@ declare module "buffer" {
2199
1845
  * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
2200
1846
  */
2201
1847
  lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
2202
- /**
2203
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents
2204
- * of `buf`.
2205
- *
2206
- * ```js
2207
- * import { Buffer } from 'node:buffer';
2208
- *
2209
- * // Log the entire contents of a `Buffer`.
2210
- *
2211
- * const buf = Buffer.from('buffer');
2212
- *
2213
- * for (const pair of buf.entries()) {
2214
- * console.log(pair);
2215
- * }
2216
- * // Prints:
2217
- * // [0, 98]
2218
- * // [1, 117]
2219
- * // [2, 102]
2220
- * // [3, 102]
2221
- * // [4, 101]
2222
- * // [5, 114]
2223
- * ```
2224
- * @since v1.1.0
2225
- */
2226
- entries(): IterableIterator<[number, number]>;
1848
+ lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
2227
1849
  /**
2228
1850
  * Equivalent to `buf.indexOf() !== -1`.
2229
1851
  *
@@ -2254,62 +1876,7 @@ declare module "buffer" {
2254
1876
  * @return `true` if `value` was found in `buf`, `false` otherwise.
2255
1877
  */
2256
1878
  includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
2257
- /**
2258
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices).
2259
- *
2260
- * ```js
2261
- * import { Buffer } from 'node:buffer';
2262
- *
2263
- * const buf = Buffer.from('buffer');
2264
- *
2265
- * for (const key of buf.keys()) {
2266
- * console.log(key);
2267
- * }
2268
- * // Prints:
2269
- * // 0
2270
- * // 1
2271
- * // 2
2272
- * // 3
2273
- * // 4
2274
- * // 5
2275
- * ```
2276
- * @since v1.1.0
2277
- */
2278
- keys(): IterableIterator<number>;
2279
- /**
2280
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is
2281
- * called automatically when a `Buffer` is used in a `for..of` statement.
2282
- *
2283
- * ```js
2284
- * import { Buffer } from 'node:buffer';
2285
- *
2286
- * const buf = Buffer.from('buffer');
2287
- *
2288
- * for (const value of buf.values()) {
2289
- * console.log(value);
2290
- * }
2291
- * // Prints:
2292
- * // 98
2293
- * // 117
2294
- * // 102
2295
- * // 102
2296
- * // 101
2297
- * // 114
2298
- *
2299
- * for (const value of buf) {
2300
- * console.log(value);
2301
- * }
2302
- * // Prints:
2303
- * // 98
2304
- * // 117
2305
- * // 102
2306
- * // 102
2307
- * // 101
2308
- * // 114
2309
- * ```
2310
- * @since v1.1.0
2311
- */
2312
- values(): IterableIterator<number>;
1879
+ includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
2313
1880
  }
2314
1881
  var Buffer: BufferConstructor;
2315
1882
  /**
@@ -2322,7 +1889,7 @@ declare module "buffer" {
2322
1889
  * **and should never be used in new code, because they use strings to represent**
2323
1890
  * **binary data and predate the introduction of typed arrays in JavaScript.**
2324
1891
  * **For code running using Node.js APIs, converting between base64-encoded strings**
2325
- * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
1892
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
2326
1893
  * @since v15.13.0, v14.17.0
2327
1894
  * @legacy Use `Buffer.from(data, 'base64')` instead.
2328
1895
  * @param data The Base64-encoded input string.
@@ -2338,23 +1905,28 @@ declare module "buffer" {
2338
1905
  * **and should never be used in new code, because they use strings to represent**
2339
1906
  * **binary data and predate the introduction of typed arrays in JavaScript.**
2340
1907
  * **For code running using Node.js APIs, converting between base64-encoded strings**
2341
- * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
1908
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
2342
1909
  * @since v15.13.0, v14.17.0
2343
1910
  * @legacy Use `buf.toString('base64')` instead.
2344
1911
  * @param data An ASCII (Latin1) string.
2345
1912
  */
2346
1913
  function btoa(data: string): string;
2347
- interface Blob extends __Blob {}
1914
+ interface Blob extends _Blob {}
2348
1915
  /**
2349
- * `Blob` class is a global reference for `require('node:buffer').Blob`
1916
+ * `Blob` class is a global reference for `import { Blob } from 'node:buffer'`
2350
1917
  * https://nodejs.org/api/buffer.html#class-blob
2351
1918
  * @since v18.0.0
2352
1919
  */
2353
- var Blob: typeof globalThis extends {
2354
- onmessage: any;
2355
- Blob: infer T;
2356
- } ? T
2357
- : typeof NodeBlob;
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: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;
2358
1930
  }
2359
1931
  }
2360
1932
  declare module "node:buffer" {