export class FileHelpers { static base64ToFile(base64: string, filename: string): File { const arr = base64.split(','); const match = arr[0].match(/:(.*?);/); const mime = match ? match[1] : ''; const binaryString = atob(arr[1]); let length = binaryString.length; const u8arr = new Uint8Array(length); while (length--) u8arr[length] = binaryString.charCodeAt(length); return new File([u8arr], filename, { type: mime }); } }