@idlebox/stripe-node-types 24.0.14-patch.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 (113) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +16 -0
  3. package/assert/strict.d.ts +5 -0
  4. package/assert.d.ts +1053 -0
  5. package/async_hooks.d.ts +621 -0
  6. package/buffer.buffer.d.ts +464 -0
  7. package/buffer.d.ts +1928 -0
  8. package/child_process.d.ts +1547 -0
  9. package/cluster.d.ts +576 -0
  10. package/compatibility/iterators.d.ts +22 -0
  11. package/console.d.ts +449 -0
  12. package/constants.d.ts +18 -0
  13. package/crypto.d.ts +4514 -0
  14. package/dgram.d.ts +597 -0
  15. package/diagnostics_channel.d.ts +576 -0
  16. package/dns/promises.d.ts +501 -0
  17. package/dns.d.ts +916 -0
  18. package/dom-events.d.ts +100 -0
  19. package/domain.d.ts +168 -0
  20. package/events.d.ts +927 -0
  21. package/fs/promises.d.ts +1278 -0
  22. package/fs.d.ts +4444 -0
  23. package/globals.d.ts +368 -0
  24. package/globals.typedarray.d.ts +23 -0
  25. package/http.d.ts +2044 -0
  26. package/http2.d.ts +2626 -0
  27. package/https.d.ts +543 -0
  28. package/index.d.ts +96 -0
  29. package/inspector.d.ts +3993 -0
  30. package/module.d.ts +866 -0
  31. package/my-shim.d.ts +57 -0
  32. package/net.d.ts +1030 -0
  33. package/os.d.ts +494 -0
  34. package/package.json +158 -0
  35. package/path.d.ts +189 -0
  36. package/perf_hooks.d.ts +968 -0
  37. package/process.d.ts +2016 -0
  38. package/punycode.d.ts +115 -0
  39. package/querystring.d.ts +150 -0
  40. package/readline/promises.d.ts +159 -0
  41. package/readline.d.ts +592 -0
  42. package/repl.d.ts +426 -0
  43. package/sea.d.ts +154 -0
  44. package/sqlite.d.ts +689 -0
  45. package/stream/consumers.d.ts +36 -0
  46. package/stream/promises.d.ts +88 -0
  47. package/stream/web.d.ts +616 -0
  48. package/stream.d.ts +1654 -0
  49. package/string_decoder.d.ts +65 -0
  50. package/test.d.ts +2216 -0
  51. package/timers/promises.d.ts +106 -0
  52. package/timers.d.ts +285 -0
  53. package/tls.d.ts +1211 -0
  54. package/trace_events.d.ts +195 -0
  55. package/ts5.1/compatibility/disposable.d.ts +13 -0
  56. package/ts5.1/index.d.ts +100 -0
  57. package/ts5.6/buffer.buffer.d.ts +461 -0
  58. package/ts5.6/compatibility/float16array.d.ts +72 -0
  59. package/ts5.6/globals.typedarray.d.ts +21 -0
  60. package/ts5.6/index.d.ts +98 -0
  61. package/ts5.7/compatibility/float16array.d.ts +73 -0
  62. package/ts5.7/index.d.ts +98 -0
  63. package/tty.d.ts +206 -0
  64. package/undici-types/LICENSE +22 -0
  65. package/undici-types/README.md +7 -0
  66. package/undici-types/agent.d.ts +32 -0
  67. package/undici-types/api.d.ts +44 -0
  68. package/undici-types/balanced-pool.d.ts +30 -0
  69. package/undici-types/cache-interceptor.d.ts +173 -0
  70. package/undici-types/cache.d.ts +37 -0
  71. package/undici-types/client.d.ts +108 -0
  72. package/undici-types/connector.d.ts +35 -0
  73. package/undici-types/content-type.d.ts +22 -0
  74. package/undici-types/cookies.d.ts +31 -0
  75. package/undici-types/diagnostics-channel.d.ts +67 -0
  76. package/undici-types/dispatcher.d.ts +282 -0
  77. package/undici-types/env-http-proxy-agent.d.ts +22 -0
  78. package/undici-types/errors.d.ts +172 -0
  79. package/undici-types/eventsource.d.ts +62 -0
  80. package/undici-types/fetch.d.ts +211 -0
  81. package/undici-types/formdata.d.ts +109 -0
  82. package/undici-types/global-dispatcher.d.ts +10 -0
  83. package/undici-types/global-origin.d.ts +8 -0
  84. package/undici-types/h2c-client.d.ts +76 -0
  85. package/undici-types/handlers.d.ts +16 -0
  86. package/undici-types/header.d.ts +161 -0
  87. package/undici-types/index.d.ts +76 -0
  88. package/undici-types/interceptors.d.ts +35 -0
  89. package/undici-types/mock-agent.d.ts +66 -0
  90. package/undici-types/mock-call-history.d.ts +112 -0
  91. package/undici-types/mock-client.d.ts +26 -0
  92. package/undici-types/mock-errors.d.ts +13 -0
  93. package/undici-types/mock-interceptor.d.ts +94 -0
  94. package/undici-types/mock-pool.d.ts +26 -0
  95. package/undici-types/package.json +55 -0
  96. package/undici-types/patch.d.ts +30 -0
  97. package/undici-types/pool-stats.d.ts +20 -0
  98. package/undici-types/pool.d.ts +40 -0
  99. package/undici-types/proxy-agent.d.ts +29 -0
  100. package/undici-types/readable.d.ts +69 -0
  101. package/undici-types/retry-agent.d.ts +9 -0
  102. package/undici-types/retry-handler.d.ts +117 -0
  103. package/undici-types/util.d.ts +19 -0
  104. package/undici-types/utility.d.ts +8 -0
  105. package/undici-types/webidl.d.ts +267 -0
  106. package/undici-types/websocket.d.ts +185 -0
  107. package/url.d.ts +1012 -0
  108. package/util.d.ts +2300 -0
  109. package/v8.d.ts +917 -0
  110. package/vm.d.ts +1034 -0
  111. package/wasi.d.ts +179 -0
  112. package/worker_threads.d.ts +773 -0
  113. package/zlib.d.ts +666 -0
