cdk-ecr-deployment 0.0.76 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/.jsii +28 -25
  2. package/lambda/Dockerfile +25 -0
  3. package/lambda/install.js +64 -0
  4. package/lib/index.js +40 -23
  5. package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
  6. package/node_modules/@sindresorhus/is/dist/index.js +427 -0
  7. package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
  8. package/node_modules/@sindresorhus/is/dist/types.js +3 -0
  9. package/node_modules/@sindresorhus/is/license +9 -0
  10. package/node_modules/@sindresorhus/is/package.json +96 -0
  11. package/node_modules/@sindresorhus/is/readme.md +628 -0
  12. package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
  13. package/node_modules/@szmarczak/http-timer/README.md +93 -0
  14. package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  15. package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
  16. package/node_modules/@szmarczak/http-timer/package.json +72 -0
  17. package/node_modules/@types/cacheable-request/LICENSE +21 -0
  18. package/node_modules/@types/cacheable-request/README.md +16 -0
  19. package/node_modules/@types/cacheable-request/index.d.ts +137 -0
  20. package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
  21. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
  22. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
  23. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
  24. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1365 -0
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
  29. package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
  30. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
  31. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
  32. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  33. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +357 -0
  34. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +643 -0
  35. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
  36. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
  37. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1004 -0
  38. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3748 -0
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1368 -0
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
  44. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
  45. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2738 -0
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1477 -0
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +542 -0
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +6 -0
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +798 -0
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1563 -0
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
  74. package/node_modules/@types/cacheable-request/package.json +35 -0
  75. package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
  76. package/node_modules/@types/http-cache-semantics/README.md +16 -0
  77. package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
  78. package/node_modules/@types/http-cache-semantics/package.json +25 -0
  79. package/node_modules/@types/keyv/LICENSE +21 -0
  80. package/node_modules/@types/keyv/README.md +16 -0
  81. package/node_modules/@types/keyv/index.d.ts +77 -0
  82. package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
  83. package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
  84. package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
  85. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
  86. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
  87. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
  88. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1365 -0
  89. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
  90. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
  91. package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
  92. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
  93. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
  94. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  95. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +357 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +643 -0
  97. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
  98. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
  99. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1004 -0
  100. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3748 -0
  101. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
  102. package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
  103. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1368 -0
  104. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
  105. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
  106. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
  107. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2738 -0
  108. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
  109. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
  110. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
  111. package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
  112. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
  113. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
  114. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1477 -0
  115. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
  116. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
  117. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +542 -0
  118. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
  119. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
  120. package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
  121. package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +6 -0
  122. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
  123. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
  124. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
  125. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
  126. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
  127. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
  128. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
  129. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +798 -0
  130. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1563 -0
  131. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
  132. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
  133. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
  134. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
  135. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
  136. package/node_modules/@types/keyv/package.json +32 -0
  137. package/node_modules/@types/responselike/LICENSE +21 -0
  138. package/node_modules/@types/responselike/README.md +16 -0
  139. package/node_modules/@types/responselike/index.d.ts +34 -0
  140. package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
  141. package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
  142. package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
  143. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
  144. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
  145. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
  146. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1365 -0
  147. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
  148. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
  149. package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
  150. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
  151. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
  152. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  153. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +357 -0
  154. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +643 -0
  155. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
  156. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
  157. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1004 -0
  158. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3748 -0
  159. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
  160. package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
  161. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1368 -0
  162. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
  163. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
  164. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
  165. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2738 -0
  166. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
  167. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
  168. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
  169. package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
  170. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
  171. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
  172. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1477 -0
  173. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
  174. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
  175. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +542 -0
  176. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
  177. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
  178. package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
  179. package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +6 -0
  180. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
  181. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
  182. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
  183. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
  184. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
  185. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
  186. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
  187. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +798 -0
  188. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1563 -0
  189. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
  190. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
  191. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
  192. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
  193. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
  194. package/node_modules/@types/responselike/package.json +25 -0
  195. package/node_modules/cacheable-lookup/LICENSE +21 -0
  196. package/node_modules/cacheable-lookup/README.md +240 -0
  197. package/node_modules/cacheable-lookup/index.d.ts +139 -0
  198. package/node_modules/cacheable-lookup/package.json +45 -0
  199. package/node_modules/cacheable-lookup/source/index.js +436 -0
  200. package/node_modules/cacheable-request/LICENSE +21 -0
  201. package/node_modules/cacheable-request/README.md +206 -0
  202. package/node_modules/cacheable-request/package.json +56 -0
  203. package/node_modules/cacheable-request/src/index.js +251 -0
  204. package/node_modules/clone-response/LICENSE +21 -0
  205. package/node_modules/clone-response/README.md +62 -0
  206. package/node_modules/clone-response/package.json +44 -0
  207. package/node_modules/clone-response/src/index.js +17 -0
  208. package/node_modules/decompress-response/index.d.ts +22 -0
  209. package/node_modules/decompress-response/index.js +58 -0
  210. package/node_modules/decompress-response/license +9 -0
  211. package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
  212. package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
  213. package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
  214. package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
  215. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
  216. package/node_modules/decompress-response/package.json +56 -0
  217. package/node_modules/decompress-response/readme.md +48 -0
  218. package/node_modules/defer-to-connect/LICENSE +21 -0
  219. package/node_modules/defer-to-connect/README.md +38 -0
  220. package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
  221. package/node_modules/defer-to-connect/dist/source/index.js +47 -0
  222. package/node_modules/defer-to-connect/package.json +71 -0
  223. package/node_modules/end-of-stream/LICENSE +21 -0
  224. package/node_modules/end-of-stream/README.md +54 -0
  225. package/node_modules/end-of-stream/index.js +94 -0
  226. package/node_modules/end-of-stream/package.json +37 -0
  227. package/node_modules/get-stream/buffer-stream.js +52 -0
  228. package/node_modules/get-stream/index.d.ts +108 -0
  229. package/node_modules/get-stream/index.js +60 -0
  230. package/node_modules/get-stream/license +9 -0
  231. package/node_modules/get-stream/package.json +50 -0
  232. package/node_modules/get-stream/readme.md +124 -0
  233. package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
  234. package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
  235. package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
  236. package/node_modules/got/dist/source/as-promise/index.js +175 -0
  237. package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
  238. package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
  239. package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
  240. package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
  241. package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
  242. package/node_modules/got/dist/source/as-promise/types.js +40 -0
  243. package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
  244. package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
  245. package/node_modules/got/dist/source/core/index.d.ts +1124 -0
  246. package/node_modules/got/dist/source/core/index.js +1491 -0
  247. package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
  248. package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
  249. package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
  250. package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
  251. package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
  252. package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
  253. package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
  254. package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
  255. package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
  256. package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
  257. package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
  258. package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
  259. package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
  260. package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
  261. package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
  262. package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
  263. package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
  264. package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
  265. package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
  266. package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
  267. package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
  268. package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
  269. package/node_modules/got/dist/source/create.d.ts +5 -0
  270. package/node_modules/got/dist/source/create.js +240 -0
  271. package/node_modules/got/dist/source/index.d.ts +4 -0
  272. package/node_modules/got/dist/source/index.js +132 -0
  273. package/node_modules/got/dist/source/types.d.ts +342 -0
  274. package/node_modules/got/dist/source/types.js +2 -0
  275. package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
  276. package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
  277. package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
  278. package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
  279. package/node_modules/got/license +9 -0
  280. package/node_modules/got/package.json +130 -0
  281. package/node_modules/got/readme.md +2476 -0
  282. package/node_modules/http-cache-semantics/LICENSE +9 -0
  283. package/node_modules/http-cache-semantics/README.md +203 -0
  284. package/node_modules/http-cache-semantics/index.js +673 -0
  285. package/node_modules/http-cache-semantics/package.json +24 -0
  286. package/node_modules/http2-wrapper/LICENSE +21 -0
  287. package/node_modules/http2-wrapper/README.md +470 -0
  288. package/node_modules/http2-wrapper/package.json +54 -0
  289. package/node_modules/http2-wrapper/source/agent.js +670 -0
  290. package/node_modules/http2-wrapper/source/auto.js +149 -0
  291. package/node_modules/http2-wrapper/source/client-request.js +445 -0
  292. package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
  293. package/node_modules/http2-wrapper/source/index.js +28 -0
  294. package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
  295. package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
  296. package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
  297. package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
  298. package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
  299. package/node_modules/json-buffer/.travis.yml +3 -0
  300. package/node_modules/json-buffer/LICENSE +22 -0
  301. package/node_modules/json-buffer/README.md +24 -0
  302. package/node_modules/json-buffer/index.js +58 -0
  303. package/node_modules/json-buffer/package.json +34 -0
  304. package/node_modules/json-buffer/test/index.js +63 -0
  305. package/node_modules/keyv/LICENSE +21 -0
  306. package/node_modules/keyv/README.md +288 -0
  307. package/node_modules/keyv/package.json +49 -0
  308. package/node_modules/keyv/src/index.js +111 -0
  309. package/node_modules/lowercase-keys/index.d.ts +16 -0
  310. package/node_modules/lowercase-keys/index.js +10 -0
  311. package/node_modules/lowercase-keys/license +9 -0
  312. package/node_modules/lowercase-keys/package.json +38 -0
  313. package/node_modules/lowercase-keys/readme.md +32 -0
  314. package/node_modules/mimic-response/index.js +32 -0
  315. package/node_modules/mimic-response/license +9 -0
  316. package/node_modules/mimic-response/package.json +37 -0
  317. package/node_modules/mimic-response/readme.md +54 -0
  318. package/node_modules/normalize-url/index.d.ts +267 -0
  319. package/node_modules/normalize-url/index.js +216 -0
  320. package/node_modules/normalize-url/license +9 -0
  321. package/node_modules/normalize-url/package.json +50 -0
  322. package/node_modules/normalize-url/readme.md +286 -0
  323. package/node_modules/once/LICENSE +15 -0
  324. package/node_modules/once/README.md +79 -0
  325. package/node_modules/once/once.js +42 -0
  326. package/node_modules/once/package.json +33 -0
  327. package/node_modules/p-cancelable/index.d.ts +176 -0
  328. package/node_modules/p-cancelable/index.js +111 -0
  329. package/node_modules/p-cancelable/license +9 -0
  330. package/node_modules/p-cancelable/package.json +49 -0
  331. package/node_modules/p-cancelable/readme.md +153 -0
  332. package/node_modules/pump/.travis.yml +5 -0
  333. package/node_modules/pump/LICENSE +21 -0
  334. package/node_modules/pump/README.md +65 -0
  335. package/node_modules/pump/index.js +82 -0
  336. package/node_modules/pump/package.json +24 -0
  337. package/node_modules/pump/test-browser.js +66 -0
  338. package/node_modules/pump/test-node.js +53 -0
  339. package/node_modules/quick-lru/index.d.ts +97 -0
  340. package/node_modules/quick-lru/index.js +123 -0
  341. package/node_modules/quick-lru/license +9 -0
  342. package/node_modules/quick-lru/package.json +43 -0
  343. package/node_modules/quick-lru/readme.md +111 -0
  344. package/node_modules/resolve-alpn/LICENSE +22 -0
  345. package/node_modules/resolve-alpn/README.md +60 -0
  346. package/node_modules/resolve-alpn/index.js +43 -0
  347. package/node_modules/resolve-alpn/package.json +34 -0
  348. package/node_modules/responselike/LICENSE +19 -0
  349. package/node_modules/responselike/README.md +77 -0
  350. package/node_modules/responselike/package.json +38 -0
  351. package/node_modules/responselike/src/index.js +34 -0
  352. package/node_modules/wrappy/LICENSE +15 -0
  353. package/node_modules/wrappy/README.md +36 -0
  354. package/node_modules/wrappy/package.json +29 -0
  355. package/node_modules/wrappy/wrappy.js +33 -0
  356. package/package.json +7 -4
