alicezetion 1.8.6 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  2. package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
  3. package/.cache/replit/modules/nodejs-20:v25-20240206-fdbd396.res +1 -0
  4. package/.cache/replit/modules/replit:v4-20240206-fdbd396.res +1 -0
  5. package/.cache/replit/modules.stamp +0 -1
  6. package/.cache/replit/nix/env.json +1 -1
  7. package/.cache/typescript/5.3/node_modules/.package-lock.json +137 -0
  8. package/.cache/typescript/5.3/node_modules/@types/bluebird/LICENSE +21 -0
  9. package/.cache/typescript/5.3/node_modules/@types/bluebird/README.md +15 -0
  10. package/.cache/typescript/5.3/node_modules/@types/bluebird/index.d.ts +1365 -0
  11. package/.cache/typescript/5.3/node_modules/@types/bluebird/package.json +25 -0
  12. package/.cache/typescript/5.3/node_modules/@types/caseless/LICENSE +21 -0
  13. package/.cache/typescript/5.3/node_modules/@types/caseless/README.md +48 -0
  14. package/.cache/typescript/5.3/node_modules/@types/caseless/index.d.ts +29 -0
  15. package/.cache/typescript/5.3/node_modules/@types/caseless/package.json +35 -0
  16. package/.cache/typescript/5.3/node_modules/@types/cheerio/LICENSE +21 -0
  17. package/.cache/typescript/5.3/node_modules/@types/cheerio/README.md +15 -0
  18. package/.cache/typescript/5.3/node_modules/@types/cheerio/index.d.ts +318 -0
  19. package/.cache/typescript/5.3/node_modules/@types/cheerio/package.json +71 -0
  20. package/.cache/typescript/5.3/node_modules/@types/node/LICENSE +21 -0
  21. package/.cache/typescript/5.3/node_modules/@types/node/README.md +15 -0
  22. package/.cache/typescript/5.3/node_modules/@types/node/assert/strict.d.ts +8 -0
  23. package/.cache/typescript/5.3/node_modules/@types/node/assert.d.ts +996 -0
  24. package/.cache/typescript/5.3/node_modules/@types/node/async_hooks.d.ts +539 -0
  25. package/.cache/typescript/5.3/node_modules/@types/node/buffer.d.ts +2362 -0
  26. package/.cache/typescript/5.3/node_modules/@types/node/child_process.d.ts +1540 -0
  27. package/.cache/typescript/5.3/node_modules/@types/node/cluster.d.ts +432 -0
  28. package/.cache/typescript/5.3/node_modules/@types/node/console.d.ts +415 -0
  29. package/.cache/typescript/5.3/node_modules/@types/node/constants.d.ts +19 -0
  30. package/.cache/typescript/5.3/node_modules/@types/node/crypto.d.ts +4487 -0
  31. package/.cache/typescript/5.3/node_modules/@types/node/dgram.d.ts +596 -0
  32. package/.cache/typescript/5.3/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
  33. package/.cache/typescript/5.3/node_modules/@types/node/dns/promises.d.ts +425 -0
  34. package/.cache/typescript/5.3/node_modules/@types/node/dns.d.ts +809 -0
  35. package/.cache/typescript/5.3/node_modules/@types/node/dom-events.d.ts +122 -0
  36. package/.cache/typescript/5.3/node_modules/@types/node/domain.d.ts +170 -0
  37. package/.cache/typescript/5.3/node_modules/@types/node/events.d.ts +879 -0
  38. package/.cache/typescript/5.3/node_modules/@types/node/fs/promises.d.ts +1239 -0
  39. package/.cache/typescript/5.3/node_modules/@types/node/fs.d.ts +4311 -0
  40. package/.cache/typescript/5.3/node_modules/@types/node/globals.d.ts +411 -0
  41. package/.cache/typescript/5.3/node_modules/@types/node/globals.global.d.ts +1 -0
  42. package/.cache/typescript/5.3/node_modules/@types/node/http.d.ts +1887 -0
  43. package/.cache/typescript/5.3/node_modules/@types/node/http2.d.ts +2382 -0
  44. package/.cache/typescript/5.3/node_modules/@types/node/https.d.ts +550 -0
  45. package/.cache/typescript/5.3/node_modules/@types/node/index.d.ts +88 -0
  46. package/.cache/typescript/5.3/node_modules/@types/node/inspector.d.ts +2747 -0
  47. package/.cache/typescript/5.3/node_modules/@types/node/module.d.ts +315 -0
  48. package/.cache/typescript/5.3/node_modules/@types/node/net.d.ts +949 -0
  49. package/.cache/typescript/5.3/node_modules/@types/node/os.d.ts +478 -0
  50. package/.cache/typescript/5.3/node_modules/@types/node/package.json +229 -0
  51. package/.cache/typescript/5.3/node_modules/@types/node/path.d.ts +191 -0
  52. package/.cache/typescript/5.3/node_modules/@types/node/perf_hooks.d.ts +645 -0
  53. package/.cache/typescript/5.3/node_modules/@types/node/process.d.ts +1561 -0
  54. package/.cache/typescript/5.3/node_modules/@types/node/punycode.d.ts +117 -0
  55. package/.cache/typescript/5.3/node_modules/@types/node/querystring.d.ts +141 -0
  56. package/.cache/typescript/5.3/node_modules/@types/node/readline/promises.d.ts +150 -0
  57. package/.cache/typescript/5.3/node_modules/@types/node/readline.d.ts +539 -0
  58. package/.cache/typescript/5.3/node_modules/@types/node/repl.d.ts +430 -0
  59. package/.cache/typescript/5.3/node_modules/@types/node/stream/consumers.d.ts +12 -0
  60. package/.cache/typescript/5.3/node_modules/@types/node/stream/promises.d.ts +83 -0
  61. package/.cache/typescript/5.3/node_modules/@types/node/stream/web.d.ts +366 -0
  62. package/.cache/typescript/5.3/node_modules/@types/node/stream.d.ts +1701 -0
  63. package/.cache/typescript/5.3/node_modules/@types/node/string_decoder.d.ts +67 -0
  64. package/.cache/typescript/5.3/node_modules/@types/node/test.d.ts +1465 -0
  65. package/.cache/typescript/5.3/node_modules/@types/node/timers/promises.d.ts +93 -0
  66. package/.cache/typescript/5.3/node_modules/@types/node/timers.d.ts +240 -0
  67. package/.cache/typescript/5.3/node_modules/@types/node/tls.d.ts +1210 -0
  68. package/.cache/typescript/5.3/node_modules/@types/node/trace_events.d.ts +182 -0
  69. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  70. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
  71. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
  72. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
  73. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
  74. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
  75. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/console.d.ts +415 -0
  76. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
  77. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/crypto.d.ts +4487 -0
  78. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dgram.d.ts +596 -0
  79. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +545 -0
  80. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
  81. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
  82. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
  83. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  84. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/events.d.ts +879 -0
  85. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
  86. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs.d.ts +4311 -0
  87. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.d.ts +411 -0
  88. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  89. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http.d.ts +1887 -0
  90. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
  91. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/https.d.ts +550 -0
  92. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  93. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
  94. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/module.d.ts +315 -0
  95. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/net.d.ts +949 -0
  96. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/os.d.ts +478 -0
  97. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  98. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +645 -0
  99. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/process.d.ts +1561 -0
  100. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  101. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
  102. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
  103. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
  104. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
  105. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  106. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
  107. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/web.d.ts +366 -0
  108. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
  109. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  110. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/test.d.ts +1465 -0
  111. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  112. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
  113. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
  114. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  115. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  116. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/url.d.ts +927 -0
  117. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
  118. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  119. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
  120. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/wasi.d.ts +179 -0
  121. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
  122. package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  123. package/.cache/typescript/5.3/node_modules/@types/node/tty.d.ts +208 -0
  124. package/.cache/typescript/5.3/node_modules/@types/node/url.d.ts +927 -0
  125. package/.cache/typescript/5.3/node_modules/@types/node/util.d.ts +2183 -0
  126. package/.cache/typescript/5.3/node_modules/@types/node/v8.d.ts +635 -0
  127. package/.cache/typescript/5.3/node_modules/@types/node/vm.d.ts +903 -0
  128. package/.cache/typescript/5.3/node_modules/@types/node/wasi.d.ts +179 -0
  129. package/.cache/typescript/5.3/node_modules/@types/node/worker_threads.d.ts +691 -0
  130. package/.cache/typescript/5.3/node_modules/@types/node/zlib.d.ts +517 -0
  131. package/.cache/typescript/5.3/node_modules/@types/npmlog/LICENSE +21 -0
  132. package/.cache/typescript/5.3/node_modules/@types/npmlog/README.md +15 -0
  133. package/.cache/typescript/5.3/node_modules/@types/npmlog/index.d.ts +84 -0
  134. package/.cache/typescript/5.3/node_modules/@types/npmlog/package.json +32 -0
  135. package/.cache/typescript/5.3/node_modules/@types/request/LICENSE +21 -0
  136. package/.cache/typescript/5.3/node_modules/@types/request/README.md +15 -0
  137. package/.cache/typescript/5.3/node_modules/@types/request/index.d.ts +395 -0
  138. package/.cache/typescript/5.3/node_modules/@types/request/package.json +70 -0
  139. package/.cache/typescript/5.3/node_modules/@types/tough-cookie/LICENSE +21 -0
  140. package/.cache/typescript/5.3/node_modules/@types/tough-cookie/README.md +15 -0
  141. package/.cache/typescript/5.3/node_modules/@types/tough-cookie/index.d.ts +321 -0
  142. package/.cache/typescript/5.3/node_modules/@types/tough-cookie/package.json +35 -0
  143. package/.cache/typescript/5.3/node_modules/asynckit/LICENSE +21 -0
  144. package/.cache/typescript/5.3/node_modules/asynckit/README.md +233 -0
  145. package/.cache/typescript/5.3/node_modules/asynckit/bench.js +76 -0
  146. package/.cache/typescript/5.3/node_modules/asynckit/index.js +6 -0
  147. package/.cache/typescript/5.3/node_modules/asynckit/lib/abort.js +29 -0
  148. package/.cache/typescript/5.3/node_modules/asynckit/lib/async.js +34 -0
  149. package/.cache/typescript/5.3/node_modules/asynckit/lib/defer.js +26 -0
  150. package/.cache/typescript/5.3/node_modules/asynckit/lib/iterate.js +75 -0
  151. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  152. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_parallel.js +25 -0
  153. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial.js +25 -0
  154. package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  155. package/.cache/typescript/5.3/node_modules/asynckit/lib/state.js +37 -0
  156. package/.cache/typescript/5.3/node_modules/asynckit/lib/streamify.js +141 -0
  157. package/.cache/typescript/5.3/node_modules/asynckit/lib/terminator.js +29 -0
  158. package/.cache/typescript/5.3/node_modules/asynckit/package.json +63 -0
  159. package/.cache/typescript/5.3/node_modules/asynckit/parallel.js +43 -0
  160. package/.cache/typescript/5.3/node_modules/asynckit/serial.js +17 -0
  161. package/.cache/typescript/5.3/node_modules/asynckit/serialOrdered.js +75 -0
  162. package/.cache/typescript/5.3/node_modules/asynckit/stream.js +21 -0
  163. package/.cache/typescript/5.3/node_modules/combined-stream/License +19 -0
  164. package/.cache/typescript/5.3/node_modules/combined-stream/Readme.md +138 -0
  165. package/.cache/typescript/5.3/node_modules/combined-stream/lib/combined_stream.js +208 -0
  166. package/.cache/typescript/5.3/node_modules/combined-stream/package.json +25 -0
  167. package/.cache/typescript/5.3/node_modules/combined-stream/yarn.lock +17 -0
  168. package/.cache/typescript/5.3/node_modules/delayed-stream/License +19 -0
  169. package/.cache/typescript/5.3/node_modules/delayed-stream/Makefile +7 -0
  170. package/.cache/typescript/5.3/node_modules/delayed-stream/Readme.md +141 -0
  171. package/.cache/typescript/5.3/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  172. package/.cache/typescript/5.3/node_modules/delayed-stream/package.json +27 -0
  173. package/.cache/typescript/5.3/node_modules/form-data/License +19 -0
  174. package/.cache/typescript/5.3/node_modules/form-data/README.md +350 -0
  175. package/.cache/typescript/5.3/node_modules/form-data/README.md.bak +350 -0
  176. package/.cache/typescript/5.3/node_modules/form-data/index.d.ts +51 -0
  177. package/.cache/typescript/5.3/node_modules/form-data/lib/browser.js +2 -0
  178. package/.cache/typescript/5.3/node_modules/form-data/lib/form_data.js +483 -0
  179. package/.cache/typescript/5.3/node_modules/form-data/lib/populate.js +10 -0
  180. package/.cache/typescript/5.3/node_modules/form-data/package.json +68 -0
  181. package/.cache/typescript/5.3/node_modules/mime-db/HISTORY.md +507 -0
  182. package/.cache/typescript/5.3/node_modules/mime-db/LICENSE +23 -0
  183. package/.cache/typescript/5.3/node_modules/mime-db/README.md +100 -0
  184. package/.cache/typescript/5.3/node_modules/mime-db/db.json +8519 -0
  185. package/.cache/typescript/5.3/node_modules/mime-db/index.js +12 -0
  186. package/.cache/typescript/5.3/node_modules/mime-db/package.json +60 -0
  187. package/.cache/typescript/5.3/node_modules/mime-types/HISTORY.md +397 -0
  188. package/.cache/typescript/5.3/node_modules/mime-types/LICENSE +23 -0
  189. package/.cache/typescript/5.3/node_modules/mime-types/README.md +113 -0
  190. package/.cache/typescript/5.3/node_modules/mime-types/index.js +188 -0
  191. package/.cache/typescript/5.3/node_modules/mime-types/package.json +44 -0
  192. package/.cache/typescript/5.3/node_modules/types-registry/README.md +2 -0
  193. package/.cache/typescript/5.3/node_modules/types-registry/index.json +1 -0
  194. package/.cache/typescript/5.3/node_modules/types-registry/package.json +20 -0
  195. package/.cache/typescript/5.3/node_modules/undici-types/README.md +6 -0
  196. package/.cache/typescript/5.3/node_modules/undici-types/agent.d.ts +31 -0
  197. package/.cache/typescript/5.3/node_modules/undici-types/api.d.ts +43 -0
  198. package/.cache/typescript/5.3/node_modules/undici-types/balanced-pool.d.ts +18 -0
  199. package/.cache/typescript/5.3/node_modules/undici-types/cache.d.ts +36 -0
  200. package/.cache/typescript/5.3/node_modules/undici-types/client.d.ts +97 -0
  201. package/.cache/typescript/5.3/node_modules/undici-types/connector.d.ts +34 -0
  202. package/.cache/typescript/5.3/node_modules/undici-types/content-type.d.ts +21 -0
  203. package/.cache/typescript/5.3/node_modules/undici-types/cookies.d.ts +28 -0
  204. package/.cache/typescript/5.3/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  205. package/.cache/typescript/5.3/node_modules/undici-types/dispatcher.d.ts +241 -0
  206. package/.cache/typescript/5.3/node_modules/undici-types/errors.d.ts +128 -0
  207. package/.cache/typescript/5.3/node_modules/undici-types/fetch.d.ts +209 -0
  208. package/.cache/typescript/5.3/node_modules/undici-types/file.d.ts +39 -0
  209. package/.cache/typescript/5.3/node_modules/undici-types/filereader.d.ts +54 -0
  210. package/.cache/typescript/5.3/node_modules/undici-types/formdata.d.ts +108 -0
  211. package/.cache/typescript/5.3/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  212. package/.cache/typescript/5.3/node_modules/undici-types/global-origin.d.ts +7 -0
  213. package/.cache/typescript/5.3/node_modules/undici-types/handlers.d.ts +9 -0
  214. package/.cache/typescript/5.3/node_modules/undici-types/header.d.ts +4 -0
  215. package/.cache/typescript/5.3/node_modules/undici-types/index.d.ts +63 -0
  216. package/.cache/typescript/5.3/node_modules/undici-types/interceptors.d.ts +5 -0
  217. package/.cache/typescript/5.3/node_modules/undici-types/mock-agent.d.ts +50 -0
  218. package/.cache/typescript/5.3/node_modules/undici-types/mock-client.d.ts +25 -0
  219. package/.cache/typescript/5.3/node_modules/undici-types/mock-errors.d.ts +12 -0
  220. package/.cache/typescript/5.3/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  221. package/.cache/typescript/5.3/node_modules/undici-types/mock-pool.d.ts +25 -0
  222. package/.cache/typescript/5.3/node_modules/undici-types/package.json +55 -0
  223. package/.cache/typescript/5.3/node_modules/undici-types/patch.d.ts +71 -0
  224. package/.cache/typescript/5.3/node_modules/undici-types/pool-stats.d.ts +19 -0
  225. package/.cache/typescript/5.3/node_modules/undici-types/pool.d.ts +28 -0
  226. package/.cache/typescript/5.3/node_modules/undici-types/proxy-agent.d.ts +30 -0
  227. package/.cache/typescript/5.3/node_modules/undici-types/readable.d.ts +61 -0
  228. package/.cache/typescript/5.3/node_modules/undici-types/webidl.d.ts +220 -0
  229. package/.cache/typescript/5.3/node_modules/undici-types/websocket.d.ts +131 -0
  230. package/.cache/typescript/5.3/package-lock.json +149 -0
  231. package/.cache/typescript/5.3/package.json +1 -0
  232. package/.replit +1 -0
  233. package/index.js +1 -0
  234. package/leiamnash/edit.js +59 -0
  235. package/package.json +1 -1
  236. package/.cache/replit/__replit_disk_meta.json +0 -1
  237. package/replit.nix +0 -6