@@ -0,0 +1,464 @@
1
+
2
+ declare module "node:buffer" {
3
+ type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
4
+ { valueOf(): infer V extends ArrayBufferLike } ? V : T;
5
+ global {
6
+ interface BufferConstructor {
7
+ // see buffer.d.ts for implementation shared with all TypeScript versions
8
+
9
+ /**
10
+ * Allocates a new buffer containing the given {str}.
11
+ *
12
+ * @param str String to store in buffer.
13
+ * @param encoding encoding to use, optional. Default is 'utf8'
14
+ * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
15
+ */
16
+ new(str: string, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
17
+ /**
18
+ * Allocates a new buffer of {size} octets.
19
+ *
20
+ * @param size count of octets to allocate.
21
+ * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
22
+ */
23
+ new(size: number): Buffer<ArrayBuffer>;
24
+ /**
25
+ * Allocates a new buffer containing the given {array} of octets.
26
+ *
27
+ * @param array The octets to store.
28
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
29
+ */
30
+ new(array: ArrayLike<number>): Buffer<ArrayBuffer>;
31
+ /**
32
+ * Produces a Buffer backed by the same allocated memory as
33
+ * the given {ArrayBuffer}/{SharedArrayBuffer}.
34
+ *
35
+ * @param arrayBuffer The ArrayBuffer with which to share memory.
36
+ * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
37
+ */
38
+ new<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(arrayBuffer: TArrayBuffer): Buffer<TArrayBuffer>;
39
+ /**
40
+ * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
41
+ * Array entries outside that range will be truncated to fit into it.
42
+ *
43
+ * ```js
44
+ * import { Buffer } from 'node:buffer';
45
+ *
46
+ * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
47
+ * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
48
+ * ```
49
+ *
50
+ * If `array` is an `Array`-like object (that is, one with a `length` property of
51
+ * type `number`), it is treated as if it is an array, unless it is a `Buffer` or
52
+ * a `Uint8Array`. This means all other `TypedArray` variants get treated as an
53
+ * `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use
54
+ * `Buffer.copyBytesFrom()`.
55
+ *
56
+ * A `TypeError` will be thrown if `array` is not an `Array` or another type
57
+ * appropriate for `Buffer.from()` variants.
58
+ *
59
+ * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal
60
+ * `Buffer` pool like `Buffer.allocUnsafe()` does.
61
+ * @since v5.10.0
62
+ */
63
+ from(array: WithImplicitCoercion<ArrayLike<number>>): Buffer<ArrayBuffer>;
64
+ /**
65
+ * This creates a view of the `ArrayBuffer` without copying the underlying
66
+ * memory. For example, when passed a reference to the `.buffer` property of a
67
+ * `TypedArray` instance, the newly created `Buffer` will share the same
68
+ * allocated memory as the `TypedArray`'s underlying `ArrayBuffer`.
69
+ *
70
+ * ```js
71
+ * import { Buffer } from 'node:buffer';
72
+ *
73
+ * const arr = new Uint16Array(2);
74
+ *
75
+ * arr[0] = 5000;
76
+ * arr[1] = 4000;
77
+ *
78
+ * // Shares memory with `arr`.
79
+ * const buf = Buffer.from(arr.buffer);
80
+ *
81
+ * console.log(buf);
82
+ * // Prints: <Buffer 88 13 a0 0f>
83
+ *
84
+ * // Changing the original Uint16Array changes the Buffer also.
85
+ * arr[1] = 6000;
86
+ *
87
+ * console.log(buf);
88
+ * // Prints: <Buffer 88 13 70 17>
89
+ * ```
90
+ *
91
+ * The optional `byteOffset` and `length` arguments specify a memory range within
92
+ * the `arrayBuffer` that will be shared by the `Buffer`.
93
+ *
94
+ * ```js
95
+ * import { Buffer } from 'node:buffer';
96
+ *
97
+ * const ab = new ArrayBuffer(10);
98
+ * const buf = Buffer.from(ab, 0, 2);
99
+ *
100
+ * console.log(buf.length);
101
+ * // Prints: 2
102
+ * ```
103
+ *
104
+ * A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a
105
+ * `SharedArrayBuffer` or another type appropriate for `Buffer.from()`
106
+ * variants.
107
+ *
108
+ * It is important to remember that a backing `ArrayBuffer` can cover a range
109
+ * of memory that extends beyond the bounds of a `TypedArray` view. A new
110
+ * `Buffer` created using the `buffer` property of a `TypedArray` may extend
111
+ * beyond the range of the `TypedArray`:
112
+ *
113
+ * ```js
114
+ * import { Buffer } from 'node:buffer';
115
+ *
116
+ * const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements
117
+ * const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements
118
+ * console.log(arrA.buffer === arrB.buffer); // true
119
+ *
120
+ * const buf = Buffer.from(arrB.buffer);
121
+ * console.log(buf);
122
+ * // Prints: <Buffer 63 64 65 66>
123
+ * ```
124
+ * @since v5.10.0
125
+ * @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the
126
+ * `.buffer` property of a `TypedArray`.
127
+ * @param byteOffset Index of first byte to expose. **Default:** `0`.
128
+ * @param length Number of bytes to expose. **Default:**
129
+ * `arrayBuffer.byteLength - byteOffset`.
130
+ */
131
+ from<TArrayBuffer extends WithImplicitCoercion<ArrayBufferLike>>(
132
+ arrayBuffer: TArrayBuffer,
133
+ byteOffset?: number,
134
+ length?: number,
135
+ ): Buffer<ImplicitArrayBuffer<TArrayBuffer>>;
136
+ /**
137
+ * Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
138
+ * the character encoding to be used when converting `string` into bytes.
139
+ *
140
+ * ```js
141
+ * import { Buffer } from 'node:buffer';
142
+ *
143
+ * const buf1 = Buffer.from('this is a tést');
144
+ * const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
145
+ *
146
+ * console.log(buf1.toString());
147
+ * // Prints: this is a tést
148
+ * console.log(buf2.toString());
149
+ * // Prints: this is a tést
150
+ * console.log(buf1.toString('latin1'));
151
+ * // Prints: this is a tést
152
+ * ```
153
+ *
154
+ * A `TypeError` will be thrown if `string` is not a string or another type
155
+ * appropriate for `Buffer.from()` variants.
156
+ *
157
+ * `Buffer.from(string)` may also use the internal `Buffer` pool like
158
+ * `Buffer.allocUnsafe()` does.
159
+ * @since v5.10.0
160
+ * @param string A string to encode.
161
+ * @param encoding The encoding of `string`. **Default:** `'utf8'`.
162
+ */
163
+ from(string: WithImplicitCoercion<string>, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
164
+ from(arrayOrString: WithImplicitCoercion<ArrayLike<number> | string>): Buffer<ArrayBuffer>;
165
+ /**
166
+ * Creates a new Buffer using the passed {data}
167
+ * @param values to create a new Buffer
168
+ */
169
+ of(...items: number[]): Buffer<ArrayBuffer>;
170
+ /**
171
+ * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
172
+ *
173
+ * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
174
+ *
175
+ * If `totalLength` is not provided, it is calculated from the `Buffer` instances
176
+ * in `list` by adding their lengths.
177
+ *
178
+ * If `totalLength` is provided, it is coerced to an unsigned integer. If the
179
+ * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
180
+ * truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is
181
+ * less than `totalLength`, the remaining space is filled with zeros.
182
+ *
183
+ * ```js
184
+ * import { Buffer } from 'node:buffer';
185
+ *
186
+ * // Create a single `Buffer` from a list of three `Buffer` instances.
187
+ *
188
+ * const buf1 = Buffer.alloc(10);
189
+ * const buf2 = Buffer.alloc(14);
190
+ * const buf3 = Buffer.alloc(18);
191
+ * const totalLength = buf1.length + buf2.length + buf3.length;
192
+ *
193
+ * console.log(totalLength);
194
+ * // Prints: 42
195
+ *
196
+ * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
197
+ *
198
+ * console.log(bufA);
199
+ * // Prints: <Buffer 00 00 00 00 ...>
200
+ * console.log(bufA.length);
201
+ * // Prints: 42
202
+ * ```
203
+ *
204
+ * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
205
+ * @since v0.7.11
206
+ * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
207
+ * @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
208
+ */
209
+ concat(list: readonly Uint8Array[], totalLength?: number): Buffer<ArrayBuffer>;
210
+ /**
211
+ * Copies the underlying memory of `view` into a new `Buffer`.
212
+ *
213
+ * ```js
214
+ * const u16 = new Uint16Array([0, 0xffff]);
215
+ * const buf = Buffer.copyBytesFrom(u16, 1, 1);
216
+ * u16[1] = 0;
217
+ * console.log(buf.length); // 2
218
+ * console.log(buf[0]); // 255
219
+ * console.log(buf[1]); // 255
220
+ * ```
221
+ * @since v19.8.0
222
+ * @param view The {TypedArray} to copy.
223
+ * @param [offset=0] The starting offset within `view`.
224
+ * @param [length=view.length - offset] The number of elements from `view` to copy.
225
+ */
226
+ copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer<ArrayBuffer>;
227
+ /**
228
+ * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
229
+ *
230
+ * ```js
231
+ * import { Buffer } from 'node:buffer';
232
+ *
233
+ * const buf = Buffer.alloc(5);
234
+ *
235
+ * console.log(buf);
236
+ * // Prints: <Buffer 00 00 00 00 00>
237
+ * ```
238
+ *
239
+ * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
240
+ *
241
+ * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
242
+ *
243
+ * ```js
244
+ * import { Buffer } from 'node:buffer';
245
+ *
246
+ * const buf = Buffer.alloc(5, 'a');
247
+ *
248
+ * console.log(buf);
249
+ * // Prints: <Buffer 61 61 61 61 61>
250
+ * ```
251
+ *
252
+ * If both `fill` and `encoding` are specified, the allocated `Buffer` will be
253
+ * initialized by calling `buf.fill(fill, encoding)`.
254
+ *
255
+ * ```js
256
+ * import { Buffer } from 'node:buffer';
257
+ *
258
+ * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
259
+ *
260
+ * console.log(buf);
261
+ * // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
262
+ * ```
263
+ *
264
+ * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
265
+ * contents will never contain sensitive data from previous allocations, including
266
+ * data that might not have been allocated for `Buffer`s.
267
+ *
268
+ * A `TypeError` will be thrown if `size` is not a number.
269
+ * @since v5.10.0
270
+ * @param size The desired length of the new `Buffer`.
271
+ * @param [fill=0] A value to pre-fill the new `Buffer` with.
272
+ * @param [encoding='utf8'] If `fill` is a string, this is its encoding.
273
+ */
274
+ alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
275
+ /**
276
+ * 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.
277
+ *
278
+ * The underlying memory for `Buffer` instances created in this way is _not_
279
+ * _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.
280
+ *
281
+ * ```js
282
+ * import { Buffer } from 'node:buffer';
283
+ *
284
+ * const buf = Buffer.allocUnsafe(10);
285
+ *
286
+ * console.log(buf);
287
+ * // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
288
+ *
289
+ * buf.fill(0);
290
+ *
291
+ * console.log(buf);
292
+ * // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
293
+ * ```
294
+ *
295
+ * A `TypeError` will be thrown if `size` is not a number.
296
+ *
297
+ * The `Buffer` module pre-allocates an internal `Buffer` instance of
298
+ * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
299
+ * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
300
+ *
301
+ * Use of this pre-allocated internal memory pool is a key difference between
302
+ * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
303
+ * 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
304
+ * than or equal to half `Buffer.poolSize`. The
305
+ * difference is subtle but can be important when an application requires the
306
+ * additional performance that `Buffer.allocUnsafe()` provides.
307
+ * @since v5.10.0
308
+ * @param size The desired length of the new `Buffer`.
309
+ */
310
+ allocUnsafe(size: number): Buffer<ArrayBuffer>;
311
+ /**
312
+ * 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
313
+ * `size` is 0.
314
+ *
315
+ * The underlying memory for `Buffer` instances created in this way is _not_
316
+ * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
317
+ * such `Buffer` instances with zeroes.
318
+ *
319
+ * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
320
+ * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
321
+ * allows applications to avoid the garbage collection overhead of creating many
322
+ * individually allocated `Buffer` instances. This approach improves both
323
+ * performance and memory usage by eliminating the need to track and clean up as
324
+ * many individual `ArrayBuffer` objects.
325
+ *
326
+ * However, in the case where a developer may need to retain a small chunk of
327
+ * memory from a pool for an indeterminate amount of time, it may be appropriate
328
+ * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
329
+ * then copying out the relevant bits.
330
+ *
331
+ * ```js
332
+ * import { Buffer } from 'node:buffer';
333
+ *
334
+ * // Need to keep around a few small chunks of memory.
335
+ * const store = [];
336
+ *
337
+ * socket.on('readable', () => {
338
+ * let data;
339
+ * while (null !== (data = readable.read())) {
340
+ * // Allocate for retained data.
341
+ * const sb = Buffer.allocUnsafeSlow(10);
342
+ *
343
+ * // Copy the data into the new allocation.
344
+ * data.copy(sb, 0, 0, 10);
345
+ *
346
+ * store.push(sb);
347
+ * }
348
+ * });
349
+ * ```
350
+ *
351
+ * A `TypeError` will be thrown if `size` is not a number.
352
+ * @since v5.12.0
353
+ * @param size The desired length of the new `Buffer`.
354
+ */
355
+ allocUnsafeSlow(size: number): Buffer<ArrayBuffer>;
356
+ }
357
+ interface Buffer<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends Uint8Array<TArrayBuffer> {
358
+ // see buffer.d.ts for implementation shared with all TypeScript versions
359
+
360
+ /**
361
+ * Returns a new `Buffer` that references the same memory as the original, but
362
+ * offset and cropped by the `start` and `end` indices.
363
+ *
364
+ * This method is not compatible with the `Uint8Array.prototype.slice()`,
365
+ * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
366
+ *
367
+ * ```js
368
+ * import { Buffer } from 'node:buffer';
369
+ *
370
+ * const buf = Buffer.from('buffer');
371
+ *
372
+ * const copiedBuf = Uint8Array.prototype.slice.call(buf);
373
+ * copiedBuf[0]++;
374
+ * console.log(copiedBuf.toString());
375
+ * // Prints: cuffer
376
+ *
377
+ * console.log(buf.toString());
378
+ * // Prints: buffer
379
+ *
380
+ * // With buf.slice(), the original buffer is modified.
381
+ * const notReallyCopiedBuf = buf.slice();
382
+ * notReallyCopiedBuf[0]++;
383
+ * console.log(notReallyCopiedBuf.toString());
384
+ * // Prints: cuffer
385
+ * console.log(buf.toString());
386
+ * // Also prints: cuffer (!)
387
+ * ```
388
+ * @since v0.3.0
389
+ * @deprecated Use `subarray` instead.
390
+ * @param [start=0] Where the new `Buffer` will start.
391
+ * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
392
+ */
393
+ slice(start?: number, end?: number): Buffer<ArrayBuffer>;
394
+ /**
395
+ * Returns a new `Buffer` that references the same memory as the original, but
396
+ * offset and cropped by the `start` and `end` indices.
397
+ *
398
+ * Specifying `end` greater than `buf.length` will return the same result as
399
+ * that of `end` equal to `buf.length`.
400
+ *
401
+ * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
402
+ *
403
+ * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
404
+ *
405
+ * ```js
406
+ * import { Buffer } from 'node:buffer';
407
+ *
408
+ * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
409
+ * // from the original `Buffer`.
410
+ *
411
+ * const buf1 = Buffer.allocUnsafe(26);
412
+ *
413
+ * for (let i = 0; i < 26; i++) {
414
+ * // 97 is the decimal ASCII value for 'a'.
415
+ * buf1[i] = i + 97;
416
+ * }
417
+ *
418
+ * const buf2 = buf1.subarray(0, 3);
419
+ *
420
+ * console.log(buf2.toString('ascii', 0, buf2.length));
421
+ * // Prints: abc
422
+ *
423
+ * buf1[0] = 33;
424
+ *
425
+ * console.log(buf2.toString('ascii', 0, buf2.length));
426
+ * // Prints: !bc
427
+ * ```
428
+ *
429
+ * Specifying negative indexes causes the slice to be generated relative to the
430
+ * end of `buf` rather than the beginning.
431
+ *
432
+ * ```js
433
+ * import { Buffer } from 'node:buffer';
434
+ *
435
+ * const buf = Buffer.from('buffer');
436
+ *
437
+ * console.log(buf.subarray(-6, -1).toString());
438
+ * // Prints: buffe
439
+ * // (Equivalent to buf.subarray(0, 5).)
440
+ *
441
+ * console.log(buf.subarray(-6, -2).toString());
442
+ * // Prints: buff
443
+ * // (Equivalent to buf.subarray(0, 4).)
444
+ *
445
+ * console.log(buf.subarray(-5, -2).toString());
446
+ * // Prints: uff
447
+ * // (Equivalent to buf.subarray(1, 4).)
448
+ * ```
449
+ * @since v3.0.0
450
+ * @param [start=0] Where the new `Buffer` will start.
451
+ * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
452
+ */
453
+ subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
454
+ }
455
+ type NonSharedBuffer = Buffer<ArrayBuffer>;
456
+ type AllowSharedBuffer = Buffer<ArrayBufferLike>;
457
+ }
458
+ /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
459
+ var SlowBuffer: {
460
+ /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
461
+ new(size: number): Buffer<ArrayBuffer>;
462
+ prototype: Buffer;
463
+ };
464
+ }