Files
um-react/src/util/triggerDownload.ts
T
鲁树人 07d160c547 feat(#10): add batch download settings and capabilities
- Introduced new batch download settings in the settings slice, allowing users to configure options for directory picking, streaming ZIP downloads, and blob ZIP downloads.
- Implemented a new general settings panel for managing batch download preferences.
- Added utility functions to handle directory selection and ZIP file creation.
- Updated the download logic to support multiple download modes based on user preferences.
- Enhanced documentation to reflect changes in batch download functionality.
2026-10-21 10:24:21 +09:00

10 lines
327 B
TypeScript

/** Programmatically trigger a browser file download via a temporary anchor. */
export function triggerAnchorDownload(href: string, filename: string): void {
const anchor = document.createElement('a');
anchor.href = href;
anchor.download = filename;
document.body.append(anchor);
anchor.click();
anchor.remove();
}