This commit is contained in:
louiscklaw
2025-04-21 05:36:41 +08:00
parent f65f6df660
commit d2f9472743
9 changed files with 39 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ export function fileToBase64(file: Blob): Promise<string> {
export function base64ToFile(base64String: string, filename?: string): Promise<File> {
return new Promise((resolve, reject) => {
const arr = base64String.split(',');
// eslint-disable-next-line prefer-named-capture-group
const type = arr[0].match(/:(.*?);/)![1];
const bstr = atob(arr[1]);
let n = bstr.length;