export default function base64ToFile(data) {
    // 将base64 的图片转换成file对象上传 atob将ascii码解析成binary数据
    const binary = atob(data.split(',')[1]);
    const mime = data.split(',')[0].match(/:(.*?);/)[1];
    const array = [];
    for (let i = 0; i < binary.length; i++) {
        array.push(binary.charCodeAt(i));
    }
    const fileData = new Blob([new Uint8Array(array)], {
        type: mime,
    });
    const file = new File([fileData], `${new Date().getTime()}.png`, { type: mime });
    return file;
}