mirror of https://github.com/keeweb/keeweb.git
23 lines
499 B
JavaScript
23 lines
499 B
JavaScript
import { Timeouts } from 'const/timeouts';
|
|
|
|
const FileSaver = {
|
|
saveAs(blob, name) {
|
|
const link = document.createElement('a');
|
|
|
|
link.download = name;
|
|
link.rel = 'noopener';
|
|
link.href = URL.createObjectURL(blob);
|
|
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
|
|
document.body.removeChild(link);
|
|
|
|
setTimeout(() => {
|
|
URL.revokeObjectURL(link.href);
|
|
}, Timeouts.LinkDownloadRevoke);
|
|
}
|
|
};
|
|
|
|
export { FileSaver };
|