We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b51919 commit acd2d5eCopy full SHA for acd2d5e
src/base64.ts
@@ -16,8 +16,10 @@ export const encodeBase64 = (buf: ArrayBufferLike): string => {
16
const decodeBase64 = (str: string): Uint8Array => {
17
const binary = atob(str)
18
const bytes = new Uint8Array(new ArrayBuffer(binary.length));
19
- for (let i = 0; i < binary.length ; i++) {
+ const half = binary.length / 2;
20
+ for (let i = 0, j = binary.length - 1; i <= half; i++, j--) {
21
bytes[i] = binary.charCodeAt(i);
22
+ bytes[j] = binary.charCodeAt(j);
23
}
24
return bytes
25
0 commit comments