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