mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-13 07:43:43 +08:00
14 lines
357 B
TypeScript
14 lines
357 B
TypeScript
export function saveBlob(blob: Blob, fileName: string) {
|
|
const downloadLink = document.createElement('a');
|
|
const objectUrl = URL.createObjectURL(blob);
|
|
|
|
downloadLink.href = objectUrl;
|
|
downloadLink.download = fileName;
|
|
downloadLink.rel = 'noopener';
|
|
downloadLink.click();
|
|
|
|
setTimeout(() => {
|
|
URL.revokeObjectURL(objectUrl);
|
|
}, 40_000);
|
|
}
|