m06_task3.js 1.0.0

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