/**
 * 下载文件到本地
 * @param blob 文件流
 * @param fileName 存储文件名称
 */
export const downloadFileByBlob = (blob: Blob, fileName?: string) => {
    const blobUrl = window.URL.createObjectURL(blob);
    const link = document.createElement('a');
    link.download = fileName ?? `下载文件_${new Date().getTime()}`;
    link.style.display = 'none';
    link.href = blobUrl;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
};
