feat: add downloadBlob with file-utils

pull/5350/head
bnymncoskuner 5 years ago
parent c7043b3ccf
commit 761d3e7ddd

@ -0,0 +1,20 @@
export function downloadBlob(blob: Blob, filename: string) {
const blobUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = blobUrl;
link.download = filename;
document.body.appendChild(link);
link.dispatchEvent(
new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window,
}),
);
document.body.removeChild(link);
}

@ -3,6 +3,7 @@ export * from './common-utils';
export * from './date-utils';
export * from './environment-utils';
export * from './factory-utils';
export * from './file-utils';
export * from './form-utils';
export * from './generator-utils';
export * from './initial-utils';

Loading…
Cancel
Save