code refactor

This commit is contained in:
MaysWind
2023-06-18 09:20:02 +08:00
parent fd01c9269f
commit 4f2b9d39da
2 changed files with 13 additions and 4 deletions
+8
View File
@@ -159,6 +159,14 @@ export function base64encode(arrayBuffer) {
return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
}
export function base64decode(str) {
if (!str) {
return '';
}
return atob(str);
}
export function arrayBufferToString(arrayBuffer) {
return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
}