mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-11-04 18:40:20 +00:00
refactor: enhance manual chunking in Vite config for better code splitting
This commit is contained in:
1 parent
f0ace28bf2
commit
722d3db0e9
49 files changed
+10021
-8531
No files matched your search
@@ -0,0 +1,12 @@
|
||||
export function downloadBytesAsFile(bytes: Uint8Array, fileName: string, mimeType: string): void {
|
||||
const payload = bytes.slice();
|
||||
const blob = new Blob([payload], { type: mimeType || 'application/octet-stream' });
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href = objectUrl;
|
||||
anchor.download = fileName || 'download.bin';
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
anchor.remove();
|
||||
window.setTimeout(() => URL.revokeObjectURL(objectUrl), 0);
|
||||
}
|
||||
Reference in new issue
Block a user