Skip to content

Commit

Permalink
fix(encode): maximum call stack size exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 committed Apr 27, 2022
1 parent 90c3b4b commit 3cd8195
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const IS_BROWSER = typeof window !== 'undefined';
const STRING_ZERO = '0';

export function arrayBufferToString(array: ArrayBuffer): string {
return String.fromCharCode.apply(null, array as unknown as number[]);
return new Uint8Array(array).reduce((data, byte) => data + String.fromCharCode(byte), '');
}

export function btoaUniversal(b: ArrayBuffer): string {
Expand Down

0 comments on commit 3cd8195

Please sign in to comment.