-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
124 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export function encodeBase64(input: Uint8Array): string { | ||
// @ts-ignore | ||
if (Uint8Array.prototype.toBase64) { | ||
// @ts-ignore | ||
return input.toBase64() | ||
} | ||
|
||
const CHUNK_SIZE = 0x8000 | ||
const arr = [] | ||
for (let i = 0; i < input.length; i += CHUNK_SIZE) { | ||
// @ts-expect-error | ||
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE))) | ||
} | ||
return btoa(arr.join('')) | ||
} | ||
|
||
export function decodeBase64(encoded: string): Uint8Array { | ||
// @ts-ignore | ||
if (Uint8Array.fromBase64) { | ||
// @ts-ignore | ||
return Uint8Array.fromBase64(encoded) | ||
} | ||
|
||
const binary = atob(encoded) | ||
const bytes = new Uint8Array(binary.length) | ||
for (let i = 0; i < binary.length; i++) { | ||
bytes[i] = binary.charCodeAt(i) | ||
} | ||
return bytes | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.