fix: b64encode param type (#2832)

This commit is contained in:
Tim Reichen
2025-03-05 12:32:24 +01:00
committed by GitHub
parent 0a634bd2d2
commit bbfea7538b
+2 -2
View File
@@ -109,7 +109,7 @@ function serializeInner(
} else if (value instanceof RegExp) {
str += `["RegExp",${JSON.stringify(value.source)}, "${value.flags}"]`;
} else if (value instanceof Uint8Array) {
str += `["Uint8Array","${b64encode(value)}"]`;
str += `["Uint8Array","${b64encode(value.buffer)}"]`;
} else if (value instanceof Set) {
const items = new Array(value.size);
let i = 0;
@@ -161,7 +161,7 @@ const base64abc = [
* CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
*/
export function b64encode(buffer: ArrayBuffer): string {
export function b64encode(buffer: ArrayBufferLike): string {
const uint8 = new Uint8Array(buffer);
let result = "",
i;