@@ -0,0 +1,2362 @@
1
+ /**
2
+ * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
3
+ * Node.js APIs support `Buffer`s.
4
+ *
5
+ * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and
6
+ * extends it with methods that cover additional use cases. Node.js APIs accept
7
+ * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well.
8
+ *
9
+ * While the `Buffer` class is available within the global scope, it is still
10
+ * recommended to explicitly reference it via an import or require statement.
11
+ *
12
+ * ```js
13
+ * import { Buffer } from 'node:buffer';
14
+ *
15
+ * // Creates a zero-filled Buffer of length 10.
16
+ * const buf1 = Buffer.alloc(10);
17
+ *
18
+ * // Creates a Buffer of length 10,
19
+ * // filled with bytes which all have the value `1`.
20
+ * const buf2 = Buffer.alloc(10, 1);
21
+ *
22
+ * // Creates an uninitialized buffer of length 10.
23
+ * // This is faster than calling Buffer.alloc() but the returned
24
+ * // Buffer instance might contain old data that needs to be
25
+ * // overwritten using fill(), write(), or other functions that fill the Buffer's
26
+ * // contents.
27
+ * const buf3 = Buffer.allocUnsafe(10);
28
+ *
29
+ * // Creates a Buffer containing the bytes [1, 2, 3].
30
+ * const buf4 = Buffer.from([1, 2, 3]);
31
+ *
32
+ * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries
33
+ * // are all truncated using `(value & 255)` to fit into the range 0–255.
34
+ * const buf5 = Buffer.from([257, 257.5, -255, '1']);
35
+ *
36
+ * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':
37
+ * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)
38
+ * // [116, 195, 169, 115, 116] (in decimal notation)
39
+ * const buf6 = Buffer.from('tést');
40
+ *
41
+ * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
42
+ * const buf7 = Buffer.from('tést', 'latin1');
43
+ * ```
44
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js)
45
+ */
46
+ declare module "buffer" {
47
+ import { BinaryLike } from "node:crypto";
48
+ import { ReadableStream as WebReadableStream } from "node:stream/web";
49
+ /**
50
+ * This function returns `true` if `input` contains only valid UTF-8-encoded data,
51
+ * including the case in which `input` is empty.
52
+ *
53
+ * Throws if the `input` is a detached array buffer.
54
+ * @since v19.4.0, v18.14.0
55
+ * @param input The input to validate.
56
+ */
57
+ export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
58
+ /**
59
+ * This function returns `true` if `input` contains only valid ASCII-encoded data,
60
+ * including the case in which `input` is empty.
61
+ *
62
+ * Throws if the `input` is a detached array buffer.
63
+ * @since v19.6.0, v18.15.0
64
+ * @param input The input to validate.
65
+ */
66
+ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
67
+ export const INSPECT_MAX_BYTES: number;
68
+ export const kMaxLength: number;
69
+ export const kStringMaxLength: number;
70
+ export const constants: {
71
+ MAX_LENGTH: number;
72
+ MAX_STRING_LENGTH: number;
73
+ };
74
+ export type TranscodeEncoding =
75
+ | "ascii"
76
+ | "utf8"
77
+ | "utf-8"
78
+ | "utf16le"
79
+ | "utf-16le"
80
+ | "ucs2"
81
+ | "ucs-2"
82
+ | "latin1"
83
+ | "binary";
84
+ /**
85
+ * Re-encodes the given `Buffer` or `Uint8Array` instance from one character
86
+ * encoding to another. Returns a new `Buffer` instance.
87
+ *
88
+ * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
89
+ * conversion from `fromEnc` to `toEnc` is not permitted.
90
+ *
91
+ * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
92
+ *
93
+ * The transcoding process will use substitution characters if a given byte
94
+ * sequence cannot be adequately represented in the target encoding. For instance:
95
+ *
96
+ * ```js
97
+ * import { Buffer, transcode } from 'node:buffer';
98
+ *
99
+ * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');
100
+ * console.log(newBuf.toString('ascii'));
101
+ * // Prints: '?'
102
+ * ```
103
+ *
104
+ * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced
105
+ * with `?` in the transcoded `Buffer`.
106
+ * @since v7.1.0
107
+ * @param source A `Buffer` or `Uint8Array` instance.
108
+ * @param fromEnc The current encoding.
109
+ * @param toEnc To target encoding.
110
+ */
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
+ };
117
+ /**
118
+ * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
119
+ * a prior call to `URL.createObjectURL()`.
120
+ * @since v16.7.0
121
+ * @experimental
122
+ * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
123
+ */
124
+ export function resolveObjectURL(id: string): Blob | undefined;
125
+ export { Buffer };
126
+ /**
127
+ * @experimental
128
+ */
129
+ export interface BlobOptions {
130
+ /**
131
+ * @default 'utf8'
132
+ */
133
+ encoding?: BufferEncoding | undefined;
134
+ /**
135
+ * The Blob content-type. The intent is for `type` to convey
136
+ * the MIME media type of the data, however no validation of the type format
137
+ * is performed.
138
+ */
139
+ type?: string | undefined;
140
+ }
141
+ /**
142
+ * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
143
+ * multiple worker threads.
144
+ * @since v15.7.0, v14.18.0
145
+ */
146
+ export class Blob {
147
+ /**
148
+ * The total size of the `Blob` in bytes.
149
+ * @since v15.7.0, v14.18.0
150
+ */
151
+ readonly size: number;
152
+ /**
153
+ * The content-type of the `Blob`.
154
+ * @since v15.7.0, v14.18.0
155
+ */
156
+ readonly type: string;
157
+ /**
158
+ * Creates a new `Blob` object containing a concatenation of the given sources.
159
+ *
160
+ * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
161
+ * the 'Blob' and can therefore be safely modified after the 'Blob' is created.
162
+ *
163
+ * String sources are also copied into the `Blob`.
164
+ */
165
+ constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions);
166
+ /**
167
+ * 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
+ * the `Blob` data.
169
+ * @since v15.7.0, v14.18.0
170
+ */
171
+ arrayBuffer(): Promise<ArrayBuffer>;
172
+ /**
173
+ * Creates and returns a new `Blob` containing a subset of this `Blob` objects
174
+ * data. The original `Blob` is not altered.
175
+ * @since v15.7.0, v14.18.0
176
+ * @param start The starting index.
177
+ * @param end The ending index.
178
+ * @param type The content-type for the new `Blob`
179
+ */
180
+ slice(start?: number, end?: number, type?: string): Blob;
181
+ /**
182
+ * Returns a promise that fulfills with the contents of the `Blob` decoded as a
183
+ * UTF-8 string.
184
+ * @since v15.7.0, v14.18.0
185
+ */
186
+ text(): Promise<string>;
187
+ /**
188
+ * Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
189
+ * @since v16.7.0
190
+ */
191
+ stream(): WebReadableStream;
192
+ }
193
+ export interface FileOptions {
194
+ /**
195
+ * 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`.
197
+ */
198
+ endings?: "native" | "transparent";
199
+ /** The File content-type. */
200
+ type?: string;
201
+ /** The last modified date of the file. `Default`: Date.now(). */
202
+ lastModified?: number;
203
+ }
204
+ /**
205
+ * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
206
+ * @since v19.2.0, v18.13.0
207
+ */
208
+ export class File extends Blob {
209
+ constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
210
+ /**
211
+ * The name of the `File`.
212
+ * @since v19.2.0, v18.13.0
213
+ */
214
+ readonly name: string;
215
+ /**
216
+ * The last modified date of the `File`.
217
+ * @since v19.2.0, v18.13.0
218
+ */
219
+ readonly lastModified: number;
220
+ }
221
+ export import atob = globalThis.atob;
222
+ 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;
227
+ global {
228
+ namespace NodeJS {
229
+ export { BufferEncoding };
230
+ }
231
+ // Buffer class
232
+ type BufferEncoding =
233
+ | "ascii"
234
+ | "utf8"
235
+ | "utf-8"
236
+ | "utf16le"
237
+ | "utf-16le"
238
+ | "ucs2"
239
+ | "ucs-2"
240
+ | "base64"
241
+ | "base64url"
242
+ | "latin1"
243
+ | "binary"
244
+ | "hex";
245
+ type WithImplicitCoercion<T> =
246
+ | T
247
+ | {
248
+ valueOf(): T;
249
+ };
250
+ /**
251
+ * Raw data is stored in instances of the Buffer class.
252
+ * 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
+ * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
254
+ */
255
+ 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;
350
+ /**
351
+ * Returns `true` if `obj` is a `Buffer`, `false` otherwise.
352
+ *
353
+ * ```js
354
+ * import { Buffer } from 'node:buffer';
355
+ *
356
+ * Buffer.isBuffer(Buffer.alloc(10)); // true
357
+ * Buffer.isBuffer(Buffer.from('foo')); // true
358
+ * Buffer.isBuffer('a string'); // false
359
+ * Buffer.isBuffer([]); // false
360
+ * Buffer.isBuffer(new Uint8Array(1024)); // false
361
+ * ```
362
+ * @since v0.1.101
363
+ */
364
+ isBuffer(obj: any): obj is Buffer;
365
+ /**
366
+ * Returns `true` if `encoding` is the name of a supported character encoding,
367
+ * or `false` otherwise.
368
+ *
369
+ * ```js
370
+ * import { Buffer } from 'node:buffer';
371
+ *
372
+ * console.log(Buffer.isEncoding('utf8'));
373
+ * // Prints: true
374
+ *
375
+ * console.log(Buffer.isEncoding('hex'));
376
+ * // Prints: true
377
+ *
378
+ * console.log(Buffer.isEncoding('utf/8'));
379
+ * // Prints: false
380
+ *
381
+ * console.log(Buffer.isEncoding(''));
382
+ * // Prints: false
383
+ * ```
384
+ * @since v0.9.1
385
+ * @param encoding A character encoding name to check.
386
+ */
387
+ isEncoding(encoding: string): encoding is BufferEncoding;
388
+ /**
389
+ * Returns the byte length of a string when encoded using `encoding`.
390
+ * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account
391
+ * for the encoding that is used to convert the string into bytes.
392
+ *
393
+ * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input.
394
+ * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the
395
+ * return value might be greater than the length of a `Buffer` created from the
396
+ * string.
397
+ *
398
+ * ```js
399
+ * import { Buffer } from 'node:buffer';
400
+ *
401
+ * const str = '\u00bd + \u00bc = \u00be';
402
+ *
403
+ * console.log(`${str}: ${str.length} characters, ` +
404
+ * `${Buffer.byteLength(str, 'utf8')} bytes`);
405
+ * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes
406
+ * ```
407
+ *
408
+ * When `string` is a
409
+ * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/-
410
+ * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop-
411
+ * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned.
412
+ * @since v0.1.90
413
+ * @param string A value to calculate the length of.
414
+ * @param [encoding='utf8'] If `string` is a string, this is its encoding.
415
+ * @return The number of bytes contained within `string`.
416
+ */
417
+ byteLength(
418
+ string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
419
+ encoding?: BufferEncoding,
420
+ ): number;
421
+ /**
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)`.
479
+ *
480
+ * ```js
481
+ * import { Buffer } from 'node:buffer';
482
+ *
483
+ * const buf1 = Buffer.from('1234');
484
+ * const buf2 = Buffer.from('0123');
485
+ * const arr = [buf1, buf2];
486
+ *
487
+ * console.log(arr.sort(Buffer.compare));
488
+ * // Prints: [ <Buffer 30 31 32 33>, <Buffer 31 32 33 34> ]
489
+ * // (This result is equal to: [buf2, buf1].)
490
+ * ```
491
+ * @since v0.11.13
492
+ * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
493
+ */
494
+ 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`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
+ /**
625
+ * This is the size (in bytes) of pre-allocated internal `Buffer` instances used
626
+ * for pooling. This value may be modified.
627
+ * @since v0.11.3
628
+ */
629
+ poolSize: number;
630
+ }
631
+ interface Buffer extends Uint8Array {
632
+ /**
633
+ * 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
+ * not contain enough space to fit the entire string, only part of `string` will be
635
+ * written. However, partially encoded characters will not be written.
636
+ *
637
+ * ```js
638
+ * import { Buffer } from 'node:buffer';
639
+ *
640
+ * const buf = Buffer.alloc(256);
641
+ *
642
+ * const len = buf.write('\u00bd + \u00bc = \u00be', 0);
643
+ *
644
+ * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
645
+ * // Prints: 12 bytes: ½ + ¼ = ¾
646
+ *
647
+ * const buffer = Buffer.alloc(10);
648
+ *
649
+ * const length = buffer.write('abcd', 8);
650
+ *
651
+ * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
652
+ * // Prints: 2 bytes : ab
653
+ * ```
654
+ * @since v0.1.90
655
+ * @param string String to write to `buf`.
656
+ * @param [offset=0] Number of bytes to skip before starting to write `string`.
657
+ * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`).
658
+ * @param [encoding='utf8'] The character encoding of `string`.
659
+ * @return Number of bytes written.
660
+ */
661
+ write(string: string, encoding?: BufferEncoding): number;
662
+ write(string: string, offset: number, encoding?: BufferEncoding): number;
663
+ write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
664
+ /**
665
+ * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`.
666
+ *
667
+ * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8,
668
+ * then each invalid byte is replaced with the replacement character `U+FFFD`.
669
+ *
670
+ * The maximum length of a string instance (in UTF-16 code units) is available
671
+ * as {@link constants.MAX_STRING_LENGTH}.
672
+ *
673
+ * ```js
674
+ * import { Buffer } from 'node:buffer';
675
+ *
676
+ * const buf1 = Buffer.allocUnsafe(26);
677
+ *
678
+ * for (let i = 0; i < 26; i++) {
679
+ * // 97 is the decimal ASCII value for 'a'.
680
+ * buf1[i] = i + 97;
681
+ * }
682
+ *
683
+ * console.log(buf1.toString('utf8'));
684
+ * // Prints: abcdefghijklmnopqrstuvwxyz
685
+ * console.log(buf1.toString('utf8', 0, 5));
686
+ * // Prints: abcde
687
+ *
688
+ * const buf2 = Buffer.from('tést');
689
+ *
690
+ * console.log(buf2.toString('hex'));
691
+ * // Prints: 74c3a97374
692
+ * console.log(buf2.toString('utf8', 0, 3));
693
+ * // Prints: té
694
+ * console.log(buf2.toString(undefined, 0, 3));
695
+ * // Prints: té
696
+ * ```
697
+ * @since v0.1.90
698
+ * @param [encoding='utf8'] The character encoding to use.
699
+ * @param [start=0] The byte offset to start decoding at.
700
+ * @param [end=buf.length] The byte offset to stop decoding at (not inclusive).
701
+ */
702
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
703
+ /**
704
+ * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls
705
+ * this function when stringifying a `Buffer` instance.
706
+ *
707
+ * `Buffer.from()` accepts objects in the format returned from this method.
708
+ * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`.
709
+ *
710
+ * ```js
711
+ * import { Buffer } from 'node:buffer';
712
+ *
713
+ * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
714
+ * const json = JSON.stringify(buf);
715
+ *
716
+ * console.log(json);
717
+ * // Prints: {"type":"Buffer","data":[1,2,3,4,5]}
718
+ *
719
+ * const copy = JSON.parse(json, (key, value) => {
720
+ * return value &#x26;&#x26; value.type === 'Buffer' ?
721
+ * Buffer.from(value) :
722
+ * value;
723
+ * });
724
+ *
725
+ * console.log(copy);
726
+ * // Prints: <Buffer 01 02 03 04 05>
727
+ * ```
728
+ * @since v0.9.2
729
+ */
730
+ toJSON(): {
731
+ type: "Buffer";
732
+ data: number[];
733
+ };
734
+ /**
735
+ * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
736
+ *
737
+ * ```js
738
+ * import { Buffer } from 'node:buffer';
739
+ *
740
+ * const buf1 = Buffer.from('ABC');
741
+ * const buf2 = Buffer.from('414243', 'hex');
742
+ * const buf3 = Buffer.from('ABCD');
743
+ *
744
+ * console.log(buf1.equals(buf2));
745
+ * // Prints: true
746
+ * console.log(buf1.equals(buf3));
747
+ * // Prints: false
748
+ * ```
749
+ * @since v0.11.13
750
+ * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`.
751
+ */
752
+ equals(otherBuffer: Uint8Array): boolean;
753
+ /**
754
+ * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order.
755
+ * Comparison is based on the actual sequence of bytes in each `Buffer`.
756
+ *
757
+ * * `0` is returned if `target` is the same as `buf`
758
+ * * `1` is returned if `target` should come _before_`buf` when sorted.
759
+ * * `-1` is returned if `target` should come _after_`buf` when sorted.
760
+ *
761
+ * ```js
762
+ * import { Buffer } from 'node:buffer';
763
+ *
764
+ * const buf1 = Buffer.from('ABC');
765
+ * const buf2 = Buffer.from('BCD');
766
+ * const buf3 = Buffer.from('ABCD');
767
+ *
768
+ * console.log(buf1.compare(buf1));
769
+ * // Prints: 0
770
+ * console.log(buf1.compare(buf2));
771
+ * // Prints: -1
772
+ * console.log(buf1.compare(buf3));
773
+ * // Prints: -1
774
+ * console.log(buf2.compare(buf1));
775
+ * // Prints: 1
776
+ * console.log(buf2.compare(buf3));
777
+ * // Prints: 1
778
+ * console.log([buf1, buf2, buf3].sort(Buffer.compare));
779
+ * // Prints: [ <Buffer 41 42 43>, <Buffer 41 42 43 44>, <Buffer 42 43 44> ]
780
+ * // (This result is equal to: [buf1, buf3, buf2].)
781
+ * ```
782
+ *
783
+ * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
784
+ *
785
+ * ```js
786
+ * import { Buffer } from 'node:buffer';
787
+ *
788
+ * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
789
+ * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
790
+ *
791
+ * console.log(buf1.compare(buf2, 5, 9, 0, 4));
792
+ * // Prints: 0
793
+ * console.log(buf1.compare(buf2, 0, 6, 4));
794
+ * // Prints: -1
795
+ * console.log(buf1.compare(buf2, 5, 6, 5));
796
+ * // Prints: 1
797
+ * ```
798
+ *
799
+ * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
800
+ * @since v0.11.13
801
+ * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
802
+ * @param [targetStart=0] The offset within `target` at which to begin comparison.
803
+ * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive).
804
+ * @param [sourceStart=0] The offset within `buf` at which to begin comparison.
805
+ * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
806
+ */
807
+ compare(
808
+ target: Uint8Array,
809
+ targetStart?: number,
810
+ targetEnd?: number,
811
+ sourceStart?: number,
812
+ sourceEnd?: number,
813
+ ): -1 | 0 | 1;
814
+ /**
815
+ * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
816
+ *
817
+ * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available
818
+ * for all TypedArrays, including Node.js `Buffer`s, although it takes
819
+ * different function arguments.
820
+ *
821
+ * ```js
822
+ * import { Buffer } from 'node:buffer';
823
+ *
824
+ * // Create two `Buffer` instances.
825
+ * const buf1 = Buffer.allocUnsafe(26);
826
+ * const buf2 = Buffer.allocUnsafe(26).fill('!');
827
+ *
828
+ * for (let i = 0; i < 26; i++) {
829
+ * // 97 is the decimal ASCII value for 'a'.
830
+ * buf1[i] = i + 97;
831
+ * }
832
+ *
833
+ * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.
834
+ * buf1.copy(buf2, 8, 16, 20);
835
+ * // This is equivalent to:
836
+ * // buf2.set(buf1.subarray(16, 20), 8);
837
+ *
838
+ * console.log(buf2.toString('ascii', 0, 25));
839
+ * // Prints: !!!!!!!!qrst!!!!!!!!!!!!!
840
+ * ```
841
+ *
842
+ * ```js
843
+ * import { Buffer } from 'node:buffer';
844
+ *
845
+ * // Create a `Buffer` and copy data from one region to an overlapping region
846
+ * // within the same `Buffer`.
847
+ *
848
+ * const buf = Buffer.allocUnsafe(26);
849
+ *
850
+ * for (let i = 0; i < 26; i++) {
851
+ * // 97 is the decimal ASCII value for 'a'.
852
+ * buf[i] = i + 97;
853
+ * }
854
+ *
855
+ * buf.copy(buf, 0, 4, 10);
856
+ *
857
+ * console.log(buf.toString());
858
+ * // Prints: efghijghijklmnopqrstuvwxyz
859
+ * ```
860
+ * @since v0.1.90
861
+ * @param target A `Buffer` or {@link Uint8Array} to copy into.
862
+ * @param [targetStart=0] The offset within `target` at which to begin writing.
863
+ * @param [sourceStart=0] The offset within `buf` from which to begin copying.
864
+ * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive).
865
+ * @return The number of bytes copied.
866
+ */
867
+ 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
+ /**
963
+ * Writes `value` to `buf` at the specified `offset` as big-endian.
964
+ *
965
+ * `value` is interpreted and written as a two's complement signed integer.
966
+ *
967
+ * ```js
968
+ * import { Buffer } from 'node:buffer';
969
+ *
970
+ * const buf = Buffer.allocUnsafe(8);
971
+ *
972
+ * buf.writeBigInt64BE(0x0102030405060708n, 0);
973
+ *
974
+ * console.log(buf);
975
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
976
+ * ```
977
+ * @since v12.0.0, v10.20.0
978
+ * @param value Number to be written to `buf`.
979
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
980
+ * @return `offset` plus the number of bytes written.
981
+ */
982
+ writeBigInt64BE(value: bigint, offset?: number): number;
983
+ /**
984
+ * Writes `value` to `buf` at the specified `offset` as little-endian.
985
+ *
986
+ * `value` is interpreted and written as a two's complement signed integer.
987
+ *
988
+ * ```js
989
+ * import { Buffer } from 'node:buffer';
990
+ *
991
+ * const buf = Buffer.allocUnsafe(8);
992
+ *
993
+ * buf.writeBigInt64LE(0x0102030405060708n, 0);
994
+ *
995
+ * console.log(buf);
996
+ * // Prints: <Buffer 08 07 06 05 04 03 02 01>
997
+ * ```
998
+ * @since v12.0.0, v10.20.0
999
+ * @param value Number to be written to `buf`.
1000
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
1001
+ * @return `offset` plus the number of bytes written.
1002
+ */
1003
+ writeBigInt64LE(value: bigint, offset?: number): number;
1004
+ /**
1005
+ * Writes `value` to `buf` at the specified `offset` as big-endian.
1006
+ *
1007
+ * This function is also available under the `writeBigUint64BE` alias.
1008
+ *
1009
+ * ```js
1010
+ * import { Buffer } from 'node:buffer';
1011
+ *
1012
+ * const buf = Buffer.allocUnsafe(8);
1013
+ *
1014
+ * buf.writeBigUInt64BE(0xdecafafecacefaden, 0);
1015
+ *
1016
+ * console.log(buf);
1017
+ * // Prints: <Buffer de ca fa fe ca ce fa de>
1018
+ * ```
1019
+ * @since v12.0.0, v10.20.0
1020
+ * @param value Number to be written to `buf`.
1021
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
1022
+ * @return `offset` plus the number of bytes written.
1023
+ */
1024
+ writeBigUInt64BE(value: bigint, offset?: number): number;
1025
+ /**
1026
+ * @alias Buffer.writeBigUInt64BE
1027
+ * @since v14.10.0, v12.19.0
1028
+ */
1029
+ writeBigUint64BE(value: bigint, offset?: number): number;
1030
+ /**
1031
+ * Writes `value` to `buf` at the specified `offset` as little-endian
1032
+ *
1033
+ * ```js
1034
+ * import { Buffer } from 'node:buffer';
1035
+ *
1036
+ * const buf = Buffer.allocUnsafe(8);
1037
+ *
1038
+ * buf.writeBigUInt64LE(0xdecafafecacefaden, 0);
1039
+ *
1040
+ * console.log(buf);
1041
+ * // Prints: <Buffer de fa ce ca fe fa ca de>
1042
+ * ```
1043
+ *
1044
+ * This function is also available under the `writeBigUint64LE` alias.
1045
+ * @since v12.0.0, v10.20.0
1046
+ * @param value Number to be written to `buf`.
1047
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
1048
+ * @return `offset` plus the number of bytes written.
1049
+ */
1050
+ writeBigUInt64LE(value: bigint, offset?: number): number;
1051
+ /**
1052
+ * @alias Buffer.writeBigUInt64LE
1053
+ * @since v14.10.0, v12.19.0
1054
+ */
1055
+ writeBigUint64LE(value: bigint, offset?: number): number;
1056
+ /**
1057
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
1058
+ * when `value` is anything other than an unsigned integer.
1059
+ *
1060
+ * This function is also available under the `writeUintLE` alias.
1061
+ *
1062
+ * ```js
1063
+ * import { Buffer } from 'node:buffer';
1064
+ *
1065
+ * const buf = Buffer.allocUnsafe(6);
1066
+ *
1067
+ * buf.writeUIntLE(0x1234567890ab, 0, 6);
1068
+ *
1069
+ * console.log(buf);
1070
+ * // Prints: <Buffer ab 90 78 56 34 12>
1071
+ * ```
1072
+ * @since v0.5.5
1073
+ * @param value Number to be written to `buf`.
1074
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
1075
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
1076
+ * @return `offset` plus the number of bytes written.
1077
+ */
1078
+ writeUIntLE(value: number, offset: number, byteLength: number): number;
1079
+ /**
1080
+ * @alias Buffer.writeUIntLE
1081
+ * @since v14.9.0, v12.19.0
1082
+ */
1083
+ writeUintLE(value: number, offset: number, byteLength: number): number;
1084
+ /**
1085
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined
1086
+ * when `value` is anything other than an unsigned integer.
1087
+ *
1088
+ * This function is also available under the `writeUintBE` alias.
1089
+ *
1090
+ * ```js
1091
+ * import { Buffer } from 'node:buffer';
1092
+ *
1093
+ * const buf = Buffer.allocUnsafe(6);
1094
+ *
1095
+ * buf.writeUIntBE(0x1234567890ab, 0, 6);
1096
+ *
1097
+ * console.log(buf);
1098
+ * // Prints: <Buffer 12 34 56 78 90 ab>
1099
+ * ```
1100
+ * @since v0.5.5
1101
+ * @param value Number to be written to `buf`.
1102
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
1103
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
1104
+ * @return `offset` plus the number of bytes written.
1105
+ */
1106
+ writeUIntBE(value: number, offset: number, byteLength: number): number;
1107
+ /**
1108
+ * @alias Buffer.writeUIntBE
1109
+ * @since v14.9.0, v12.19.0
1110
+ */
1111
+ writeUintBE(value: number, offset: number, byteLength: number): number;
1112
+ /**
1113
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
1114
+ * when `value` is anything other than a signed integer.
1115
+ *
1116
+ * ```js
1117
+ * import { Buffer } from 'node:buffer';
1118
+ *
1119
+ * const buf = Buffer.allocUnsafe(6);
1120
+ *
1121
+ * buf.writeIntLE(0x1234567890ab, 0, 6);
1122
+ *
1123
+ * console.log(buf);
1124
+ * // Prints: <Buffer ab 90 78 56 34 12>
1125
+ * ```
1126
+ * @since v0.11.15
1127
+ * @param value Number to be written to `buf`.
1128
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
1129
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
1130
+ * @return `offset` plus the number of bytes written.
1131
+ */
1132
+ writeIntLE(value: number, offset: number, byteLength: number): number;
1133
+ /**
1134
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a
1135
+ * signed integer.
1136
+ *
1137
+ * ```js
1138
+ * import { Buffer } from 'node:buffer';
1139
+ *
1140
+ * const buf = Buffer.allocUnsafe(6);
1141
+ *
1142
+ * buf.writeIntBE(0x1234567890ab, 0, 6);
1143
+ *
1144
+ * console.log(buf);
1145
+ * // Prints: <Buffer 12 34 56 78 90 ab>
1146
+ * ```
1147
+ * @since v0.11.15
1148
+ * @param value Number to be written to `buf`.
1149
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
1150
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
1151
+ * @return `offset` plus the number of bytes written.
1152
+ */
1153
+ writeIntBE(value: number, offset: number, byteLength: number): number;
1154
+ /**
1155
+ * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`.
1156
+ *
1157
+ * This function is also available under the `readBigUint64BE` alias.
1158
+ *
1159
+ * ```js
1160
+ * import { Buffer } from 'node:buffer';
1161
+ *
1162
+ * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1163
+ *
1164
+ * console.log(buf.readBigUInt64BE(0));
1165
+ * // Prints: 4294967295n
1166
+ * ```
1167
+ * @since v12.0.0, v10.20.0
1168
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1169
+ */
1170
+ readBigUInt64BE(offset?: number): bigint;
1171
+ /**
1172
+ * @alias Buffer.readBigUInt64BE
1173
+ * @since v14.10.0, v12.19.0
1174
+ */
1175
+ readBigUint64BE(offset?: number): bigint;
1176
+ /**
1177
+ * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`.
1178
+ *
1179
+ * This function is also available under the `readBigUint64LE` alias.
1180
+ *
1181
+ * ```js
1182
+ * import { Buffer } from 'node:buffer';
1183
+ *
1184
+ * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1185
+ *
1186
+ * console.log(buf.readBigUInt64LE(0));
1187
+ * // Prints: 18446744069414584320n
1188
+ * ```
1189
+ * @since v12.0.0, v10.20.0
1190
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1191
+ */
1192
+ readBigUInt64LE(offset?: number): bigint;
1193
+ /**
1194
+ * @alias Buffer.readBigUInt64LE
1195
+ * @since v14.10.0, v12.19.0
1196
+ */
1197
+ readBigUint64LE(offset?: number): bigint;
1198
+ /**
1199
+ * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`.
1200
+ *
1201
+ * Integers read from a `Buffer` are interpreted as two's complement signed
1202
+ * values.
1203
+ * @since v12.0.0, v10.20.0
1204
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1205
+ */
1206
+ readBigInt64BE(offset?: number): bigint;
1207
+ /**
1208
+ * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`.
1209
+ *
1210
+ * Integers read from a `Buffer` are interpreted as two's complement signed
1211
+ * values.
1212
+ * @since v12.0.0, v10.20.0
1213
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1214
+ */
1215
+ readBigInt64LE(offset?: number): bigint;
1216
+ /**
1217
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
1218
+ * up to 48 bits of accuracy.
1219
+ *
1220
+ * This function is also available under the `readUintLE` alias.
1221
+ *
1222
+ * ```js
1223
+ * import { Buffer } from 'node:buffer';
1224
+ *
1225
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1226
+ *
1227
+ * console.log(buf.readUIntLE(0, 6).toString(16));
1228
+ * // Prints: ab9078563412
1229
+ * ```
1230
+ * @since v0.11.15
1231
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1232
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1233
+ */
1234
+ readUIntLE(offset: number, byteLength: number): number;
1235
+ /**
1236
+ * @alias Buffer.readUIntLE
1237
+ * @since v14.9.0, v12.19.0
1238
+ */
1239
+ readUintLE(offset: number, byteLength: number): number;
1240
+ /**
1241
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
1242
+ * up to 48 bits of accuracy.
1243
+ *
1244
+ * This function is also available under the `readUintBE` alias.
1245
+ *
1246
+ * ```js
1247
+ * import { Buffer } from 'node:buffer';
1248
+ *
1249
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1250
+ *
1251
+ * console.log(buf.readUIntBE(0, 6).toString(16));
1252
+ * // Prints: 1234567890ab
1253
+ * console.log(buf.readUIntBE(1, 6).toString(16));
1254
+ * // Throws ERR_OUT_OF_RANGE.
1255
+ * ```
1256
+ * @since v0.11.15
1257
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1258
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1259
+ */
1260
+ readUIntBE(offset: number, byteLength: number): number;
1261
+ /**
1262
+ * @alias Buffer.readUIntBE
1263
+ * @since v14.9.0, v12.19.0
1264
+ */
1265
+ readUintBE(offset: number, byteLength: number): number;
1266
+ /**
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
1268
+ * supporting up to 48 bits of accuracy.
1269
+ *
1270
+ * ```js
1271
+ * import { Buffer } from 'node:buffer';
1272
+ *
1273
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1274
+ *
1275
+ * console.log(buf.readIntLE(0, 6).toString(16));
1276
+ * // Prints: -546f87a9cbee
1277
+ * ```
1278
+ * @since v0.11.15
1279
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1280
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1281
+ */
1282
+ readIntLE(offset: number, byteLength: number): number;
1283
+ /**
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
1285
+ * supporting up to 48 bits of accuracy.
1286
+ *
1287
+ * ```js
1288
+ * import { Buffer } from 'node:buffer';
1289
+ *
1290
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1291
+ *
1292
+ * console.log(buf.readIntBE(0, 6).toString(16));
1293
+ * // Prints: 1234567890ab
1294
+ * console.log(buf.readIntBE(1, 6).toString(16));
1295
+ * // Throws ERR_OUT_OF_RANGE.
1296
+ * console.log(buf.readIntBE(1, 0).toString(16));
1297
+ * // Throws ERR_OUT_OF_RANGE.
1298
+ * ```
1299
+ * @since v0.11.15
1300
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1301
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1302
+ */
1303
+ readIntBE(offset: number, byteLength: number): number;
1304
+ /**
1305
+ * Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
1306
+ *
1307
+ * This function is also available under the `readUint8` alias.
1308
+ *
1309
+ * ```js
1310
+ * import { Buffer } from 'node:buffer';
1311
+ *
1312
+ * const buf = Buffer.from([1, -2]);
1313
+ *
1314
+ * console.log(buf.readUInt8(0));
1315
+ * // Prints: 1
1316
+ * console.log(buf.readUInt8(1));
1317
+ * // Prints: 254
1318
+ * console.log(buf.readUInt8(2));
1319
+ * // Throws ERR_OUT_OF_RANGE.
1320
+ * ```
1321
+ * @since v0.5.0
1322
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
1323
+ */
1324
+ readUInt8(offset?: number): number;
1325
+ /**
1326
+ * @alias Buffer.readUInt8
1327
+ * @since v14.9.0, v12.19.0
1328
+ */
1329
+ readUint8(offset?: number): number;
1330
+ /**
1331
+ * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
1332
+ *
1333
+ * This function is also available under the `readUint16LE` alias.
1334
+ *
1335
+ * ```js
1336
+ * import { Buffer } from 'node:buffer';
1337
+ *
1338
+ * const buf = Buffer.from([0x12, 0x34, 0x56]);
1339
+ *
1340
+ * console.log(buf.readUInt16LE(0).toString(16));
1341
+ * // Prints: 3412
1342
+ * console.log(buf.readUInt16LE(1).toString(16));
1343
+ * // Prints: 5634
1344
+ * console.log(buf.readUInt16LE(2).toString(16));
1345
+ * // Throws ERR_OUT_OF_RANGE.
1346
+ * ```
1347
+ * @since v0.5.5
1348
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1349
+ */
1350
+ readUInt16LE(offset?: number): number;
1351
+ /**
1352
+ * @alias Buffer.readUInt16LE
1353
+ * @since v14.9.0, v12.19.0
1354
+ */
1355
+ readUint16LE(offset?: number): number;
1356
+ /**
1357
+ * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`.
1358
+ *
1359
+ * This function is also available under the `readUint16BE` alias.
1360
+ *
1361
+ * ```js
1362
+ * import { Buffer } from 'node:buffer';
1363
+ *
1364
+ * const buf = Buffer.from([0x12, 0x34, 0x56]);
1365
+ *
1366
+ * console.log(buf.readUInt16BE(0).toString(16));
1367
+ * // Prints: 1234
1368
+ * console.log(buf.readUInt16BE(1).toString(16));
1369
+ * // Prints: 3456
1370
+ * ```
1371
+ * @since v0.5.5
1372
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1373
+ */
1374
+ readUInt16BE(offset?: number): number;
1375
+ /**
1376
+ * @alias Buffer.readUInt16BE
1377
+ * @since v14.9.0, v12.19.0
1378
+ */
1379
+ readUint16BE(offset?: number): number;
1380
+ /**
1381
+ * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`.
1382
+ *
1383
+ * This function is also available under the `readUint32LE` alias.
1384
+ *
1385
+ * ```js
1386
+ * import { Buffer } from 'node:buffer';
1387
+ *
1388
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1389
+ *
1390
+ * console.log(buf.readUInt32LE(0).toString(16));
1391
+ * // Prints: 78563412
1392
+ * console.log(buf.readUInt32LE(1).toString(16));
1393
+ * // Throws ERR_OUT_OF_RANGE.
1394
+ * ```
1395
+ * @since v0.5.5
1396
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1397
+ */
1398
+ readUInt32LE(offset?: number): number;
1399
+ /**
1400
+ * @alias Buffer.readUInt32LE
1401
+ * @since v14.9.0, v12.19.0
1402
+ */
1403
+ readUint32LE(offset?: number): number;
1404
+ /**
1405
+ * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`.
1406
+ *
1407
+ * This function is also available under the `readUint32BE` alias.
1408
+ *
1409
+ * ```js
1410
+ * import { Buffer } from 'node:buffer';
1411
+ *
1412
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1413
+ *
1414
+ * console.log(buf.readUInt32BE(0).toString(16));
1415
+ * // Prints: 12345678
1416
+ * ```
1417
+ * @since v0.5.5
1418
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1419
+ */
1420
+ readUInt32BE(offset?: number): number;
1421
+ /**
1422
+ * @alias Buffer.readUInt32BE
1423
+ * @since v14.9.0, v12.19.0
1424
+ */
1425
+ readUint32BE(offset?: number): number;
1426
+ /**
1427
+ * Reads a signed 8-bit integer from `buf` at the specified `offset`.
1428
+ *
1429
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1430
+ *
1431
+ * ```js
1432
+ * import { Buffer } from 'node:buffer';
1433
+ *
1434
+ * const buf = Buffer.from([-1, 5]);
1435
+ *
1436
+ * console.log(buf.readInt8(0));
1437
+ * // Prints: -1
1438
+ * console.log(buf.readInt8(1));
1439
+ * // Prints: 5
1440
+ * console.log(buf.readInt8(2));
1441
+ * // Throws ERR_OUT_OF_RANGE.
1442
+ * ```
1443
+ * @since v0.5.0
1444
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
1445
+ */
1446
+ readInt8(offset?: number): number;
1447
+ /**
1448
+ * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`.
1449
+ *
1450
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1451
+ *
1452
+ * ```js
1453
+ * import { Buffer } from 'node:buffer';
1454
+ *
1455
+ * const buf = Buffer.from([0, 5]);
1456
+ *
1457
+ * console.log(buf.readInt16LE(0));
1458
+ * // Prints: 1280
1459
+ * console.log(buf.readInt16LE(1));
1460
+ * // Throws ERR_OUT_OF_RANGE.
1461
+ * ```
1462
+ * @since v0.5.5
1463
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1464
+ */
1465
+ readInt16LE(offset?: number): number;
1466
+ /**
1467
+ * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`.
1468
+ *
1469
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1470
+ *
1471
+ * ```js
1472
+ * import { Buffer } from 'node:buffer';
1473
+ *
1474
+ * const buf = Buffer.from([0, 5]);
1475
+ *
1476
+ * console.log(buf.readInt16BE(0));
1477
+ * // Prints: 5
1478
+ * ```
1479
+ * @since v0.5.5
1480
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1481
+ */
1482
+ readInt16BE(offset?: number): number;
1483
+ /**
1484
+ * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`.
1485
+ *
1486
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1487
+ *
1488
+ * ```js
1489
+ * import { Buffer } from 'node:buffer';
1490
+ *
1491
+ * const buf = Buffer.from([0, 0, 0, 5]);
1492
+ *
1493
+ * console.log(buf.readInt32LE(0));
1494
+ * // Prints: 83886080
1495
+ * console.log(buf.readInt32LE(1));
1496
+ * // Throws ERR_OUT_OF_RANGE.
1497
+ * ```
1498
+ * @since v0.5.5
1499
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1500
+ */
1501
+ readInt32LE(offset?: number): number;
1502
+ /**
1503
+ * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`.
1504
+ *
1505
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1506
+ *
1507
+ * ```js
1508
+ * import { Buffer } from 'node:buffer';
1509
+ *
1510
+ * const buf = Buffer.from([0, 0, 0, 5]);
1511
+ *
1512
+ * console.log(buf.readInt32BE(0));
1513
+ * // Prints: 5
1514
+ * ```
1515
+ * @since v0.5.5
1516
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1517
+ */
1518
+ readInt32BE(offset?: number): number;
1519
+ /**
1520
+ * Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
1521
+ *
1522
+ * ```js
1523
+ * import { Buffer } from 'node:buffer';
1524
+ *
1525
+ * const buf = Buffer.from([1, 2, 3, 4]);
1526
+ *
1527
+ * console.log(buf.readFloatLE(0));
1528
+ * // Prints: 1.539989614439558e-36
1529
+ * console.log(buf.readFloatLE(1));
1530
+ * // Throws ERR_OUT_OF_RANGE.
1531
+ * ```
1532
+ * @since v0.11.15
1533
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1534
+ */
1535
+ readFloatLE(offset?: number): number;
1536
+ /**
1537
+ * Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
1538
+ *
1539
+ * ```js
1540
+ * import { Buffer } from 'node:buffer';
1541
+ *
1542
+ * const buf = Buffer.from([1, 2, 3, 4]);
1543
+ *
1544
+ * console.log(buf.readFloatBE(0));
1545
+ * // Prints: 2.387939260590663e-38
1546
+ * ```
1547
+ * @since v0.11.15
1548
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1549
+ */
1550
+ readFloatBE(offset?: number): number;
1551
+ /**
1552
+ * Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
1553
+ *
1554
+ * ```js
1555
+ * import { Buffer } from 'node:buffer';
1556
+ *
1557
+ * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1558
+ *
1559
+ * console.log(buf.readDoubleLE(0));
1560
+ * // Prints: 5.447603722011605e-270
1561
+ * console.log(buf.readDoubleLE(1));
1562
+ * // Throws ERR_OUT_OF_RANGE.
1563
+ * ```
1564
+ * @since v0.11.15
1565
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
1566
+ */
1567
+ readDoubleLE(offset?: number): number;
1568
+ /**
1569
+ * Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
1570
+ *
1571
+ * ```js
1572
+ * import { Buffer } from 'node:buffer';
1573
+ *
1574
+ * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1575
+ *
1576
+ * console.log(buf.readDoubleBE(0));
1577
+ * // Prints: 8.20788039913184e-304
1578
+ * ```
1579
+ * @since v0.11.15
1580
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
1581
+ */
1582
+ readDoubleBE(offset?: number): number;
1583
+ reverse(): this;
1584
+ /**
1585
+ * Interprets `buf` as an array of unsigned 16-bit integers and swaps the
1586
+ * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
1587
+ *
1588
+ * ```js
1589
+ * import { Buffer } from 'node:buffer';
1590
+ *
1591
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1592
+ *
1593
+ * console.log(buf1);
1594
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1595
+ *
1596
+ * buf1.swap16();
1597
+ *
1598
+ * console.log(buf1);
1599
+ * // Prints: <Buffer 02 01 04 03 06 05 08 07>
1600
+ *
1601
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1602
+ *
1603
+ * buf2.swap16();
1604
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1605
+ * ```
1606
+ *
1607
+ * One convenient use of `buf.swap16()` is to perform a fast in-place conversion
1608
+ * between UTF-16 little-endian and UTF-16 big-endian:
1609
+ *
1610
+ * ```js
1611
+ * import { Buffer } from 'node:buffer';
1612
+ *
1613
+ * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
1614
+ * buf.swap16(); // Convert to big-endian UTF-16 text.
1615
+ * ```
1616
+ * @since v5.10.0
1617
+ * @return A reference to `buf`.
1618
+ */
1619
+ swap16(): Buffer;
1620
+ /**
1621
+ * Interprets `buf` as an array of unsigned 32-bit integers and swaps the
1622
+ * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
1623
+ *
1624
+ * ```js
1625
+ * import { Buffer } from 'node:buffer';
1626
+ *
1627
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1628
+ *
1629
+ * console.log(buf1);
1630
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1631
+ *
1632
+ * buf1.swap32();
1633
+ *
1634
+ * console.log(buf1);
1635
+ * // Prints: <Buffer 04 03 02 01 08 07 06 05>
1636
+ *
1637
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1638
+ *
1639
+ * buf2.swap32();
1640
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1641
+ * ```
1642
+ * @since v5.10.0
1643
+ * @return A reference to `buf`.
1644
+ */
1645
+ swap32(): Buffer;
1646
+ /**
1647
+ * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
1648
+ * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
1649
+ *
1650
+ * ```js
1651
+ * import { Buffer } from 'node:buffer';
1652
+ *
1653
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1654
+ *
1655
+ * console.log(buf1);
1656
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1657
+ *
1658
+ * buf1.swap64();
1659
+ *
1660
+ * console.log(buf1);
1661
+ * // Prints: <Buffer 08 07 06 05 04 03 02 01>
1662
+ *
1663
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1664
+ *
1665
+ * buf2.swap64();
1666
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1667
+ * ```
1668
+ * @since v6.3.0
1669
+ * @return A reference to `buf`.
1670
+ */
1671
+ swap64(): Buffer;
1672
+ /**
1673
+ * Writes `value` to `buf` at the specified `offset`. `value` must be a
1674
+ * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
1675
+ * other than an unsigned 8-bit integer.
1676
+ *
1677
+ * This function is also available under the `writeUint8` alias.
1678
+ *
1679
+ * ```js
1680
+ * import { Buffer } from 'node:buffer';
1681
+ *
1682
+ * const buf = Buffer.allocUnsafe(4);
1683
+ *
1684
+ * buf.writeUInt8(0x3, 0);
1685
+ * buf.writeUInt8(0x4, 1);
1686
+ * buf.writeUInt8(0x23, 2);
1687
+ * buf.writeUInt8(0x42, 3);
1688
+ *
1689
+ * console.log(buf);
1690
+ * // Prints: <Buffer 03 04 23 42>
1691
+ * ```
1692
+ * @since v0.5.0
1693
+ * @param value Number to be written to `buf`.
1694
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
1695
+ * @return `offset` plus the number of bytes written.
1696
+ */
1697
+ writeUInt8(value: number, offset?: number): number;
1698
+ /**
1699
+ * @alias Buffer.writeUInt8
1700
+ * @since v14.9.0, v12.19.0
1701
+ */
1702
+ writeUint8(value: number, offset?: number): number;
1703
+ /**
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
1705
+ * anything other than an unsigned 16-bit integer.
1706
+ *
1707
+ * This function is also available under the `writeUint16LE` alias.
1708
+ *
1709
+ * ```js
1710
+ * import { Buffer } from 'node:buffer';
1711
+ *
1712
+ * const buf = Buffer.allocUnsafe(4);
1713
+ *
1714
+ * buf.writeUInt16LE(0xdead, 0);
1715
+ * buf.writeUInt16LE(0xbeef, 2);
1716
+ *
1717
+ * console.log(buf);
1718
+ * // Prints: <Buffer ad de ef be>
1719
+ * ```
1720
+ * @since v0.5.5
1721
+ * @param value Number to be written to `buf`.
1722
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1723
+ * @return `offset` plus the number of bytes written.
1724
+ */
1725
+ writeUInt16LE(value: number, offset?: number): number;
1726
+ /**
1727
+ * @alias Buffer.writeUInt16LE
1728
+ * @since v14.9.0, v12.19.0
1729
+ */
1730
+ writeUint16LE(value: number, offset?: number): number;
1731
+ /**
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
1733
+ * unsigned 16-bit integer.
1734
+ *
1735
+ * This function is also available under the `writeUint16BE` alias.
1736
+ *
1737
+ * ```js
1738
+ * import { Buffer } from 'node:buffer';
1739
+ *
1740
+ * const buf = Buffer.allocUnsafe(4);
1741
+ *
1742
+ * buf.writeUInt16BE(0xdead, 0);
1743
+ * buf.writeUInt16BE(0xbeef, 2);
1744
+ *
1745
+ * console.log(buf);
1746
+ * // Prints: <Buffer de ad be ef>
1747
+ * ```
1748
+ * @since v0.5.5
1749
+ * @param value Number to be written to `buf`.
1750
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1751
+ * @return `offset` plus the number of bytes written.
1752
+ */
1753
+ writeUInt16BE(value: number, offset?: number): number;
1754
+ /**
1755
+ * @alias Buffer.writeUInt16BE
1756
+ * @since v14.9.0, v12.19.0
1757
+ */
1758
+ writeUint16BE(value: number, offset?: number): number;
1759
+ /**
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
1761
+ * anything other than an unsigned 32-bit integer.
1762
+ *
1763
+ * This function is also available under the `writeUint32LE` alias.
1764
+ *
1765
+ * ```js
1766
+ * import { Buffer } from 'node:buffer';
1767
+ *
1768
+ * const buf = Buffer.allocUnsafe(4);
1769
+ *
1770
+ * buf.writeUInt32LE(0xfeedface, 0);
1771
+ *
1772
+ * console.log(buf);
1773
+ * // Prints: <Buffer ce fa ed fe>
1774
+ * ```
1775
+ * @since v0.5.5
1776
+ * @param value Number to be written to `buf`.
1777
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1778
+ * @return `offset` plus the number of bytes written.
1779
+ */
1780
+ writeUInt32LE(value: number, offset?: number): number;
1781
+ /**
1782
+ * @alias Buffer.writeUInt32LE
1783
+ * @since v14.9.0, v12.19.0
1784
+ */
1785
+ writeUint32LE(value: number, offset?: number): number;
1786
+ /**
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
1788
+ * unsigned 32-bit integer.
1789
+ *
1790
+ * This function is also available under the `writeUint32BE` alias.
1791
+ *
1792
+ * ```js
1793
+ * import { Buffer } from 'node:buffer';
1794
+ *
1795
+ * const buf = Buffer.allocUnsafe(4);
1796
+ *
1797
+ * buf.writeUInt32BE(0xfeedface, 0);
1798
+ *
1799
+ * console.log(buf);
1800
+ * // Prints: <Buffer fe ed fa ce>
1801
+ * ```
1802
+ * @since v0.5.5
1803
+ * @param value Number to be written to `buf`.
1804
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1805
+ * @return `offset` plus the number of bytes written.
1806
+ */
1807
+ writeUInt32BE(value: number, offset?: number): number;
1808
+ /**
1809
+ * @alias Buffer.writeUInt32BE
1810
+ * @since v14.9.0, v12.19.0
1811
+ */
1812
+ writeUint32BE(value: number, offset?: number): number;
1813
+ /**
1814
+ * Writes `value` to `buf` at the specified `offset`. `value` must be a valid
1815
+ * signed 8-bit integer. Behavior is undefined when `value` is anything other than
1816
+ * a signed 8-bit integer.
1817
+ *
1818
+ * `value` is interpreted and written as a two's complement signed integer.
1819
+ *
1820
+ * ```js
1821
+ * import { Buffer } from 'node:buffer';
1822
+ *
1823
+ * const buf = Buffer.allocUnsafe(2);
1824
+ *
1825
+ * buf.writeInt8(2, 0);
1826
+ * buf.writeInt8(-2, 1);
1827
+ *
1828
+ * console.log(buf);
1829
+ * // Prints: <Buffer 02 fe>
1830
+ * ```
1831
+ * @since v0.5.0
1832
+ * @param value Number to be written to `buf`.
1833
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
1834
+ * @return `offset` plus the number of bytes written.
1835
+ */
1836
+ writeInt8(value: number, offset?: number): number;
1837
+ /**
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
1839
+ * anything other than a signed 16-bit integer.
1840
+ *
1841
+ * The `value` is interpreted and written as a two's complement signed integer.
1842
+ *
1843
+ * ```js
1844
+ * import { Buffer } from 'node:buffer';
1845
+ *
1846
+ * const buf = Buffer.allocUnsafe(2);
1847
+ *
1848
+ * buf.writeInt16LE(0x0304, 0);
1849
+ *
1850
+ * console.log(buf);
1851
+ * // Prints: <Buffer 04 03>
1852
+ * ```
1853
+ * @since v0.5.5
1854
+ * @param value Number to be written to `buf`.
1855
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1856
+ * @return `offset` plus the number of bytes written.
1857
+ */
1858
+ writeInt16LE(value: number, offset?: number): number;
1859
+ /**
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
1861
+ * anything other than a signed 16-bit integer.
1862
+ *
1863
+ * The `value` is interpreted and written as a two's complement signed integer.
1864
+ *
1865
+ * ```js
1866
+ * import { Buffer } from 'node:buffer';
1867
+ *
1868
+ * const buf = Buffer.allocUnsafe(2);
1869
+ *
1870
+ * buf.writeInt16BE(0x0102, 0);
1871
+ *
1872
+ * console.log(buf);
1873
+ * // Prints: <Buffer 01 02>
1874
+ * ```
1875
+ * @since v0.5.5
1876
+ * @param value Number to be written to `buf`.
1877
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1878
+ * @return `offset` plus the number of bytes written.
1879
+ */
1880
+ writeInt16BE(value: number, offset?: number): number;
1881
+ /**
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
1883
+ * anything other than a signed 32-bit integer.
1884
+ *
1885
+ * The `value` is interpreted and written as a two's complement signed integer.
1886
+ *
1887
+ * ```js
1888
+ * import { Buffer } from 'node:buffer';
1889
+ *
1890
+ * const buf = Buffer.allocUnsafe(4);
1891
+ *
1892
+ * buf.writeInt32LE(0x05060708, 0);
1893
+ *
1894
+ * console.log(buf);
1895
+ * // Prints: <Buffer 08 07 06 05>
1896
+ * ```
1897
+ * @since v0.5.5
1898
+ * @param value Number to be written to `buf`.
1899
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1900
+ * @return `offset` plus the number of bytes written.
1901
+ */
1902
+ writeInt32LE(value: number, offset?: number): number;
1903
+ /**
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
1905
+ * anything other than a signed 32-bit integer.
1906
+ *
1907
+ * The `value` is interpreted and written as a two's complement signed integer.
1908
+ *
1909
+ * ```js
1910
+ * import { Buffer } from 'node:buffer';
1911
+ *
1912
+ * const buf = Buffer.allocUnsafe(4);
1913
+ *
1914
+ * buf.writeInt32BE(0x01020304, 0);
1915
+ *
1916
+ * console.log(buf);
1917
+ * // Prints: <Buffer 01 02 03 04>
1918
+ * ```
1919
+ * @since v0.5.5
1920
+ * @param value Number to be written to `buf`.
1921
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1922
+ * @return `offset` plus the number of bytes written.
1923
+ */
1924
+ writeInt32BE(value: number, offset?: number): number;
1925
+ /**
1926
+ * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is
1927
+ * undefined when `value` is anything other than a JavaScript number.
1928
+ *
1929
+ * ```js
1930
+ * import { Buffer } from 'node:buffer';
1931
+ *
1932
+ * const buf = Buffer.allocUnsafe(4);
1933
+ *
1934
+ * buf.writeFloatLE(0xcafebabe, 0);
1935
+ *
1936
+ * console.log(buf);
1937
+ * // Prints: <Buffer bb fe 4a 4f>
1938
+ * ```
1939
+ * @since v0.11.15
1940
+ * @param value Number to be written to `buf`.
1941
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1942
+ * @return `offset` plus the number of bytes written.
1943
+ */
1944
+ writeFloatLE(value: number, offset?: number): number;
1945
+ /**
1946
+ * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is
1947
+ * undefined when `value` is anything other than a JavaScript number.
1948
+ *
1949
+ * ```js
1950
+ * import { Buffer } from 'node:buffer';
1951
+ *
1952
+ * const buf = Buffer.allocUnsafe(4);
1953
+ *
1954
+ * buf.writeFloatBE(0xcafebabe, 0);
1955
+ *
1956
+ * console.log(buf);
1957
+ * // Prints: <Buffer 4f 4a fe bb>
1958
+ * ```
1959
+ * @since v0.11.15
1960
+ * @param value Number to be written to `buf`.
1961
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1962
+ * @return `offset` plus the number of bytes written.
1963
+ */
1964
+ writeFloatBE(value: number, offset?: number): number;
1965
+ /**
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
1967
+ * other than a JavaScript number.
1968
+ *
1969
+ * ```js
1970
+ * import { Buffer } from 'node:buffer';
1971
+ *
1972
+ * const buf = Buffer.allocUnsafe(8);
1973
+ *
1974
+ * buf.writeDoubleLE(123.456, 0);
1975
+ *
1976
+ * console.log(buf);
1977
+ * // Prints: <Buffer 77 be 9f 1a 2f dd 5e 40>
1978
+ * ```
1979
+ * @since v0.11.15
1980
+ * @param value Number to be written to `buf`.
1981
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
1982
+ * @return `offset` plus the number of bytes written.
1983
+ */
1984
+ writeDoubleLE(value: number, offset?: number): number;
1985
+ /**
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
1987
+ * other than a JavaScript number.
1988
+ *
1989
+ * ```js
1990
+ * import { Buffer } from 'node:buffer';
1991
+ *
1992
+ * const buf = Buffer.allocUnsafe(8);
1993
+ *
1994
+ * buf.writeDoubleBE(123.456, 0);
1995
+ *
1996
+ * console.log(buf);
1997
+ * // Prints: <Buffer 40 5e dd 2f 1a 9f be 77>
1998
+ * ```
1999
+ * @since v0.11.15
2000
+ * @param value Number to be written to `buf`.
2001
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
2002
+ * @return `offset` plus the number of bytes written.
2003
+ */
2004
+ writeDoubleBE(value: number, offset?: number): number;
2005
+ /**
2006
+ * Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
2007
+ * the entire `buf` will be filled:
2008
+ *
2009
+ * ```js
2010
+ * import { Buffer } from 'node:buffer';
2011
+ *
2012
+ * // Fill a `Buffer` with the ASCII character 'h'.
2013
+ *
2014
+ * const b = Buffer.allocUnsafe(50).fill('h');
2015
+ *
2016
+ * console.log(b.toString());
2017
+ * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
2018
+ *
2019
+ * // Fill a buffer with empty string
2020
+ * const c = Buffer.allocUnsafe(5).fill('');
2021
+ *
2022
+ * console.log(c.fill(''));
2023
+ * // Prints: <Buffer 00 00 00 00 00>
2024
+ * ```
2025
+ *
2026
+ * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or
2027
+ * integer. If the resulting integer is greater than `255` (decimal), `buf` will be
2028
+ * filled with `value &#x26; 255`.
2029
+ *
2030
+ * If the final write of a `fill()` operation falls on a multi-byte character,
2031
+ * then only the bytes of that character that fit into `buf` are written:
2032
+ *
2033
+ * ```js
2034
+ * import { Buffer } from 'node:buffer';
2035
+ *
2036
+ * // Fill a `Buffer` with character that takes up two bytes in UTF-8.
2037
+ *
2038
+ * console.log(Buffer.allocUnsafe(5).fill('\u0222'));
2039
+ * // Prints: <Buffer c8 a2 c8 a2 c8>
2040
+ * ```
2041
+ *
2042
+ * If `value` contains invalid characters, it is truncated; if no valid
2043
+ * fill data remains, an exception is thrown:
2044
+ *
2045
+ * ```js
2046
+ * import { Buffer } from 'node:buffer';
2047
+ *
2048
+ * const buf = Buffer.allocUnsafe(5);
2049
+ *
2050
+ * console.log(buf.fill('a'));
2051
+ * // Prints: <Buffer 61 61 61 61 61>
2052
+ * console.log(buf.fill('aazz', 'hex'));
2053
+ * // Prints: <Buffer aa aa aa aa aa>
2054
+ * console.log(buf.fill('zz', 'hex'));
2055
+ * // Throws an exception.
2056
+ * ```
2057
+ * @since v0.5.0
2058
+ * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`.
2059
+ * @param [offset=0] Number of bytes to skip before starting to fill `buf`.
2060
+ * @param [end=buf.length] Where to stop filling `buf` (not inclusive).
2061
+ * @param [encoding='utf8'] The encoding for `value` if `value` is a string.
2062
+ * @return A reference to `buf`.
2063
+ */
2064
+ fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
2065
+ /**
2066
+ * If `value` is:
2067
+ *
2068
+ * * a string, `value` is interpreted according to the character encoding in`encoding`.
2069
+ * * 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
+ * To compare a partial `Buffer`, use `buf.subarray`.
2071
+ * * a number, `value` will be interpreted as an unsigned 8-bit integer
2072
+ * value between `0` and `255`.
2073
+ *
2074
+ * ```js
2075
+ * import { Buffer } from 'node:buffer';
2076
+ *
2077
+ * const buf = Buffer.from('this is a buffer');
2078
+ *
2079
+ * console.log(buf.indexOf('this'));
2080
+ * // Prints: 0
2081
+ * console.log(buf.indexOf('is'));
2082
+ * // Prints: 2
2083
+ * console.log(buf.indexOf(Buffer.from('a buffer')));
2084
+ * // Prints: 8
2085
+ * console.log(buf.indexOf(97));
2086
+ * // Prints: 8 (97 is the decimal ASCII value for 'a')
2087
+ * console.log(buf.indexOf(Buffer.from('a buffer example')));
2088
+ * // Prints: -1
2089
+ * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));
2090
+ * // Prints: 8
2091
+ *
2092
+ * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
2093
+ *
2094
+ * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le'));
2095
+ * // Prints: 4
2096
+ * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le'));
2097
+ * // Prints: 6
2098
+ * ```
2099
+ *
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,
2101
+ * an integer between 0 and 255.
2102
+ *
2103
+ * If `byteOffset` is not a number, it will be coerced to a number. If the result
2104
+ * of coercion is `NaN` or `0`, then the entire buffer will be searched. This
2105
+ * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
2106
+ *
2107
+ * ```js
2108
+ * import { Buffer } from 'node:buffer';
2109
+ *
2110
+ * const b = Buffer.from('abcdef');
2111
+ *
2112
+ * // Passing a value that's a number, but not a valid byte.
2113
+ * // Prints: 2, equivalent to searching for 99 or 'c'.
2114
+ * console.log(b.indexOf(99.9));
2115
+ * console.log(b.indexOf(256 + 99));
2116
+ *
2117
+ * // Passing a byteOffset that coerces to NaN or 0.
2118
+ * // Prints: 1, searching the whole buffer.
2119
+ * console.log(b.indexOf('b', undefined));
2120
+ * console.log(b.indexOf('b', {}));
2121
+ * console.log(b.indexOf('b', null));
2122
+ * console.log(b.indexOf('b', []));
2123
+ * ```
2124
+ *
2125
+ * If `value` is an empty string or empty `Buffer` and `byteOffset` is less
2126
+ * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned.
2127
+ * @since v1.5.0
2128
+ * @param value What to search for.
2129
+ * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
2130
+ * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.
2131
+ * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
2132
+ */
2133
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
2134
+ /**
2135
+ * Identical to `buf.indexOf()`, except the last occurrence of `value` is found
2136
+ * rather than the first occurrence.
2137
+ *
2138
+ * ```js
2139
+ * import { Buffer } from 'node:buffer';
2140
+ *
2141
+ * const buf = Buffer.from('this buffer is a buffer');
2142
+ *
2143
+ * console.log(buf.lastIndexOf('this'));
2144
+ * // Prints: 0
2145
+ * console.log(buf.lastIndexOf('buffer'));
2146
+ * // Prints: 17
2147
+ * console.log(buf.lastIndexOf(Buffer.from('buffer')));
2148
+ * // Prints: 17
2149
+ * console.log(buf.lastIndexOf(97));
2150
+ * // Prints: 15 (97 is the decimal ASCII value for 'a')
2151
+ * console.log(buf.lastIndexOf(Buffer.from('yolo')));
2152
+ * // Prints: -1
2153
+ * console.log(buf.lastIndexOf('buffer', 5));
2154
+ * // Prints: 5
2155
+ * console.log(buf.lastIndexOf('buffer', 4));
2156
+ * // Prints: -1
2157
+ *
2158
+ * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
2159
+ *
2160
+ * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le'));
2161
+ * // Prints: 6
2162
+ * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le'));
2163
+ * // Prints: 4
2164
+ * ```
2165
+ *
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,
2167
+ * an integer between 0 and 255.
2168
+ *
2169
+ * If `byteOffset` is not a number, it will be coerced to a number. Any arguments
2170
+ * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
2171
+ * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
2172
+ *
2173
+ * ```js
2174
+ * import { Buffer } from 'node:buffer';
2175
+ *
2176
+ * const b = Buffer.from('abcdef');
2177
+ *
2178
+ * // Passing a value that's a number, but not a valid byte.
2179
+ * // Prints: 2, equivalent to searching for 99 or 'c'.
2180
+ * console.log(b.lastIndexOf(99.9));
2181
+ * console.log(b.lastIndexOf(256 + 99));
2182
+ *
2183
+ * // Passing a byteOffset that coerces to NaN.
2184
+ * // Prints: 1, searching the whole buffer.
2185
+ * console.log(b.lastIndexOf('b', undefined));
2186
+ * console.log(b.lastIndexOf('b', {}));
2187
+ *
2188
+ * // Passing a byteOffset that coerces to 0.
2189
+ * // Prints: -1, equivalent to passing 0.
2190
+ * console.log(b.lastIndexOf('b', null));
2191
+ * console.log(b.lastIndexOf('b', []));
2192
+ * ```
2193
+ *
2194
+ * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
2195
+ * @since v6.0.0
2196
+ * @param value What to search for.
2197
+ * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
2198
+ * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.
2199
+ * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
2200
+ */
2201
+ 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]>;
2227
+ /**
2228
+ * Equivalent to `buf.indexOf() !== -1`.
2229
+ *
2230
+ * ```js
2231
+ * import { Buffer } from 'node:buffer';
2232
+ *
2233
+ * const buf = Buffer.from('this is a buffer');
2234
+ *
2235
+ * console.log(buf.includes('this'));
2236
+ * // Prints: true
2237
+ * console.log(buf.includes('is'));
2238
+ * // Prints: true
2239
+ * console.log(buf.includes(Buffer.from('a buffer')));
2240
+ * // Prints: true
2241
+ * console.log(buf.includes(97));
2242
+ * // Prints: true (97 is the decimal ASCII value for 'a')
2243
+ * console.log(buf.includes(Buffer.from('a buffer example')));
2244
+ * // Prints: false
2245
+ * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));
2246
+ * // Prints: true
2247
+ * console.log(buf.includes('this', 4));
2248
+ * // Prints: false
2249
+ * ```
2250
+ * @since v5.3.0
2251
+ * @param value What to search for.
2252
+ * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
2253
+ * @param [encoding='utf8'] If `value` is a string, this is its encoding.
2254
+ * @return `true` if `value` was found in `buf`, `false` otherwise.
2255
+ */
2256
+ 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>;
2313
+ }
2314
+ var Buffer: BufferConstructor;
2315
+ /**
2316
+ * Decodes a string of Base64-encoded data into bytes, and encodes those bytes
2317
+ * into a string using Latin-1 (ISO-8859-1).
2318
+ *
2319
+ * The `data` may be any JavaScript-value that can be coerced into a string.
2320
+ *
2321
+ * **This function is only provided for compatibility with legacy web platform APIs**
2322
+ * **and should never be used in new code, because they use strings to represent**
2323
+ * **binary data and predate the introduction of typed arrays in JavaScript.**
2324
+ * **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')`.**
2326
+ * @since v15.13.0, v14.17.0
2327
+ * @legacy Use `Buffer.from(data, 'base64')` instead.
2328
+ * @param data The Base64-encoded input string.
2329
+ */
2330
+ function atob(data: string): string;
2331
+ /**
2332
+ * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
2333
+ * into a string using Base64.
2334
+ *
2335
+ * The `data` may be any JavaScript-value that can be coerced into a string.
2336
+ *
2337
+ * **This function is only provided for compatibility with legacy web platform APIs**
2338
+ * **and should never be used in new code, because they use strings to represent**
2339
+ * **binary data and predate the introduction of typed arrays in JavaScript.**
2340
+ * **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')`.**
2342
+ * @since v15.13.0, v14.17.0
2343
+ * @legacy Use `buf.toString('base64')` instead.
2344
+ * @param data An ASCII (Latin1) string.
2345
+ */
2346
+ function btoa(data: string): string;
2347
+ interface Blob extends __Blob {}
2348
+ /**
2349
+ * `Blob` class is a global reference for `require('node:buffer').Blob`
2350
+ * https://nodejs.org/api/buffer.html#class-blob
2351
+ * @since v18.0.0
2352
+ */
2353
+ var Blob: typeof globalThis extends {
2354
+ onmessage: any;
2355
+ Blob: infer T;
2356
+ } ? T
2357
+ : typeof NodeBlob;
2358
+ }
2359
+ }
2360
+ declare module "node:buffer" {
2361
+ export * from "buffer";
2362
+ }