mcpbrowser 0.2.2 → 0.2.3

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