refactor: cleanup backend structure
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem.
|
||||
export function fromBase64(string: String) {
|
||||
export function fromBase64(string) {
|
||||
const binString = atob(string);
|
||||
const bytes = Uint8Array.from(binString, (m) => m.codePointAt(0))
|
||||
return new TextDecoder().decode(bytes);
|
||||
}
|
||||
|
||||
export function toBase64(string: String) {
|
||||
export function toBase64(string) {
|
||||
const bytes = new TextEncoder().encode(string)
|
||||
const binString = String.fromCodePoint(...bytes);
|
||||
return btoa(binString);
|
||||
|
||||
Reference in New Issue
Block a user