//#region src/components/ecocup/utils/download.ts
/**
* @description: 通过创建 a 标签触发文件下载
* @param {string} url - 文件下载地址
* @param {string} filename - 可选的文件名，如果不提供则使用浏览器默认行为
* @return {void}
*/
const downloadFileUtils = (url, filename) => {
	const link = document.createElement("a");
	link.href = url;
	if (filename) link.download = filename;
	link.style.display = "none";
	document.body.appendChild(link);
	link.click();
	setTimeout(() => {
		document.body.removeChild(link);
	}, 100);
};
//#endregion
export { downloadFileUtils };
