export const downloadFile=(fileUrl,name='')=>{
    let startIndex=fileUrl.lastIndexOf("/");
    let endIndex=fileUrl.lastIndexOf(".");
    let originName=fileUrl.substring(startIndex+1,endIndex);
    const request = new XMLHttpRequest()
    request.open('GET', fileUrl)
    request.responseType = 'blob'
    request.onload = (res) => {
        if (res.target.status == 200) {
            const url = window.URL.createObjectURL(res.currentTarget.response)
            const link = document.createElement('a')
            link.href = url;
            link.setAttribute('download',originName)
            link.click()
        }
    }
    request.send()
}
