Skip to content

Commit bbfea75

Browse files
authored
fix: b64encode param type (#2832)
1 parent 0a634bd commit bbfea75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/jsonify/stringify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function serializeInner(
109109
} else if (value instanceof RegExp) {
110110
str += `["RegExp",${JSON.stringify(value.source)}, "${value.flags}"]`;
111111
} else if (value instanceof Uint8Array) {
112-
str += `["Uint8Array","${b64encode(value)}"]`;
112+
str += `["Uint8Array","${b64encode(value.buffer)}"]`;
113113
} else if (value instanceof Set) {
114114
const items = new Array(value.size);
115115
let i = 0;
@@ -161,7 +161,7 @@ const base64abc = [
161161
* CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
162162
* Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
163163
*/
164-
export function b64encode(buffer: ArrayBuffer): string {
164+
export function b64encode(buffer: ArrayBufferLike): string {
165165
const uint8 = new Uint8Array(buffer);
166166
let result = "",
167167
i;

0 commit comments

Comments
 (0)