update for lp_categories,

This commit is contained in:
louiscklaw
2025-04-21 05:16:30 +08:00
parent 3679924a6a
commit f65f6df660
60 changed files with 1919 additions and 1047 deletions

View File

@@ -10,3 +10,20 @@ 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(',');
const type = arr[0].match(/:(.*?);/)![1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
const file = new File([u8arr], filename || 'file', { type });
resolve(file);
});
}