@quiverai/sdk 0.1.3 → 0.1.4

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 (183) hide show
  1. package/README.md +8 -11
  2. package/_speakeasy/.github/action-inputs-config.json +53 -0
  3. package/_speakeasy/.github/action-security-config.json +88 -0
  4. package/dist/commonjs/funcs/modelsListModels.js +1 -1
  5. package/dist/commonjs/funcs/modelsRetrieveModel.js +1 -1
  6. package/dist/commonjs/funcs/svgCheckVectorizability.js +1 -1
  7. package/dist/commonjs/funcs/svgCreateSVGAnimation.js +1 -1
  8. package/dist/commonjs/funcs/svgCreateSVGCollection.js +1 -1
  9. package/dist/commonjs/funcs/svgCreateSVGEdit.js +1 -1
  10. package/dist/commonjs/funcs/svgCreateSVGGeneration.js +1 -1
  11. package/dist/commonjs/funcs/svgCreateSVGVectorization.js +1 -1
  12. package/dist/commonjs/lib/config.d.ts +2 -2
  13. package/dist/commonjs/lib/config.js +2 -2
  14. package/dist/esm/funcs/modelsListModels.js +1 -1
  15. package/dist/esm/funcs/modelsRetrieveModel.js +1 -1
  16. package/dist/esm/funcs/svgCheckVectorizability.js +1 -1
  17. package/dist/esm/funcs/svgCreateSVGAnimation.js +1 -1
  18. package/dist/esm/funcs/svgCreateSVGCollection.js +1 -1
  19. package/dist/esm/funcs/svgCreateSVGEdit.js +1 -1
  20. package/dist/esm/funcs/svgCreateSVGGeneration.js +1 -1
  21. package/dist/esm/funcs/svgCreateSVGVectorization.js +1 -1
  22. package/dist/esm/lib/config.d.ts +2 -2
  23. package/dist/esm/lib/config.js +2 -2
  24. package/examples/package-lock.json +611 -0
  25. package/jsr.json +1 -1
  26. package/package.json +5 -1
  27. package/src/funcs/modelsListModels.ts +1 -1
  28. package/src/funcs/modelsRetrieveModel.ts +1 -1
  29. package/src/funcs/svgCheckVectorizability.ts +1 -1
  30. package/src/funcs/svgCreateSVGAnimation.ts +1 -1
  31. package/src/funcs/svgCreateSVGCollection.ts +1 -1
  32. package/src/funcs/svgCreateSVGEdit.ts +1 -1
  33. package/src/funcs/svgCreateSVGGeneration.ts +1 -1
  34. package/src/funcs/svgCreateSVGVectorization.ts +1 -1
  35. package/src/lib/config.ts +2 -2
  36. package/.speakeasy/temp/reformatted4022478357.json +0 -3500
  37. package/.speakeasy/temp/registry_9588e5.json +0 -1
  38. package/examples/node_modules/.package-lock.json +0 -161
  39. package/examples/node_modules/@esbuild/darwin-arm64/package.json +0 -20
  40. package/examples/node_modules/@types/node/assert/strict.d.ts +0 -8
  41. package/examples/node_modules/@types/node/assert.d.ts +0 -1062
  42. package/examples/node_modules/@types/node/async_hooks.d.ts +0 -605
  43. package/examples/node_modules/@types/node/buffer.buffer.d.ts +0 -471
  44. package/examples/node_modules/@types/node/buffer.d.ts +0 -1936
  45. package/examples/node_modules/@types/node/child_process.d.ts +0 -1475
  46. package/examples/node_modules/@types/node/cluster.d.ts +0 -577
  47. package/examples/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  48. package/examples/node_modules/@types/node/compatibility/index.d.ts +0 -9
  49. package/examples/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  50. package/examples/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  51. package/examples/node_modules/@types/node/console.d.ts +0 -452
  52. package/examples/node_modules/@types/node/constants.d.ts +0 -21
  53. package/examples/node_modules/@types/node/crypto.d.ts +0 -4590
  54. package/examples/node_modules/@types/node/dgram.d.ts +0 -597
  55. package/examples/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
  56. package/examples/node_modules/@types/node/dns/promises.d.ts +0 -479
  57. package/examples/node_modules/@types/node/dns.d.ts +0 -871
  58. package/examples/node_modules/@types/node/domain.d.ts +0 -170
  59. package/examples/node_modules/@types/node/events.d.ts +0 -977
  60. package/examples/node_modules/@types/node/fs/promises.d.ts +0 -1270
  61. package/examples/node_modules/@types/node/fs.d.ts +0 -4375
  62. package/examples/node_modules/@types/node/globals.d.ts +0 -172
  63. package/examples/node_modules/@types/node/globals.typedarray.d.ts +0 -38
  64. package/examples/node_modules/@types/node/http.d.ts +0 -2049
  65. package/examples/node_modules/@types/node/http2.d.ts +0 -2631
  66. package/examples/node_modules/@types/node/https.d.ts +0 -578
  67. package/examples/node_modules/@types/node/index.d.ts +0 -93
  68. package/examples/node_modules/@types/node/inspector.generated.d.ts +0 -3966
  69. package/examples/node_modules/@types/node/module.d.ts +0 -539
  70. package/examples/node_modules/@types/node/net.d.ts +0 -1012
  71. package/examples/node_modules/@types/node/os.d.ts +0 -506
  72. package/examples/node_modules/@types/node/package.json +0 -140
  73. package/examples/node_modules/@types/node/path.d.ts +0 -200
  74. package/examples/node_modules/@types/node/perf_hooks.d.ts +0 -961
  75. package/examples/node_modules/@types/node/process.d.ts +0 -1957
  76. package/examples/node_modules/@types/node/punycode.d.ts +0 -117
  77. package/examples/node_modules/@types/node/querystring.d.ts +0 -152
  78. package/examples/node_modules/@types/node/readline/promises.d.ts +0 -162
  79. package/examples/node_modules/@types/node/readline.d.ts +0 -589
  80. package/examples/node_modules/@types/node/repl.d.ts +0 -430
  81. package/examples/node_modules/@types/node/sea.d.ts +0 -153
  82. package/examples/node_modules/@types/node/stream/consumers.d.ts +0 -38
  83. package/examples/node_modules/@types/node/stream/promises.d.ts +0 -90
  84. package/examples/node_modules/@types/node/stream/web.d.ts +0 -533
  85. package/examples/node_modules/@types/node/stream.d.ts +0 -1675
  86. package/examples/node_modules/@types/node/string_decoder.d.ts +0 -67
  87. package/examples/node_modules/@types/node/test.d.ts +0 -1787
  88. package/examples/node_modules/@types/node/timers/promises.d.ts +0 -108
  89. package/examples/node_modules/@types/node/timers.d.ts +0 -286
  90. package/examples/node_modules/@types/node/tls.d.ts +0 -1255
  91. package/examples/node_modules/@types/node/trace_events.d.ts +0 -197
  92. package/examples/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -468
  93. package/examples/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -34
  94. package/examples/node_modules/@types/node/ts5.6/index.d.ts +0 -93
  95. package/examples/node_modules/@types/node/tty.d.ts +0 -208
  96. package/examples/node_modules/@types/node/url.d.ts +0 -964
  97. package/examples/node_modules/@types/node/util.d.ts +0 -2331
  98. package/examples/node_modules/@types/node/v8.d.ts +0 -809
  99. package/examples/node_modules/@types/node/vm.d.ts +0 -1001
  100. package/examples/node_modules/@types/node/wasi.d.ts +0 -181
  101. package/examples/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
  102. package/examples/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
  103. package/examples/node_modules/@types/node/web-globals/events.d.ts +0 -97
  104. package/examples/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
  105. package/examples/node_modules/@types/node/worker_threads.d.ts +0 -715
  106. package/examples/node_modules/@types/node/zlib.d.ts +0 -540
  107. package/examples/node_modules/dotenv/config.d.ts +0 -1
  108. package/examples/node_modules/dotenv/config.js +0 -9
  109. package/examples/node_modules/dotenv/lib/cli-options.js +0 -17
  110. package/examples/node_modules/dotenv/lib/env-options.js +0 -28
  111. package/examples/node_modules/dotenv/lib/main.d.ts +0 -162
  112. package/examples/node_modules/dotenv/lib/main.js +0 -386
  113. package/examples/node_modules/dotenv/package.json +0 -62
  114. package/examples/node_modules/esbuild/install.js +0 -289
  115. package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
  116. package/examples/node_modules/esbuild/lib/main.js +0 -2242
  117. package/examples/node_modules/esbuild/package.json +0 -49
  118. package/examples/node_modules/get-tsconfig/dist/index.mjs +0 -7
  119. package/examples/node_modules/get-tsconfig/package.json +0 -46
  120. package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
  121. package/examples/node_modules/resolve-pkg-maps/package.json +0 -42
  122. package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
  123. package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
  124. package/examples/node_modules/tsx/dist/cli.mjs +0 -55
  125. package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
  126. package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
  127. package/examples/node_modules/tsx/dist/esm/index.mjs +0 -2
  128. package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
  129. package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +0 -14
  130. package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
  131. package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
  132. package/examples/node_modules/tsx/dist/loader.mjs +0 -1
  133. package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
  134. package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +0 -1
  135. package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
  136. package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
  137. package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +0 -1
  138. package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +0 -4
  139. package/examples/node_modules/tsx/dist/repl.mjs +0 -3
  140. package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +0 -1
  141. package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
  142. package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
  143. package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
  144. package/examples/node_modules/tsx/package.json +0 -68
  145. package/examples/node_modules/undici-types/agent.d.ts +0 -31
  146. package/examples/node_modules/undici-types/api.d.ts +0 -43
  147. package/examples/node_modules/undici-types/balanced-pool.d.ts +0 -29
  148. package/examples/node_modules/undici-types/cache.d.ts +0 -36
  149. package/examples/node_modules/undici-types/client.d.ts +0 -108
  150. package/examples/node_modules/undici-types/connector.d.ts +0 -34
  151. package/examples/node_modules/undici-types/content-type.d.ts +0 -21
  152. package/examples/node_modules/undici-types/cookies.d.ts +0 -28
  153. package/examples/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  154. package/examples/node_modules/undici-types/dispatcher.d.ts +0 -256
  155. package/examples/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  156. package/examples/node_modules/undici-types/errors.d.ts +0 -149
  157. package/examples/node_modules/undici-types/eventsource.d.ts +0 -61
  158. package/examples/node_modules/undici-types/fetch.d.ts +0 -209
  159. package/examples/node_modules/undici-types/file.d.ts +0 -39
  160. package/examples/node_modules/undici-types/filereader.d.ts +0 -54
  161. package/examples/node_modules/undici-types/formdata.d.ts +0 -108
  162. package/examples/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  163. package/examples/node_modules/undici-types/global-origin.d.ts +0 -7
  164. package/examples/node_modules/undici-types/handlers.d.ts +0 -15
  165. package/examples/node_modules/undici-types/header.d.ts +0 -4
  166. package/examples/node_modules/undici-types/index.d.ts +0 -71
  167. package/examples/node_modules/undici-types/interceptors.d.ts +0 -17
  168. package/examples/node_modules/undici-types/mock-agent.d.ts +0 -50
  169. package/examples/node_modules/undici-types/mock-client.d.ts +0 -25
  170. package/examples/node_modules/undici-types/mock-errors.d.ts +0 -12
  171. package/examples/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  172. package/examples/node_modules/undici-types/mock-pool.d.ts +0 -25
  173. package/examples/node_modules/undici-types/package.json +0 -55
  174. package/examples/node_modules/undici-types/patch.d.ts +0 -33
  175. package/examples/node_modules/undici-types/pool-stats.d.ts +0 -19
  176. package/examples/node_modules/undici-types/pool.d.ts +0 -39
  177. package/examples/node_modules/undici-types/proxy-agent.d.ts +0 -28
  178. package/examples/node_modules/undici-types/readable.d.ts +0 -65
  179. package/examples/node_modules/undici-types/retry-agent.d.ts +0 -8
  180. package/examples/node_modules/undici-types/retry-handler.d.ts +0 -116
  181. package/examples/node_modules/undici-types/util.d.ts +0 -18
  182. package/examples/node_modules/undici-types/webidl.d.ts +0 -228
  183. package/examples/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
- }