@@ -0,0 +1,2142 @@
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 '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/v16.9.0/lib/buffer.js)
45
+ */
46
+ declare module 'buffer' {
47
+ import { BinaryLike } from 'node:crypto';
48
+ export const INSPECT_MAX_BYTES: number;
49
+ export const kMaxLength: number;
50
+ export const kStringMaxLength: number;
51
+ export const constants: {
52
+ MAX_LENGTH: number;
53
+ MAX_STRING_LENGTH: number;
54
+ };
55
+ export type TranscodeEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'binary';
56
+ /**
57
+ * Re-encodes the given `Buffer` or `Uint8Array` instance from one character
58
+ * encoding to another. Returns a new `Buffer` instance.
59
+ *
60
+ * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
61
+ * conversion from `fromEnc` to `toEnc` is not permitted.
62
+ *
63
+ * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
64
+ *
65
+ * The transcoding process will use substitution characters if a given byte
66
+ * sequence cannot be adequately represented in the target encoding. For instance:
67
+ *
68
+ * ```js
69
+ * import { Buffer, transcode } from 'buffer';
70
+ *
71
+ * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');
72
+ * console.log(newBuf.toString('ascii'));
73
+ * // Prints: '?'
74
+ * ```
75
+ *
76
+ * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced
77
+ * with `?` in the transcoded `Buffer`.
78
+ * @since v7.1.0
79
+ * @param source A `Buffer` or `Uint8Array` instance.
80
+ * @param fromEnc The current encoding.
81
+ * @param toEnc To target encoding.
82
+ */
83
+ export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
84
+ export const SlowBuffer: {
85
+ /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
86
+ new (size: number): Buffer;
87
+ prototype: Buffer;
88
+ };
89
+ /**
90
+ * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
91
+ * a prior call to `URL.createObjectURL()`.
92
+ * @since v16.7.0
93
+ * @experimental
94
+ * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
95
+ */
96
+ export function resolveObjectURL(id: string): Blob | undefined;
97
+ export { Buffer };
98
+ /**
99
+ * @experimental
100
+ */
101
+ export interface BlobOptions {
102
+ /**
103
+ * @default 'utf8'
104
+ */
105
+ encoding?: BufferEncoding | undefined;
106
+ /**
107
+ * The Blob content-type. The intent is for `type` to convey
108
+ * the MIME media type of the data, however no validation of the type format
109
+ * is performed.
110
+ */
111
+ type?: string | undefined;
112
+ }
113
+ /**
114
+ * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
115
+ * multiple worker threads.
116
+ * @since v15.7.0
117
+ * @experimental
118
+ */
119
+ export class Blob {
120
+ /**
121
+ * The total size of the `Blob` in bytes.
122
+ * @since v15.7.0
123
+ */
124
+ readonly size: number;
125
+ /**
126
+ * The content-type of the `Blob`.
127
+ * @since v15.7.0
128
+ */
129
+ readonly type: string;
130
+ /**
131
+ * Creates a new `Blob` object containing a concatenation of the given sources.
132
+ *
133
+ * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
134
+ * the 'Blob' and can therefore be safely modified after the 'Blob' is created.
135
+ *
136
+ * String sources are also copied into the `Blob`.
137
+ */
138
+ constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions);
139
+ /**
140
+ * 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
141
+ * the `Blob` data.
142
+ * @since v15.7.0
143
+ */
144
+ arrayBuffer(): Promise<ArrayBuffer>;
145
+ /**
146
+ * Creates and returns a new `Blob` containing a subset of this `Blob` objects
147
+ * data. The original `Blob` is not altered.
148
+ * @since v15.7.0
149
+ * @param start The starting index.
150
+ * @param end The ending index.
151
+ * @param type The content-type for the new `Blob`
152
+ */
153
+ slice(start?: number, end?: number, type?: string): Blob;
154
+ /**
155
+ * Returns a promise that fulfills with the contents of the `Blob` decoded as a
156
+ * UTF-8 string.
157
+ * @since v15.7.0
158
+ */
159
+ text(): Promise<string>;
160
+ /**
161
+ * Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
162
+ * @since v16.7.0
163
+ */
164
+ stream(): unknown; // pending web streams types
165
+ }
166
+ export import atob = globalThis.atob;
167
+ export import btoa = globalThis.btoa;
168
+ global {
169
+ // Buffer class
170
+ type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
171
+ type WithImplicitCoercion<T> =
172
+ | T
173
+ | {
174
+ valueOf(): T;
175
+ };
176
+ /**
177
+ * Raw data is stored in instances of the Buffer class.
178
+ * 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.
179
+ * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
180
+ */
181
+ interface BufferConstructor {
182
+ /**
183
+ * Allocates a new buffer containing the given {str}.
184
+ *
185
+ * @param str String to store in buffer.
186
+ * @param encoding encoding to use, optional. Default is 'utf8'
187
+ * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
188
+ */
189
+ new (str: string, encoding?: BufferEncoding): Buffer;
190
+ /**
191
+ * Allocates a new buffer of {size} octets.
192
+ *
193
+ * @param size count of octets to allocate.
194
+ * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
195
+ */
196
+ new (size: number): Buffer;
197
+ /**
198
+ * Allocates a new buffer containing the given {array} of octets.
199
+ *
200
+ * @param array The octets to store.
201
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
202
+ */
203
+ new (array: Uint8Array): Buffer;
204
+ /**
205
+ * Produces a Buffer backed by the same allocated memory as
206
+ * the given {ArrayBuffer}/{SharedArrayBuffer}.
207
+ *
208
+ *
209
+ * @param arrayBuffer The ArrayBuffer with which to share memory.
210
+ * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
211
+ */
212
+ new (arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
213
+ /**
214
+ * Allocates a new buffer containing the given {array} of octets.
215
+ *
216
+ * @param array The octets to store.
217
+ * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
218
+ */
219
+ new (array: ReadonlyArray<any>): Buffer;
220
+ /**
221
+ * Copies the passed {buffer} data onto a new {Buffer} instance.
222
+ *
223
+ * @param buffer The buffer to copy.
224
+ * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
225
+ */
226
+ new (buffer: Buffer): Buffer;
227
+ /**
228
+ * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
229
+ * Array entries outside that range will be truncated to fit into it.
230
+ *
231
+ * ```js
232
+ * import { Buffer } from 'buffer';
233
+ *
234
+ * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
235
+ * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
236
+ * ```
237
+ *
238
+ * A `TypeError` will be thrown if `array` is not an `Array` or another type
239
+ * appropriate for `Buffer.from()` variants.
240
+ *
241
+ * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
242
+ * @since v5.10.0
243
+ */
244
+ from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
245
+ /**
246
+ * Creates a new Buffer using the passed {data}
247
+ * @param data data to create a new Buffer
248
+ */
249
+ from(data: Uint8Array | ReadonlyArray<number>): Buffer;
250
+ from(data: WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string>): Buffer;
251
+ /**
252
+ * Creates a new Buffer containing the given JavaScript string {str}.
253
+ * If provided, the {encoding} parameter identifies the character encoding.
254
+ * If not provided, {encoding} defaults to 'utf8'.
255
+ */
256
+ from(
257
+ str:
258
+ | WithImplicitCoercion<string>
259
+ | {
260
+ [Symbol.toPrimitive](hint: 'string'): string;
261
+ },
262
+ encoding?: BufferEncoding
263
+ ): Buffer;
264
+ /**
265
+ * Creates a new Buffer using the passed {data}
266
+ * @param values to create a new Buffer
267
+ */
268
+ of(...items: number[]): Buffer;
269
+ /**
270
+ * Returns `true` if `obj` is a `Buffer`, `false` otherwise.
271
+ *
272
+ * ```js
273
+ * import { Buffer } from 'buffer';
274
+ *
275
+ * Buffer.isBuffer(Buffer.alloc(10)); // true
276
+ * Buffer.isBuffer(Buffer.from('foo')); // true
277
+ * Buffer.isBuffer('a string'); // false
278
+ * Buffer.isBuffer([]); // false
279
+ * Buffer.isBuffer(new Uint8Array(1024)); // false
280
+ * ```
281
+ * @since v0.1.101
282
+ */
283
+ isBuffer(obj: any): obj is Buffer;
284
+ /**
285
+ * Returns `true` if `encoding` is the name of a supported character encoding,
286
+ * or `false` otherwise.
287
+ *
288
+ * ```js
289
+ * import { Buffer } from 'buffer';
290
+ *
291
+ * console.log(Buffer.isEncoding('utf8'));
292
+ * // Prints: true
293
+ *
294
+ * console.log(Buffer.isEncoding('hex'));
295
+ * // Prints: true
296
+ *
297
+ * console.log(Buffer.isEncoding('utf/8'));
298
+ * // Prints: false
299
+ *
300
+ * console.log(Buffer.isEncoding(''));
301
+ * // Prints: false
302
+ * ```
303
+ * @since v0.9.1
304
+ * @param encoding A character encoding name to check.
305
+ */
306
+ isEncoding(encoding: string): encoding is BufferEncoding;
307
+ /**
308
+ * Returns the byte length of a string when encoded using `encoding`.
309
+ * 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
310
+ * for the encoding that is used to convert the string into bytes.
311
+ *
312
+ * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input.
313
+ * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the
314
+ * return value might be greater than the length of a `Buffer` created from the
315
+ * string.
316
+ *
317
+ * ```js
318
+ * import { Buffer } from 'buffer';
319
+ *
320
+ * const str = '\u00bd + \u00bc = \u00be';
321
+ *
322
+ * console.log(`${str}: ${str.length} characters, ` +
323
+ * `${Buffer.byteLength(str, 'utf8')} bytes`);
324
+ * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes
325
+ * ```
326
+ *
327
+ * When `string` is a
328
+ * `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/-
329
+ * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop-
330
+ * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned.
331
+ * @since v0.1.90
332
+ * @param string A value to calculate the length of.
333
+ * @param [encoding='utf8'] If `string` is a string, this is its encoding.
334
+ * @return The number of bytes contained within `string`.
335
+ */
336
+ byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
337
+ /**
338
+ * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
339
+ *
340
+ * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
341
+ *
342
+ * If `totalLength` is not provided, it is calculated from the `Buffer` instances
343
+ * in `list` by adding their lengths.
344
+ *
345
+ * If `totalLength` is provided, it is coerced to an unsigned integer. If the
346
+ * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
347
+ * truncated to `totalLength`.
348
+ *
349
+ * ```js
350
+ * import { Buffer } from 'buffer';
351
+ *
352
+ * // Create a single `Buffer` from a list of three `Buffer` instances.
353
+ *
354
+ * const buf1 = Buffer.alloc(10);
355
+ * const buf2 = Buffer.alloc(14);
356
+ * const buf3 = Buffer.alloc(18);
357
+ * const totalLength = buf1.length + buf2.length + buf3.length;
358
+ *
359
+ * console.log(totalLength);
360
+ * // Prints: 42
361
+ *
362
+ * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
363
+ *
364
+ * console.log(bufA);
365
+ * // Prints: <Buffer 00 00 00 00 ...>
366
+ * console.log(bufA.length);
367
+ * // Prints: 42
368
+ * ```
369
+ *
370
+ * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
371
+ * @since v0.7.11
372
+ * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
373
+ * @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
374
+ */
375
+ concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
376
+ /**
377
+ * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
378
+ *
379
+ * ```js
380
+ * import { Buffer } from 'buffer';
381
+ *
382
+ * const buf1 = Buffer.from('1234');
383
+ * const buf2 = Buffer.from('0123');
384
+ * const arr = [buf1, buf2];
385
+ *
386
+ * console.log(arr.sort(Buffer.compare));
387
+ * // Prints: [ <Buffer 30 31 32 33>, <Buffer 31 32 33 34> ]
388
+ * // (This result is equal to: [buf2, buf1].)
389
+ * ```
390
+ * @since v0.11.13
391
+ * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
392
+ */
393
+ compare(buf1: Uint8Array, buf2: Uint8Array): number;
394
+ /**
395
+ * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
396
+ *
397
+ * ```js
398
+ * import { Buffer } from 'buffer';
399
+ *
400
+ * const buf = Buffer.alloc(5);
401
+ *
402
+ * console.log(buf);
403
+ * // Prints: <Buffer 00 00 00 00 00>
404
+ * ```
405
+ *
406
+ * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
407
+ *
408
+ * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
409
+ *
410
+ * ```js
411
+ * import { Buffer } from 'buffer';
412
+ *
413
+ * const buf = Buffer.alloc(5, 'a');
414
+ *
415
+ * console.log(buf);
416
+ * // Prints: <Buffer 61 61 61 61 61>
417
+ * ```
418
+ *
419
+ * If both `fill` and `encoding` are specified, the allocated `Buffer` will be
420
+ * initialized by calling `buf.fill(fill, encoding)`.
421
+ *
422
+ * ```js
423
+ * import { Buffer } from 'buffer';
424
+ *
425
+ * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
426
+ *
427
+ * console.log(buf);
428
+ * // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
429
+ * ```
430
+ *
431
+ * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
432
+ * contents will never contain sensitive data from previous allocations, including
433
+ * data that might not have been allocated for `Buffer`s.
434
+ *
435
+ * A `TypeError` will be thrown if `size` is not a number.
436
+ * @since v5.10.0
437
+ * @param size The desired length of the new `Buffer`.
438
+ * @param [fill=0] A value to pre-fill the new `Buffer` with.
439
+ * @param [encoding='utf8'] If `fill` is a string, this is its encoding.
440
+ */
441
+ alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
442
+ /**
443
+ * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
444
+ *
445
+ * The underlying memory for `Buffer` instances created in this way is _not_
446
+ * _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.
447
+ *
448
+ * ```js
449
+ * import { Buffer } from 'buffer';
450
+ *
451
+ * const buf = Buffer.allocUnsafe(10);
452
+ *
453
+ * console.log(buf);
454
+ * // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
455
+ *
456
+ * buf.fill(0);
457
+ *
458
+ * console.log(buf);
459
+ * // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
460
+ * ```
461
+ *
462
+ * A `TypeError` will be thrown if `size` is not a number.
463
+ *
464
+ * The `Buffer` module pre-allocates an internal `Buffer` instance of
465
+ * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`,`Buffer.from(array)`, `Buffer.concat()`, and the
466
+ * deprecated`new Buffer(size)` constructor only when `size` is less than or equal
467
+ * to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two).
468
+ *
469
+ * Use of this pre-allocated internal memory pool is a key difference between
470
+ * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
471
+ * 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
472
+ * than or equal to half `Buffer.poolSize`. The
473
+ * difference is subtle but can be important when an application requires the
474
+ * additional performance that `Buffer.allocUnsafe()` provides.
475
+ * @since v5.10.0
476
+ * @param size The desired length of the new `Buffer`.
477
+ */
478
+ allocUnsafe(size: number): Buffer;
479
+ /**
480
+ * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown. A zero-length `Buffer` is created
481
+ * if `size` is 0.
482
+ *
483
+ * The underlying memory for `Buffer` instances created in this way is _not_
484
+ * _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `buf.fill(0)` to initialize
485
+ * such `Buffer` instances with zeroes.
486
+ *
487
+ * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
488
+ * allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
489
+ * allows applications to avoid the garbage collection overhead of creating many
490
+ * individually allocated `Buffer` instances. This approach improves both
491
+ * performance and memory usage by eliminating the need to track and clean up as
492
+ * many individual `ArrayBuffer` objects.
493
+ *
494
+ * However, in the case where a developer may need to retain a small chunk of
495
+ * memory from a pool for an indeterminate amount of time, it may be appropriate
496
+ * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
497
+ * then copying out the relevant bits.
498
+ *
499
+ * ```js
500
+ * import { Buffer } from 'buffer';
501
+ *
502
+ * // Need to keep around a few small chunks of memory.
503
+ * const store = [];
504
+ *
505
+ * socket.on('readable', () => {
506
+ * let data;
507
+ * while (null !== (data = readable.read())) {
508
+ * // Allocate for retained data.
509
+ * const sb = Buffer.allocUnsafeSlow(10);
510
+ *
511
+ * // Copy the data into the new allocation.
512
+ * data.copy(sb, 0, 0, 10);
513
+ *
514
+ * store.push(sb);
515
+ * }
516
+ * });
517
+ * ```
518
+ *
519
+ * A `TypeError` will be thrown if `size` is not a number.
520
+ * @since v5.12.0
521
+ * @param size The desired length of the new `Buffer`.
522
+ */
523
+ allocUnsafeSlow(size: number): Buffer;
524
+ /**
525
+ * This is the size (in bytes) of pre-allocated internal `Buffer` instances used
526
+ * for pooling. This value may be modified.
527
+ * @since v0.11.3
528
+ */
529
+ poolSize: number;
530
+ }
531
+ interface Buffer extends Uint8Array {
532
+ /**
533
+ * 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
534
+ * not contain enough space to fit the entire string, only part of `string` will be
535
+ * written. However, partially encoded characters will not be written.
536
+ *
537
+ * ```js
538
+ * import { Buffer } from 'buffer';
539
+ *
540
+ * const buf = Buffer.alloc(256);
541
+ *
542
+ * const len = buf.write('\u00bd + \u00bc = \u00be', 0);
543
+ *
544
+ * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
545
+ * // Prints: 12 bytes: ½ + ¼ = ¾
546
+ *
547
+ * const buffer = Buffer.alloc(10);
548
+ *
549
+ * const length = buffer.write('abcd', 8);
550
+ *
551
+ * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
552
+ * // Prints: 2 bytes : ab
553
+ * ```
554
+ * @since v0.1.90
555
+ * @param string String to write to `buf`.
556
+ * @param [offset=0] Number of bytes to skip before starting to write `string`.
557
+ * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`).
558
+ * @param [encoding='utf8'] The character encoding of `string`.
559
+ * @return Number of bytes written.
560
+ */
561
+ write(string: string, encoding?: BufferEncoding): number;
562
+ write(string: string, offset: number, encoding?: BufferEncoding): number;
563
+ write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
564
+ /**
565
+ * 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`.
566
+ *
567
+ * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8,
568
+ * then each invalid byte is replaced with the replacement character `U+FFFD`.
569
+ *
570
+ * The maximum length of a string instance (in UTF-16 code units) is available
571
+ * as {@link constants.MAX_STRING_LENGTH}.
572
+ *
573
+ * ```js
574
+ * import { Buffer } from 'buffer';
575
+ *
576
+ * const buf1 = Buffer.allocUnsafe(26);
577
+ *
578
+ * for (let i = 0; i < 26; i++) {
579
+ * // 97 is the decimal ASCII value for 'a'.
580
+ * buf1[i] = i + 97;
581
+ * }
582
+ *
583
+ * console.log(buf1.toString('utf8'));
584
+ * // Prints: abcdefghijklmnopqrstuvwxyz
585
+ * console.log(buf1.toString('utf8', 0, 5));
586
+ * // Prints: abcde
587
+ *
588
+ * const buf2 = Buffer.from('tést');
589
+ *
590
+ * console.log(buf2.toString('hex'));
591
+ * // Prints: 74c3a97374
592
+ * console.log(buf2.toString('utf8', 0, 3));
593
+ * // Prints: té
594
+ * console.log(buf2.toString(undefined, 0, 3));
595
+ * // Prints: té
596
+ * ```
597
+ * @since v0.1.90
598
+ * @param [encoding='utf8'] The character encoding to use.
599
+ * @param [start=0] The byte offset to start decoding at.
600
+ * @param [end=buf.length] The byte offset to stop decoding at (not inclusive).
601
+ */
602
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
603
+ /**
604
+ * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls
605
+ * this function when stringifying a `Buffer` instance.
606
+ *
607
+ * `Buffer.from()` accepts objects in the format returned from this method.
608
+ * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`.
609
+ *
610
+ * ```js
611
+ * import { Buffer } from 'buffer';
612
+ *
613
+ * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
614
+ * const json = JSON.stringify(buf);
615
+ *
616
+ * console.log(json);
617
+ * // Prints: {"type":"Buffer","data":[1,2,3,4,5]}
618
+ *
619
+ * const copy = JSON.parse(json, (key, value) => {
620
+ * return value &#x26;&#x26; value.type === 'Buffer' ?
621
+ * Buffer.from(value) :
622
+ * value;
623
+ * });
624
+ *
625
+ * console.log(copy);
626
+ * // Prints: <Buffer 01 02 03 04 05>
627
+ * ```
628
+ * @since v0.9.2
629
+ */
630
+ toJSON(): {
631
+ type: 'Buffer';
632
+ data: number[];
633
+ };
634
+ /**
635
+ * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
636
+ *
637
+ * ```js
638
+ * import { Buffer } from 'buffer';
639
+ *
640
+ * const buf1 = Buffer.from('ABC');
641
+ * const buf2 = Buffer.from('414243', 'hex');
642
+ * const buf3 = Buffer.from('ABCD');
643
+ *
644
+ * console.log(buf1.equals(buf2));
645
+ * // Prints: true
646
+ * console.log(buf1.equals(buf3));
647
+ * // Prints: false
648
+ * ```
649
+ * @since v0.11.13
650
+ * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`.
651
+ */
652
+ equals(otherBuffer: Uint8Array): boolean;
653
+ /**
654
+ * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order.
655
+ * Comparison is based on the actual sequence of bytes in each `Buffer`.
656
+ *
657
+ * * `0` is returned if `target` is the same as `buf`
658
+ * * `1` is returned if `target` should come _before_`buf` when sorted.
659
+ * * `-1` is returned if `target` should come _after_`buf` when sorted.
660
+ *
661
+ * ```js
662
+ * import { Buffer } from 'buffer';
663
+ *
664
+ * const buf1 = Buffer.from('ABC');
665
+ * const buf2 = Buffer.from('BCD');
666
+ * const buf3 = Buffer.from('ABCD');
667
+ *
668
+ * console.log(buf1.compare(buf1));
669
+ * // Prints: 0
670
+ * console.log(buf1.compare(buf2));
671
+ * // Prints: -1
672
+ * console.log(buf1.compare(buf3));
673
+ * // Prints: -1
674
+ * console.log(buf2.compare(buf1));
675
+ * // Prints: 1
676
+ * console.log(buf2.compare(buf3));
677
+ * // Prints: 1
678
+ * console.log([buf1, buf2, buf3].sort(Buffer.compare));
679
+ * // Prints: [ <Buffer 41 42 43>, <Buffer 41 42 43 44>, <Buffer 42 43 44> ]
680
+ * // (This result is equal to: [buf1, buf3, buf2].)
681
+ * ```
682
+ *
683
+ * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
684
+ *
685
+ * ```js
686
+ * import { Buffer } from 'buffer';
687
+ *
688
+ * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
689
+ * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
690
+ *
691
+ * console.log(buf1.compare(buf2, 5, 9, 0, 4));
692
+ * // Prints: 0
693
+ * console.log(buf1.compare(buf2, 0, 6, 4));
694
+ * // Prints: -1
695
+ * console.log(buf1.compare(buf2, 5, 6, 5));
696
+ * // Prints: 1
697
+ * ```
698
+ *
699
+ * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
700
+ * @since v0.11.13
701
+ * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
702
+ * @param [targetStart=0] The offset within `target` at which to begin comparison.
703
+ * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive).
704
+ * @param [sourceStart=0] The offset within `buf` at which to begin comparison.
705
+ * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
706
+ */
707
+ compare(target: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
708
+ /**
709
+ * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
710
+ *
711
+ * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available
712
+ * for all TypedArrays, including Node.js `Buffer`s, although it takes
713
+ * different function arguments.
714
+ *
715
+ * ```js
716
+ * import { Buffer } from 'buffer';
717
+ *
718
+ * // Create two `Buffer` instances.
719
+ * const buf1 = Buffer.allocUnsafe(26);
720
+ * const buf2 = Buffer.allocUnsafe(26).fill('!');
721
+ *
722
+ * for (let i = 0; i < 26; i++) {
723
+ * // 97 is the decimal ASCII value for 'a'.
724
+ * buf1[i] = i + 97;
725
+ * }
726
+ *
727
+ * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.
728
+ * buf1.copy(buf2, 8, 16, 20);
729
+ * // This is equivalent to:
730
+ * // buf2.set(buf1.subarray(16, 20), 8);
731
+ *
732
+ * console.log(buf2.toString('ascii', 0, 25));
733
+ * // Prints: !!!!!!!!qrst!!!!!!!!!!!!!
734
+ * ```
735
+ *
736
+ * ```js
737
+ * import { Buffer } from 'buffer';
738
+ *
739
+ * // Create a `Buffer` and copy data from one region to an overlapping region
740
+ * // within the same `Buffer`.
741
+ *
742
+ * const buf = Buffer.allocUnsafe(26);
743
+ *
744
+ * for (let i = 0; i < 26; i++) {
745
+ * // 97 is the decimal ASCII value for 'a'.
746
+ * buf[i] = i + 97;
747
+ * }
748
+ *
749
+ * buf.copy(buf, 0, 4, 10);
750
+ *
751
+ * console.log(buf.toString());
752
+ * // Prints: efghijghijklmnopqrstuvwxyz
753
+ * ```
754
+ * @since v0.1.90
755
+ * @param target A `Buffer` or {@link Uint8Array} to copy into.
756
+ * @param [targetStart=0] The offset within `target` at which to begin writing.
757
+ * @param [sourceStart=0] The offset within `buf` from which to begin copying.
758
+ * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive).
759
+ * @return The number of bytes copied.
760
+ */
761
+ copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
762
+ /**
763
+ * Returns a new `Buffer` that references the same memory as the original, but
764
+ * offset and cropped by the `start` and `end` indices.
765
+ *
766
+ * This is the same behavior as `buf.subarray()`.
767
+ *
768
+ * This method is not compatible with the `Uint8Array.prototype.slice()`,
769
+ * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
770
+ *
771
+ * ```js
772
+ * import { Buffer } from 'buffer';
773
+ *
774
+ * const buf = Buffer.from('buffer');
775
+ *
776
+ * const copiedBuf = Uint8Array.prototype.slice.call(buf);
777
+ * copiedBuf[0]++;
778
+ * console.log(copiedBuf.toString());
779
+ * // Prints: cuffer
780
+ *
781
+ * console.log(buf.toString());
782
+ * // Prints: buffer
783
+ * ```
784
+ * @since v0.3.0
785
+ * @param [start=0] Where the new `Buffer` will start.
786
+ * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
787
+ */
788
+ slice(start?: number, end?: number): Buffer;
789
+ /**
790
+ * Returns a new `Buffer` that references the same memory as the original, but
791
+ * offset and cropped by the `start` and `end` indices.
792
+ *
793
+ * Specifying `end` greater than `buf.length` will return the same result as
794
+ * that of `end` equal to `buf.length`.
795
+ *
796
+ * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
797
+ *
798
+ * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
799
+ *
800
+ * ```js
801
+ * import { Buffer } from 'buffer';
802
+ *
803
+ * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
804
+ * // from the original `Buffer`.
805
+ *
806
+ * const buf1 = Buffer.allocUnsafe(26);
807
+ *
808
+ * for (let i = 0; i < 26; i++) {
809
+ * // 97 is the decimal ASCII value for 'a'.
810
+ * buf1[i] = i + 97;
811
+ * }
812
+ *
813
+ * const buf2 = buf1.subarray(0, 3);
814
+ *
815
+ * console.log(buf2.toString('ascii', 0, buf2.length));
816
+ * // Prints: abc
817
+ *
818
+ * buf1[0] = 33;
819
+ *
820
+ * console.log(buf2.toString('ascii', 0, buf2.length));
821
+ * // Prints: !bc
822
+ * ```
823
+ *
824
+ * Specifying negative indexes causes the slice to be generated relative to the
825
+ * end of `buf` rather than the beginning.
826
+ *
827
+ * ```js
828
+ * import { Buffer } from 'buffer';
829
+ *
830
+ * const buf = Buffer.from('buffer');
831
+ *
832
+ * console.log(buf.subarray(-6, -1).toString());
833
+ * // Prints: buffe
834
+ * // (Equivalent to buf.subarray(0, 5).)
835
+ *
836
+ * console.log(buf.subarray(-6, -2).toString());
837
+ * // Prints: buff
838
+ * // (Equivalent to buf.subarray(0, 4).)
839
+ *
840
+ * console.log(buf.subarray(-5, -2).toString());
841
+ * // Prints: uff
842
+ * // (Equivalent to buf.subarray(1, 4).)
843
+ * ```
844
+ * @since v3.0.0
845
+ * @param [start=0] Where the new `Buffer` will start.
846
+ * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
847
+ */
848
+ subarray(start?: number, end?: number): Buffer;
849
+ /**
850
+ * Writes `value` to `buf` at the specified `offset` as big-endian.
851
+ *
852
+ * `value` is interpreted and written as a two's complement signed integer.
853
+ *
854
+ * ```js
855
+ * import { Buffer } from 'buffer';
856
+ *
857
+ * const buf = Buffer.allocUnsafe(8);
858
+ *
859
+ * buf.writeBigInt64BE(0x0102030405060708n, 0);
860
+ *
861
+ * console.log(buf);
862
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
863
+ * ```
864
+ * @since v12.0.0, v10.20.0
865
+ * @param value Number to be written to `buf`.
866
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
867
+ * @return `offset` plus the number of bytes written.
868
+ */
869
+ writeBigInt64BE(value: bigint, offset?: number): number;
870
+ /**
871
+ * Writes `value` to `buf` at the specified `offset` as little-endian.
872
+ *
873
+ * `value` is interpreted and written as a two's complement signed integer.
874
+ *
875
+ * ```js
876
+ * import { Buffer } from 'buffer';
877
+ *
878
+ * const buf = Buffer.allocUnsafe(8);
879
+ *
880
+ * buf.writeBigInt64LE(0x0102030405060708n, 0);
881
+ *
882
+ * console.log(buf);
883
+ * // Prints: <Buffer 08 07 06 05 04 03 02 01>
884
+ * ```
885
+ * @since v12.0.0, v10.20.0
886
+ * @param value Number to be written to `buf`.
887
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
888
+ * @return `offset` plus the number of bytes written.
889
+ */
890
+ writeBigInt64LE(value: bigint, offset?: number): number;
891
+ /**
892
+ * Writes `value` to `buf` at the specified `offset` as big-endian.
893
+ *
894
+ * This function is also available under the `writeBigUint64BE` alias.
895
+ *
896
+ * ```js
897
+ * import { Buffer } from 'buffer';
898
+ *
899
+ * const buf = Buffer.allocUnsafe(8);
900
+ *
901
+ * buf.writeBigUInt64BE(0xdecafafecacefaden, 0);
902
+ *
903
+ * console.log(buf);
904
+ * // Prints: <Buffer de ca fa fe ca ce fa de>
905
+ * ```
906
+ * @since v12.0.0, v10.20.0
907
+ * @param value Number to be written to `buf`.
908
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
909
+ * @return `offset` plus the number of bytes written.
910
+ */
911
+ writeBigUInt64BE(value: bigint, offset?: number): number;
912
+ /**
913
+ * Writes `value` to `buf` at the specified `offset` as little-endian
914
+ *
915
+ * ```js
916
+ * import { Buffer } from 'buffer';
917
+ *
918
+ * const buf = Buffer.allocUnsafe(8);
919
+ *
920
+ * buf.writeBigUInt64LE(0xdecafafecacefaden, 0);
921
+ *
922
+ * console.log(buf);
923
+ * // Prints: <Buffer de fa ce ca fe fa ca de>
924
+ * ```
925
+ *
926
+ * This function is also available under the `writeBigUint64LE` alias.
927
+ * @since v12.0.0, v10.20.0
928
+ * @param value Number to be written to `buf`.
929
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
930
+ * @return `offset` plus the number of bytes written.
931
+ */
932
+ writeBigUInt64LE(value: bigint, offset?: number): number;
933
+ /**
934
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
935
+ * when `value` is anything other than an unsigned integer.
936
+ *
937
+ * This function is also available under the `writeUintLE` alias.
938
+ *
939
+ * ```js
940
+ * import { Buffer } from 'buffer';
941
+ *
942
+ * const buf = Buffer.allocUnsafe(6);
943
+ *
944
+ * buf.writeUIntLE(0x1234567890ab, 0, 6);
945
+ *
946
+ * console.log(buf);
947
+ * // Prints: <Buffer ab 90 78 56 34 12>
948
+ * ```
949
+ * @since v0.5.5
950
+ * @param value Number to be written to `buf`.
951
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
952
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
953
+ * @return `offset` plus the number of bytes written.
954
+ */
955
+ writeUIntLE(value: number, offset: number, byteLength: number): number;
956
+ /**
957
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined
958
+ * when `value` is anything other than an unsigned integer.
959
+ *
960
+ * This function is also available under the `writeUintBE` alias.
961
+ *
962
+ * ```js
963
+ * import { Buffer } from 'buffer';
964
+ *
965
+ * const buf = Buffer.allocUnsafe(6);
966
+ *
967
+ * buf.writeUIntBE(0x1234567890ab, 0, 6);
968
+ *
969
+ * console.log(buf);
970
+ * // Prints: <Buffer 12 34 56 78 90 ab>
971
+ * ```
972
+ * @since v0.5.5
973
+ * @param value Number to be written to `buf`.
974
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
975
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
976
+ * @return `offset` plus the number of bytes written.
977
+ */
978
+ writeUIntBE(value: number, offset: number, byteLength: number): number;
979
+ /**
980
+ * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
981
+ * when `value` is anything other than a signed integer.
982
+ *
983
+ * ```js
984
+ * import { Buffer } from 'buffer';
985
+ *
986
+ * const buf = Buffer.allocUnsafe(6);
987
+ *
988
+ * buf.writeIntLE(0x1234567890ab, 0, 6);
989
+ *
990
+ * console.log(buf);
991
+ * // Prints: <Buffer ab 90 78 56 34 12>
992
+ * ```
993
+ * @since v0.11.15
994
+ * @param value Number to be written to `buf`.
995
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
996
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
997
+ * @return `offset` plus the number of bytes written.
998
+ */
999
+ writeIntLE(value: number, offset: number, byteLength: number): number;
1000
+ /**
1001
+ * 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
1002
+ * signed integer.
1003
+ *
1004
+ * ```js
1005
+ * import { Buffer } from 'buffer';
1006
+ *
1007
+ * const buf = Buffer.allocUnsafe(6);
1008
+ *
1009
+ * buf.writeIntBE(0x1234567890ab, 0, 6);
1010
+ *
1011
+ * console.log(buf);
1012
+ * // Prints: <Buffer 12 34 56 78 90 ab>
1013
+ * ```
1014
+ * @since v0.11.15
1015
+ * @param value Number to be written to `buf`.
1016
+ * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
1017
+ * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
1018
+ * @return `offset` plus the number of bytes written.
1019
+ */
1020
+ writeIntBE(value: number, offset: number, byteLength: number): number;
1021
+ /**
1022
+ * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`.
1023
+ *
1024
+ * This function is also available under the `readBigUint64BE` alias.
1025
+ *
1026
+ * ```js
1027
+ * import { Buffer } from 'buffer';
1028
+ *
1029
+ * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1030
+ *
1031
+ * console.log(buf.readBigUInt64BE(0));
1032
+ * // Prints: 4294967295n
1033
+ * ```
1034
+ * @since v12.0.0, v10.20.0
1035
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1036
+ */
1037
+ readBigUInt64BE(offset?: number): bigint;
1038
+ /**
1039
+ * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`.
1040
+ *
1041
+ * This function is also available under the `readBigUint64LE` alias.
1042
+ *
1043
+ * ```js
1044
+ * import { Buffer } from 'buffer';
1045
+ *
1046
+ * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1047
+ *
1048
+ * console.log(buf.readBigUInt64LE(0));
1049
+ * // Prints: 18446744069414584320n
1050
+ * ```
1051
+ * @since v12.0.0, v10.20.0
1052
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1053
+ */
1054
+ readBigUInt64LE(offset?: number): bigint;
1055
+ /**
1056
+ * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`.
1057
+ *
1058
+ * Integers read from a `Buffer` are interpreted as two's complement signed
1059
+ * values.
1060
+ * @since v12.0.0, v10.20.0
1061
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1062
+ */
1063
+ readBigInt64BE(offset?: number): bigint;
1064
+ /**
1065
+ * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`.
1066
+ *
1067
+ * Integers read from a `Buffer` are interpreted as two's complement signed
1068
+ * values.
1069
+ * @since v12.0.0, v10.20.0
1070
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
1071
+ */
1072
+ readBigInt64LE(offset?: number): bigint;
1073
+ /**
1074
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
1075
+ * up to 48 bits of accuracy.
1076
+ *
1077
+ * This function is also available under the `readUintLE` alias.
1078
+ *
1079
+ * ```js
1080
+ * import { Buffer } from 'buffer';
1081
+ *
1082
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1083
+ *
1084
+ * console.log(buf.readUIntLE(0, 6).toString(16));
1085
+ * // Prints: ab9078563412
1086
+ * ```
1087
+ * @since v0.11.15
1088
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1089
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1090
+ */
1091
+ readUIntLE(offset: number, byteLength: number): number;
1092
+ /**
1093
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
1094
+ * up to 48 bits of accuracy.
1095
+ *
1096
+ * This function is also available under the `readUintBE` alias.
1097
+ *
1098
+ * ```js
1099
+ * import { Buffer } from 'buffer';
1100
+ *
1101
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1102
+ *
1103
+ * console.log(buf.readUIntBE(0, 6).toString(16));
1104
+ * // Prints: 1234567890ab
1105
+ * console.log(buf.readUIntBE(1, 6).toString(16));
1106
+ * // Throws ERR_OUT_OF_RANGE.
1107
+ * ```
1108
+ * @since v0.11.15
1109
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1110
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1111
+ */
1112
+ readUIntBE(offset: number, byteLength: number): number;
1113
+ /**
1114
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value
1115
+ * supporting up to 48 bits of accuracy.
1116
+ *
1117
+ * ```js
1118
+ * import { Buffer } from 'buffer';
1119
+ *
1120
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1121
+ *
1122
+ * console.log(buf.readIntLE(0, 6).toString(16));
1123
+ * // Prints: -546f87a9cbee
1124
+ * ```
1125
+ * @since v0.11.15
1126
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1127
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1128
+ */
1129
+ readIntLE(offset: number, byteLength: number): number;
1130
+ /**
1131
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value
1132
+ * supporting up to 48 bits of accuracy.
1133
+ *
1134
+ * ```js
1135
+ * import { Buffer } from 'buffer';
1136
+ *
1137
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1138
+ *
1139
+ * console.log(buf.readIntBE(0, 6).toString(16));
1140
+ * // Prints: 1234567890ab
1141
+ * console.log(buf.readIntBE(1, 6).toString(16));
1142
+ * // Throws ERR_OUT_OF_RANGE.
1143
+ * console.log(buf.readIntBE(1, 0).toString(16));
1144
+ * // Throws ERR_OUT_OF_RANGE.
1145
+ * ```
1146
+ * @since v0.11.15
1147
+ * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
1148
+ * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
1149
+ */
1150
+ readIntBE(offset: number, byteLength: number): number;
1151
+ /**
1152
+ * Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
1153
+ *
1154
+ * This function is also available under the `readUint8` alias.
1155
+ *
1156
+ * ```js
1157
+ * import { Buffer } from 'buffer';
1158
+ *
1159
+ * const buf = Buffer.from([1, -2]);
1160
+ *
1161
+ * console.log(buf.readUInt8(0));
1162
+ * // Prints: 1
1163
+ * console.log(buf.readUInt8(1));
1164
+ * // Prints: 254
1165
+ * console.log(buf.readUInt8(2));
1166
+ * // Throws ERR_OUT_OF_RANGE.
1167
+ * ```
1168
+ * @since v0.5.0
1169
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
1170
+ */
1171
+ readUInt8(offset?: number): number;
1172
+ /**
1173
+ * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
1174
+ *
1175
+ * This function is also available under the `readUint16LE` alias.
1176
+ *
1177
+ * ```js
1178
+ * import { Buffer } from 'buffer';
1179
+ *
1180
+ * const buf = Buffer.from([0x12, 0x34, 0x56]);
1181
+ *
1182
+ * console.log(buf.readUInt16LE(0).toString(16));
1183
+ * // Prints: 3412
1184
+ * console.log(buf.readUInt16LE(1).toString(16));
1185
+ * // Prints: 5634
1186
+ * console.log(buf.readUInt16LE(2).toString(16));
1187
+ * // Throws ERR_OUT_OF_RANGE.
1188
+ * ```
1189
+ * @since v0.5.5
1190
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1191
+ */
1192
+ readUInt16LE(offset?: number): number;
1193
+ /**
1194
+ * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`.
1195
+ *
1196
+ * This function is also available under the `readUint16BE` alias.
1197
+ *
1198
+ * ```js
1199
+ * import { Buffer } from 'buffer';
1200
+ *
1201
+ * const buf = Buffer.from([0x12, 0x34, 0x56]);
1202
+ *
1203
+ * console.log(buf.readUInt16BE(0).toString(16));
1204
+ * // Prints: 1234
1205
+ * console.log(buf.readUInt16BE(1).toString(16));
1206
+ * // Prints: 3456
1207
+ * ```
1208
+ * @since v0.5.5
1209
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1210
+ */
1211
+ readUInt16BE(offset?: number): number;
1212
+ /**
1213
+ * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`.
1214
+ *
1215
+ * This function is also available under the `readUint32LE` alias.
1216
+ *
1217
+ * ```js
1218
+ * import { Buffer } from 'buffer';
1219
+ *
1220
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1221
+ *
1222
+ * console.log(buf.readUInt32LE(0).toString(16));
1223
+ * // Prints: 78563412
1224
+ * console.log(buf.readUInt32LE(1).toString(16));
1225
+ * // Throws ERR_OUT_OF_RANGE.
1226
+ * ```
1227
+ * @since v0.5.5
1228
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1229
+ */
1230
+ readUInt32LE(offset?: number): number;
1231
+ /**
1232
+ * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`.
1233
+ *
1234
+ * This function is also available under the `readUint32BE` alias.
1235
+ *
1236
+ * ```js
1237
+ * import { Buffer } from 'buffer';
1238
+ *
1239
+ * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1240
+ *
1241
+ * console.log(buf.readUInt32BE(0).toString(16));
1242
+ * // Prints: 12345678
1243
+ * ```
1244
+ * @since v0.5.5
1245
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1246
+ */
1247
+ readUInt32BE(offset?: number): number;
1248
+ /**
1249
+ * Reads a signed 8-bit integer from `buf` at the specified `offset`.
1250
+ *
1251
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1252
+ *
1253
+ * ```js
1254
+ * import { Buffer } from 'buffer';
1255
+ *
1256
+ * const buf = Buffer.from([-1, 5]);
1257
+ *
1258
+ * console.log(buf.readInt8(0));
1259
+ * // Prints: -1
1260
+ * console.log(buf.readInt8(1));
1261
+ * // Prints: 5
1262
+ * console.log(buf.readInt8(2));
1263
+ * // Throws ERR_OUT_OF_RANGE.
1264
+ * ```
1265
+ * @since v0.5.0
1266
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
1267
+ */
1268
+ readInt8(offset?: number): number;
1269
+ /**
1270
+ * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`.
1271
+ *
1272
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1273
+ *
1274
+ * ```js
1275
+ * import { Buffer } from 'buffer';
1276
+ *
1277
+ * const buf = Buffer.from([0, 5]);
1278
+ *
1279
+ * console.log(buf.readInt16LE(0));
1280
+ * // Prints: 1280
1281
+ * console.log(buf.readInt16LE(1));
1282
+ * // Throws ERR_OUT_OF_RANGE.
1283
+ * ```
1284
+ * @since v0.5.5
1285
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1286
+ */
1287
+ readInt16LE(offset?: number): number;
1288
+ /**
1289
+ * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`.
1290
+ *
1291
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1292
+ *
1293
+ * ```js
1294
+ * import { Buffer } from 'buffer';
1295
+ *
1296
+ * const buf = Buffer.from([0, 5]);
1297
+ *
1298
+ * console.log(buf.readInt16BE(0));
1299
+ * // Prints: 5
1300
+ * ```
1301
+ * @since v0.5.5
1302
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
1303
+ */
1304
+ readInt16BE(offset?: number): number;
1305
+ /**
1306
+ * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`.
1307
+ *
1308
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1309
+ *
1310
+ * ```js
1311
+ * import { Buffer } from 'buffer';
1312
+ *
1313
+ * const buf = Buffer.from([0, 0, 0, 5]);
1314
+ *
1315
+ * console.log(buf.readInt32LE(0));
1316
+ * // Prints: 83886080
1317
+ * console.log(buf.readInt32LE(1));
1318
+ * // Throws ERR_OUT_OF_RANGE.
1319
+ * ```
1320
+ * @since v0.5.5
1321
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1322
+ */
1323
+ readInt32LE(offset?: number): number;
1324
+ /**
1325
+ * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`.
1326
+ *
1327
+ * Integers read from a `Buffer` are interpreted as two's complement signed values.
1328
+ *
1329
+ * ```js
1330
+ * import { Buffer } from 'buffer';
1331
+ *
1332
+ * const buf = Buffer.from([0, 0, 0, 5]);
1333
+ *
1334
+ * console.log(buf.readInt32BE(0));
1335
+ * // Prints: 5
1336
+ * ```
1337
+ * @since v0.5.5
1338
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1339
+ */
1340
+ readInt32BE(offset?: number): number;
1341
+ /**
1342
+ * Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
1343
+ *
1344
+ * ```js
1345
+ * import { Buffer } from 'buffer';
1346
+ *
1347
+ * const buf = Buffer.from([1, 2, 3, 4]);
1348
+ *
1349
+ * console.log(buf.readFloatLE(0));
1350
+ * // Prints: 1.539989614439558e-36
1351
+ * console.log(buf.readFloatLE(1));
1352
+ * // Throws ERR_OUT_OF_RANGE.
1353
+ * ```
1354
+ * @since v0.11.15
1355
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1356
+ */
1357
+ readFloatLE(offset?: number): number;
1358
+ /**
1359
+ * Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
1360
+ *
1361
+ * ```js
1362
+ * import { Buffer } from 'buffer';
1363
+ *
1364
+ * const buf = Buffer.from([1, 2, 3, 4]);
1365
+ *
1366
+ * console.log(buf.readFloatBE(0));
1367
+ * // Prints: 2.387939260590663e-38
1368
+ * ```
1369
+ * @since v0.11.15
1370
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
1371
+ */
1372
+ readFloatBE(offset?: number): number;
1373
+ /**
1374
+ * Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
1375
+ *
1376
+ * ```js
1377
+ * import { Buffer } from 'buffer';
1378
+ *
1379
+ * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1380
+ *
1381
+ * console.log(buf.readDoubleLE(0));
1382
+ * // Prints: 5.447603722011605e-270
1383
+ * console.log(buf.readDoubleLE(1));
1384
+ * // Throws ERR_OUT_OF_RANGE.
1385
+ * ```
1386
+ * @since v0.11.15
1387
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
1388
+ */
1389
+ readDoubleLE(offset?: number): number;
1390
+ /**
1391
+ * Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
1392
+ *
1393
+ * ```js
1394
+ * import { Buffer } from 'buffer';
1395
+ *
1396
+ * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1397
+ *
1398
+ * console.log(buf.readDoubleBE(0));
1399
+ * // Prints: 8.20788039913184e-304
1400
+ * ```
1401
+ * @since v0.11.15
1402
+ * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
1403
+ */
1404
+ readDoubleBE(offset?: number): number;
1405
+ reverse(): this;
1406
+ /**
1407
+ * Interprets `buf` as an array of unsigned 16-bit integers and swaps the
1408
+ * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
1409
+ *
1410
+ * ```js
1411
+ * import { Buffer } from 'buffer';
1412
+ *
1413
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1414
+ *
1415
+ * console.log(buf1);
1416
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1417
+ *
1418
+ * buf1.swap16();
1419
+ *
1420
+ * console.log(buf1);
1421
+ * // Prints: <Buffer 02 01 04 03 06 05 08 07>
1422
+ *
1423
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1424
+ *
1425
+ * buf2.swap16();
1426
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1427
+ * ```
1428
+ *
1429
+ * One convenient use of `buf.swap16()` is to perform a fast in-place conversion
1430
+ * between UTF-16 little-endian and UTF-16 big-endian:
1431
+ *
1432
+ * ```js
1433
+ * import { Buffer } from 'buffer';
1434
+ *
1435
+ * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
1436
+ * buf.swap16(); // Convert to big-endian UTF-16 text.
1437
+ * ```
1438
+ * @since v5.10.0
1439
+ * @return A reference to `buf`.
1440
+ */
1441
+ swap16(): Buffer;
1442
+ /**
1443
+ * Interprets `buf` as an array of unsigned 32-bit integers and swaps the
1444
+ * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
1445
+ *
1446
+ * ```js
1447
+ * import { Buffer } from 'buffer';
1448
+ *
1449
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1450
+ *
1451
+ * console.log(buf1);
1452
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1453
+ *
1454
+ * buf1.swap32();
1455
+ *
1456
+ * console.log(buf1);
1457
+ * // Prints: <Buffer 04 03 02 01 08 07 06 05>
1458
+ *
1459
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1460
+ *
1461
+ * buf2.swap32();
1462
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1463
+ * ```
1464
+ * @since v5.10.0
1465
+ * @return A reference to `buf`.
1466
+ */
1467
+ swap32(): Buffer;
1468
+ /**
1469
+ * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
1470
+ * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
1471
+ *
1472
+ * ```js
1473
+ * import { Buffer } from 'buffer';
1474
+ *
1475
+ * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1476
+ *
1477
+ * console.log(buf1);
1478
+ * // Prints: <Buffer 01 02 03 04 05 06 07 08>
1479
+ *
1480
+ * buf1.swap64();
1481
+ *
1482
+ * console.log(buf1);
1483
+ * // Prints: <Buffer 08 07 06 05 04 03 02 01>
1484
+ *
1485
+ * const buf2 = Buffer.from([0x1, 0x2, 0x3]);
1486
+ *
1487
+ * buf2.swap64();
1488
+ * // Throws ERR_INVALID_BUFFER_SIZE.
1489
+ * ```
1490
+ * @since v6.3.0
1491
+ * @return A reference to `buf`.
1492
+ */
1493
+ swap64(): Buffer;
1494
+ /**
1495
+ * Writes `value` to `buf` at the specified `offset`. `value` must be a
1496
+ * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
1497
+ * other than an unsigned 8-bit integer.
1498
+ *
1499
+ * This function is also available under the `writeUint8` alias.
1500
+ *
1501
+ * ```js
1502
+ * import { Buffer } from 'buffer';
1503
+ *
1504
+ * const buf = Buffer.allocUnsafe(4);
1505
+ *
1506
+ * buf.writeUInt8(0x3, 0);
1507
+ * buf.writeUInt8(0x4, 1);
1508
+ * buf.writeUInt8(0x23, 2);
1509
+ * buf.writeUInt8(0x42, 3);
1510
+ *
1511
+ * console.log(buf);
1512
+ * // Prints: <Buffer 03 04 23 42>
1513
+ * ```
1514
+ * @since v0.5.0
1515
+ * @param value Number to be written to `buf`.
1516
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
1517
+ * @return `offset` plus the number of bytes written.
1518
+ */
1519
+ writeUInt8(value: number, offset?: number): number;
1520
+ /**
1521
+ * 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
1522
+ * anything other than an unsigned 16-bit integer.
1523
+ *
1524
+ * This function is also available under the `writeUint16LE` alias.
1525
+ *
1526
+ * ```js
1527
+ * import { Buffer } from 'buffer';
1528
+ *
1529
+ * const buf = Buffer.allocUnsafe(4);
1530
+ *
1531
+ * buf.writeUInt16LE(0xdead, 0);
1532
+ * buf.writeUInt16LE(0xbeef, 2);
1533
+ *
1534
+ * console.log(buf);
1535
+ * // Prints: <Buffer ad de ef be>
1536
+ * ```
1537
+ * @since v0.5.5
1538
+ * @param value Number to be written to `buf`.
1539
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1540
+ * @return `offset` plus the number of bytes written.
1541
+ */
1542
+ writeUInt16LE(value: number, offset?: number): number;
1543
+ /**
1544
+ * 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
1545
+ * unsigned 16-bit integer.
1546
+ *
1547
+ * This function is also available under the `writeUint16BE` alias.
1548
+ *
1549
+ * ```js
1550
+ * import { Buffer } from 'buffer';
1551
+ *
1552
+ * const buf = Buffer.allocUnsafe(4);
1553
+ *
1554
+ * buf.writeUInt16BE(0xdead, 0);
1555
+ * buf.writeUInt16BE(0xbeef, 2);
1556
+ *
1557
+ * console.log(buf);
1558
+ * // Prints: <Buffer de ad be ef>
1559
+ * ```
1560
+ * @since v0.5.5
1561
+ * @param value Number to be written to `buf`.
1562
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1563
+ * @return `offset` plus the number of bytes written.
1564
+ */
1565
+ writeUInt16BE(value: number, offset?: number): number;
1566
+ /**
1567
+ * 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
1568
+ * anything other than an unsigned 32-bit integer.
1569
+ *
1570
+ * This function is also available under the `writeUint32LE` alias.
1571
+ *
1572
+ * ```js
1573
+ * import { Buffer } from 'buffer';
1574
+ *
1575
+ * const buf = Buffer.allocUnsafe(4);
1576
+ *
1577
+ * buf.writeUInt32LE(0xfeedface, 0);
1578
+ *
1579
+ * console.log(buf);
1580
+ * // Prints: <Buffer ce fa ed fe>
1581
+ * ```
1582
+ * @since v0.5.5
1583
+ * @param value Number to be written to `buf`.
1584
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1585
+ * @return `offset` plus the number of bytes written.
1586
+ */
1587
+ writeUInt32LE(value: number, offset?: number): number;
1588
+ /**
1589
+ * 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
1590
+ * unsigned 32-bit integer.
1591
+ *
1592
+ * This function is also available under the `writeUint32BE` alias.
1593
+ *
1594
+ * ```js
1595
+ * import { Buffer } from 'buffer';
1596
+ *
1597
+ * const buf = Buffer.allocUnsafe(4);
1598
+ *
1599
+ * buf.writeUInt32BE(0xfeedface, 0);
1600
+ *
1601
+ * console.log(buf);
1602
+ * // Prints: <Buffer fe ed fa ce>
1603
+ * ```
1604
+ * @since v0.5.5
1605
+ * @param value Number to be written to `buf`.
1606
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1607
+ * @return `offset` plus the number of bytes written.
1608
+ */
1609
+ writeUInt32BE(value: number, offset?: number): number;
1610
+ /**
1611
+ * Writes `value` to `buf` at the specified `offset`. `value` must be a valid
1612
+ * signed 8-bit integer. Behavior is undefined when `value` is anything other than
1613
+ * a signed 8-bit integer.
1614
+ *
1615
+ * `value` is interpreted and written as a two's complement signed integer.
1616
+ *
1617
+ * ```js
1618
+ * import { Buffer } from 'buffer';
1619
+ *
1620
+ * const buf = Buffer.allocUnsafe(2);
1621
+ *
1622
+ * buf.writeInt8(2, 0);
1623
+ * buf.writeInt8(-2, 1);
1624
+ *
1625
+ * console.log(buf);
1626
+ * // Prints: <Buffer 02 fe>
1627
+ * ```
1628
+ * @since v0.5.0
1629
+ * @param value Number to be written to `buf`.
1630
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
1631
+ * @return `offset` plus the number of bytes written.
1632
+ */
1633
+ writeInt8(value: number, offset?: number): number;
1634
+ /**
1635
+ * 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
1636
+ * anything other than a signed 16-bit integer.
1637
+ *
1638
+ * The `value` is interpreted and written as a two's complement signed integer.
1639
+ *
1640
+ * ```js
1641
+ * import { Buffer } from 'buffer';
1642
+ *
1643
+ * const buf = Buffer.allocUnsafe(2);
1644
+ *
1645
+ * buf.writeInt16LE(0x0304, 0);
1646
+ *
1647
+ * console.log(buf);
1648
+ * // Prints: <Buffer 04 03>
1649
+ * ```
1650
+ * @since v0.5.5
1651
+ * @param value Number to be written to `buf`.
1652
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1653
+ * @return `offset` plus the number of bytes written.
1654
+ */
1655
+ writeInt16LE(value: number, offset?: number): number;
1656
+ /**
1657
+ * 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
1658
+ * anything other than a signed 16-bit integer.
1659
+ *
1660
+ * The `value` is interpreted and written as a two's complement signed integer.
1661
+ *
1662
+ * ```js
1663
+ * import { Buffer } from 'buffer';
1664
+ *
1665
+ * const buf = Buffer.allocUnsafe(2);
1666
+ *
1667
+ * buf.writeInt16BE(0x0102, 0);
1668
+ *
1669
+ * console.log(buf);
1670
+ * // Prints: <Buffer 01 02>
1671
+ * ```
1672
+ * @since v0.5.5
1673
+ * @param value Number to be written to `buf`.
1674
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
1675
+ * @return `offset` plus the number of bytes written.
1676
+ */
1677
+ writeInt16BE(value: number, offset?: number): number;
1678
+ /**
1679
+ * 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
1680
+ * anything other than a signed 32-bit integer.
1681
+ *
1682
+ * The `value` is interpreted and written as a two's complement signed integer.
1683
+ *
1684
+ * ```js
1685
+ * import { Buffer } from 'buffer';
1686
+ *
1687
+ * const buf = Buffer.allocUnsafe(4);
1688
+ *
1689
+ * buf.writeInt32LE(0x05060708, 0);
1690
+ *
1691
+ * console.log(buf);
1692
+ * // Prints: <Buffer 08 07 06 05>
1693
+ * ```
1694
+ * @since v0.5.5
1695
+ * @param value Number to be written to `buf`.
1696
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1697
+ * @return `offset` plus the number of bytes written.
1698
+ */
1699
+ writeInt32LE(value: number, offset?: number): number;
1700
+ /**
1701
+ * 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
1702
+ * anything other than a signed 32-bit integer.
1703
+ *
1704
+ * The `value` is interpreted and written as a two's complement signed integer.
1705
+ *
1706
+ * ```js
1707
+ * import { Buffer } from 'buffer';
1708
+ *
1709
+ * const buf = Buffer.allocUnsafe(4);
1710
+ *
1711
+ * buf.writeInt32BE(0x01020304, 0);
1712
+ *
1713
+ * console.log(buf);
1714
+ * // Prints: <Buffer 01 02 03 04>
1715
+ * ```
1716
+ * @since v0.5.5
1717
+ * @param value Number to be written to `buf`.
1718
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1719
+ * @return `offset` plus the number of bytes written.
1720
+ */
1721
+ writeInt32BE(value: number, offset?: number): number;
1722
+ /**
1723
+ * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is
1724
+ * undefined when `value` is anything other than a JavaScript number.
1725
+ *
1726
+ * ```js
1727
+ * import { Buffer } from 'buffer';
1728
+ *
1729
+ * const buf = Buffer.allocUnsafe(4);
1730
+ *
1731
+ * buf.writeFloatLE(0xcafebabe, 0);
1732
+ *
1733
+ * console.log(buf);
1734
+ * // Prints: <Buffer bb fe 4a 4f>
1735
+ * ```
1736
+ * @since v0.11.15
1737
+ * @param value Number to be written to `buf`.
1738
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1739
+ * @return `offset` plus the number of bytes written.
1740
+ */
1741
+ writeFloatLE(value: number, offset?: number): number;
1742
+ /**
1743
+ * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is
1744
+ * undefined when `value` is anything other than a JavaScript number.
1745
+ *
1746
+ * ```js
1747
+ * import { Buffer } from 'buffer';
1748
+ *
1749
+ * const buf = Buffer.allocUnsafe(4);
1750
+ *
1751
+ * buf.writeFloatBE(0xcafebabe, 0);
1752
+ *
1753
+ * console.log(buf);
1754
+ * // Prints: <Buffer 4f 4a fe bb>
1755
+ * ```
1756
+ * @since v0.11.15
1757
+ * @param value Number to be written to `buf`.
1758
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
1759
+ * @return `offset` plus the number of bytes written.
1760
+ */
1761
+ writeFloatBE(value: number, offset?: number): number;
1762
+ /**
1763
+ * 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
1764
+ * other than a JavaScript number.
1765
+ *
1766
+ * ```js
1767
+ * import { Buffer } from 'buffer';
1768
+ *
1769
+ * const buf = Buffer.allocUnsafe(8);
1770
+ *
1771
+ * buf.writeDoubleLE(123.456, 0);
1772
+ *
1773
+ * console.log(buf);
1774
+ * // Prints: <Buffer 77 be 9f 1a 2f dd 5e 40>
1775
+ * ```
1776
+ * @since v0.11.15
1777
+ * @param value Number to be written to `buf`.
1778
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
1779
+ * @return `offset` plus the number of bytes written.
1780
+ */
1781
+ writeDoubleLE(value: number, offset?: number): number;
1782
+ /**
1783
+ * 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
1784
+ * other than a JavaScript number.
1785
+ *
1786
+ * ```js
1787
+ * import { Buffer } from 'buffer';
1788
+ *
1789
+ * const buf = Buffer.allocUnsafe(8);
1790
+ *
1791
+ * buf.writeDoubleBE(123.456, 0);
1792
+ *
1793
+ * console.log(buf);
1794
+ * // Prints: <Buffer 40 5e dd 2f 1a 9f be 77>
1795
+ * ```
1796
+ * @since v0.11.15
1797
+ * @param value Number to be written to `buf`.
1798
+ * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
1799
+ * @return `offset` plus the number of bytes written.
1800
+ */
1801
+ writeDoubleBE(value: number, offset?: number): number;
1802
+ /**
1803
+ * Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
1804
+ * the entire `buf` will be filled:
1805
+ *
1806
+ * ```js
1807
+ * import { Buffer } from 'buffer';
1808
+ *
1809
+ * // Fill a `Buffer` with the ASCII character 'h'.
1810
+ *
1811
+ * const b = Buffer.allocUnsafe(50).fill('h');
1812
+ *
1813
+ * console.log(b.toString());
1814
+ * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
1815
+ * ```
1816
+ *
1817
+ * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or
1818
+ * integer. If the resulting integer is greater than `255` (decimal), `buf` will be
1819
+ * filled with `value &#x26; 255`.
1820
+ *
1821
+ * If the final write of a `fill()` operation falls on a multi-byte character,
1822
+ * then only the bytes of that character that fit into `buf` are written:
1823
+ *
1824
+ * ```js
1825
+ * import { Buffer } from 'buffer';
1826
+ *
1827
+ * // Fill a `Buffer` with character that takes up two bytes in UTF-8.
1828
+ *
1829
+ * console.log(Buffer.allocUnsafe(5).fill('\u0222'));
1830
+ * // Prints: <Buffer c8 a2 c8 a2 c8>
1831
+ * ```
1832
+ *
1833
+ * If `value` contains invalid characters, it is truncated; if no valid
1834
+ * fill data remains, an exception is thrown:
1835
+ *
1836
+ * ```js
1837
+ * import { Buffer } from 'buffer';
1838
+ *
1839
+ * const buf = Buffer.allocUnsafe(5);
1840
+ *
1841
+ * console.log(buf.fill('a'));
1842
+ * // Prints: <Buffer 61 61 61 61 61>
1843
+ * console.log(buf.fill('aazz', 'hex'));
1844
+ * // Prints: <Buffer aa aa aa aa aa>
1845
+ * console.log(buf.fill('zz', 'hex'));
1846
+ * // Throws an exception.
1847
+ * ```
1848
+ * @since v0.5.0
1849
+ * @param value The value with which to fill `buf`.
1850
+ * @param [offset=0] Number of bytes to skip before starting to fill `buf`.
1851
+ * @param [end=buf.length] Where to stop filling `buf` (not inclusive).
1852
+ * @param [encoding='utf8'] The encoding for `value` if `value` is a string.
1853
+ * @return A reference to `buf`.
1854
+ */
1855
+ fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
1856
+ /**
1857
+ * If `value` is:
1858
+ *
1859
+ * * a string, `value` is interpreted according to the character encoding in`encoding`.
1860
+ * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
1861
+ * To compare a partial `Buffer`, use `buf.slice()`.
1862
+ * * a number, `value` will be interpreted as an unsigned 8-bit integer
1863
+ * value between `0` and `255`.
1864
+ *
1865
+ * ```js
1866
+ * import { Buffer } from 'buffer';
1867
+ *
1868
+ * const buf = Buffer.from('this is a buffer');
1869
+ *
1870
+ * console.log(buf.indexOf('this'));
1871
+ * // Prints: 0
1872
+ * console.log(buf.indexOf('is'));
1873
+ * // Prints: 2
1874
+ * console.log(buf.indexOf(Buffer.from('a buffer')));
1875
+ * // Prints: 8
1876
+ * console.log(buf.indexOf(97));
1877
+ * // Prints: 8 (97 is the decimal ASCII value for 'a')
1878
+ * console.log(buf.indexOf(Buffer.from('a buffer example')));
1879
+ * // Prints: -1
1880
+ * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));
1881
+ * // Prints: 8
1882
+ *
1883
+ * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
1884
+ *
1885
+ * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le'));
1886
+ * // Prints: 4
1887
+ * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le'));
1888
+ * // Prints: 6
1889
+ * ```
1890
+ *
1891
+ * 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,
1892
+ * an integer between 0 and 255.
1893
+ *
1894
+ * If `byteOffset` is not a number, it will be coerced to a number. If the result
1895
+ * of coercion is `NaN` or `0`, then the entire buffer will be searched. This
1896
+ * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
1897
+ *
1898
+ * ```js
1899
+ * import { Buffer } from 'buffer';
1900
+ *
1901
+ * const b = Buffer.from('abcdef');
1902
+ *
1903
+ * // Passing a value that's a number, but not a valid byte.
1904
+ * // Prints: 2, equivalent to searching for 99 or 'c'.
1905
+ * console.log(b.indexOf(99.9));
1906
+ * console.log(b.indexOf(256 + 99));
1907
+ *
1908
+ * // Passing a byteOffset that coerces to NaN or 0.
1909
+ * // Prints: 1, searching the whole buffer.
1910
+ * console.log(b.indexOf('b', undefined));
1911
+ * console.log(b.indexOf('b', {}));
1912
+ * console.log(b.indexOf('b', null));
1913
+ * console.log(b.indexOf('b', []));
1914
+ * ```
1915
+ *
1916
+ * If `value` is an empty string or empty `Buffer` and `byteOffset` is less
1917
+ * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned.
1918
+ * @since v1.5.0
1919
+ * @param value What to search for.
1920
+ * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
1921
+ * @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`.
1922
+ * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
1923
+ */
1924
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
1925
+ /**
1926
+ * Identical to `buf.indexOf()`, except the last occurrence of `value` is found
1927
+ * rather than the first occurrence.
1928
+ *
1929
+ * ```js
1930
+ * import { Buffer } from 'buffer';
1931
+ *
1932
+ * const buf = Buffer.from('this buffer is a buffer');
1933
+ *
1934
+ * console.log(buf.lastIndexOf('this'));
1935
+ * // Prints: 0
1936
+ * console.log(buf.lastIndexOf('buffer'));
1937
+ * // Prints: 17
1938
+ * console.log(buf.lastIndexOf(Buffer.from('buffer')));
1939
+ * // Prints: 17
1940
+ * console.log(buf.lastIndexOf(97));
1941
+ * // Prints: 15 (97 is the decimal ASCII value for 'a')
1942
+ * console.log(buf.lastIndexOf(Buffer.from('yolo')));
1943
+ * // Prints: -1
1944
+ * console.log(buf.lastIndexOf('buffer', 5));
1945
+ * // Prints: 5
1946
+ * console.log(buf.lastIndexOf('buffer', 4));
1947
+ * // Prints: -1
1948
+ *
1949
+ * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
1950
+ *
1951
+ * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le'));
1952
+ * // Prints: 6
1953
+ * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le'));
1954
+ * // Prints: 4
1955
+ * ```
1956
+ *
1957
+ * 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,
1958
+ * an integer between 0 and 255.
1959
+ *
1960
+ * If `byteOffset` is not a number, it will be coerced to a number. Any arguments
1961
+ * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
1962
+ * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
1963
+ *
1964
+ * ```js
1965
+ * import { Buffer } from 'buffer';
1966
+ *
1967
+ * const b = Buffer.from('abcdef');
1968
+ *
1969
+ * // Passing a value that's a number, but not a valid byte.
1970
+ * // Prints: 2, equivalent to searching for 99 or 'c'.
1971
+ * console.log(b.lastIndexOf(99.9));
1972
+ * console.log(b.lastIndexOf(256 + 99));
1973
+ *
1974
+ * // Passing a byteOffset that coerces to NaN.
1975
+ * // Prints: 1, searching the whole buffer.
1976
+ * console.log(b.lastIndexOf('b', undefined));
1977
+ * console.log(b.lastIndexOf('b', {}));
1978
+ *
1979
+ * // Passing a byteOffset that coerces to 0.
1980
+ * // Prints: -1, equivalent to passing 0.
1981
+ * console.log(b.lastIndexOf('b', null));
1982
+ * console.log(b.lastIndexOf('b', []));
1983
+ * ```
1984
+ *
1985
+ * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
1986
+ * @since v6.0.0
1987
+ * @param value What to search for.
1988
+ * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
1989
+ * @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`.
1990
+ * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
1991
+ */
1992
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
1993
+ /**
1994
+ * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents
1995
+ * of `buf`.
1996
+ *
1997
+ * ```js
1998
+ * import { Buffer } from 'buffer';
1999
+ *
2000
+ * // Log the entire contents of a `Buffer`.
2001
+ *
2002
+ * const buf = Buffer.from('buffer');
2003
+ *
2004
+ * for (const pair of buf.entries()) {
2005
+ * console.log(pair);
2006
+ * }
2007
+ * // Prints:
2008
+ * // [0, 98]
2009
+ * // [1, 117]
2010
+ * // [2, 102]
2011
+ * // [3, 102]
2012
+ * // [4, 101]
2013
+ * // [5, 114]
2014
+ * ```
2015
+ * @since v1.1.0
2016
+ */
2017
+ entries(): IterableIterator<[number, number]>;
2018
+ /**
2019
+ * Equivalent to `buf.indexOf() !== -1`.
2020
+ *
2021
+ * ```js
2022
+ * import { Buffer } from 'buffer';
2023
+ *
2024
+ * const buf = Buffer.from('this is a buffer');
2025
+ *
2026
+ * console.log(buf.includes('this'));
2027
+ * // Prints: true
2028
+ * console.log(buf.includes('is'));
2029
+ * // Prints: true
2030
+ * console.log(buf.includes(Buffer.from('a buffer')));
2031
+ * // Prints: true
2032
+ * console.log(buf.includes(97));
2033
+ * // Prints: true (97 is the decimal ASCII value for 'a')
2034
+ * console.log(buf.includes(Buffer.from('a buffer example')));
2035
+ * // Prints: false
2036
+ * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));
2037
+ * // Prints: true
2038
+ * console.log(buf.includes('this', 4));
2039
+ * // Prints: false
2040
+ * ```
2041
+ * @since v5.3.0
2042
+ * @param value What to search for.
2043
+ * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
2044
+ * @param [encoding='utf8'] If `value` is a string, this is its encoding.
2045
+ * @return `true` if `value` was found in `buf`, `false` otherwise.
2046
+ */
2047
+ includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
2048
+ /**
2049
+ * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices).
2050
+ *
2051
+ * ```js
2052
+ * import { Buffer } from 'buffer';
2053
+ *
2054
+ * const buf = Buffer.from('buffer');
2055
+ *
2056
+ * for (const key of buf.keys()) {
2057
+ * console.log(key);
2058
+ * }
2059
+ * // Prints:
2060
+ * // 0
2061
+ * // 1
2062
+ * // 2
2063
+ * // 3
2064
+ * // 4
2065
+ * // 5
2066
+ * ```
2067
+ * @since v1.1.0
2068
+ */
2069
+ keys(): IterableIterator<number>;
2070
+ /**
2071
+ * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is
2072
+ * called automatically when a `Buffer` is used in a `for..of` statement.
2073
+ *
2074
+ * ```js
2075
+ * import { Buffer } from 'buffer';
2076
+ *
2077
+ * const buf = Buffer.from('buffer');
2078
+ *
2079
+ * for (const value of buf.values()) {
2080
+ * console.log(value);
2081
+ * }
2082
+ * // Prints:
2083
+ * // 98
2084
+ * // 117
2085
+ * // 102
2086
+ * // 102
2087
+ * // 101
2088
+ * // 114
2089
+ *
2090
+ * for (const value of buf) {
2091
+ * console.log(value);
2092
+ * }
2093
+ * // Prints:
2094
+ * // 98
2095
+ * // 117
2096
+ * // 102
2097
+ * // 102
2098
+ * // 101
2099
+ * // 114
2100
+ * ```
2101
+ * @since v1.1.0
2102
+ */
2103
+ values(): IterableIterator<number>;
2104
+ }
2105
+ var Buffer: BufferConstructor;
2106
+ /**
2107
+ * Decodes a string of Base64-encoded data into bytes, and encodes those bytes
2108
+ * into a string using Latin-1 (ISO-8859-1).
2109
+ *
2110
+ * The `data` may be any JavaScript-value that can be coerced into a string.
2111
+ *
2112
+ * **This function is only provided for compatibility with legacy web platform APIs**
2113
+ * **and should never be used in new code, because they use strings to represent**
2114
+ * **binary data and predate the introduction of typed arrays in JavaScript.**
2115
+ * **For code running using Node.js APIs, converting between base64-encoded strings**
2116
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
2117
+ * @since v15.13.0
2118
+ * @deprecated Use `Buffer.from(data, 'base64')` instead.
2119
+ * @param data The Base64-encoded input string.
2120
+ */
2121
+ function atob(data: string): string;
2122
+ /**
2123
+ * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
2124
+ * into a string using Base64.
2125
+ *
2126
+ * The `data` may be any JavaScript-value that can be coerced into a string.
2127
+ *
2128
+ * **This function is only provided for compatibility with legacy web platform APIs**
2129
+ * **and should never be used in new code, because they use strings to represent**
2130
+ * **binary data and predate the introduction of typed arrays in JavaScript.**
2131
+ * **For code running using Node.js APIs, converting between base64-encoded strings**
2132
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
2133
+ * @since v15.13.0
2134
+ * @deprecated Use `buf.toString('base64')` instead.
2135
+ * @param data An ASCII (Latin1) string.
2136
+ */
2137
+ function btoa(data: string): string;
2138
+ }
2139
+ }
2140
+ declare module 'node:buffer' {
2141
+ export * from 'buffer';
2142
+ }