mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-26 07:39:04 +02:00
23 lines
509 B
JavaScript
23 lines
509 B
JavaScript
const timeouts = require('../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);
|
|
}
|
|
};
|
|
|
|
module.exports = FileSaver;
|