export const base64ToBlob = (base64Data: string) => { let arr = base64Data.split(","); let matchs = arr[0].match(/:(.*?);/); if (!matchs) { return null } let fileType = matchs[1] let bstr = atob(arr[1]), l = bstr.length, u8Arr = new Uint8Array(l); while (l--) { u8Arr[l] = bstr.charCodeAt(l); } return new Blob([u8Arr], { type: fileType, }); };