package com.sifang.modules.utils.img;

import com.sifang.modules.alioss.AliyunOSSClientUtil;
import com.sifang.modules.sunshine.SystemSetting.utils.StringUtil;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Base64;

/**
 * @title: Base64ToFile
 * @Author Tan
 * @Date: 2024/7/11 17:07
 * @Version 1.0
 */
public class Base64ToFile {

    public static String convertBase64ToFile(String base64String) {
        String fileInfo = "";
        byte[] decodedBytes = Base64.getDecoder().decode(base64String);
        fileInfo = AliyunOSSClientUtil.uploadImage(decodedBytes, "png", "");
        fileInfo = StringUtil.trasferBackslash(fileInfo);
        return fileInfo;
    }

}