Skip to content

Commit

Permalink
Optimize base64ToBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
salvoilmiosi authored Oct 1, 2024
1 parent d25275b commit 5c1d825
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Utils/Base64Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export function bytesToBase64(bytes: Uint8Array): string {

export function base64ToBytes(input: string): Uint8Array {
const binary = window.atob(input);
let bytes: number[] = [];
let bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; ++i) {
bytes.push(binary.charCodeAt(i));
bytes[i] = binary.charCodeAt(i);
}
return new Uint8Array(bytes);
return bytes;
}

0 comments on commit 5c1d825

Please sign in to comment.