Added logic for save to disk btn
This commit is contained in:
@ -175,13 +175,14 @@ export class DownloadComponent {
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = url;
|
||||
a.download = filename; // You can specify a filename here
|
||||
a.download = filename;
|
||||
a.id = 'fileDownloadBlob';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
this.saveDownloadedFile();
|
||||
|
||||
// Clean up by revoking the Blob URL and removing the temporary anchor
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
// Clean up by revoking the Blob URL and removing the temporary anchor (currently disabled due to saveDownloadBtn)
|
||||
// window.URL.revokeObjectURL(url);
|
||||
// document.body.removeChild(a);
|
||||
})
|
||||
.catch(error => {
|
||||
this.fileDownloadStarted = false;
|
||||
@ -203,6 +204,13 @@ export class DownloadComponent {
|
||||
this.downloadProgress = this.targetUploadProgress;
|
||||
}
|
||||
}
|
||||
|
||||
saveDownloadedFile() {
|
||||
const a = document.getElementById('fileDownloadBlob');
|
||||
if(a) {
|
||||
a.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
interface DownloadInfo {
|
||||
downloadable: boolean;
|
||||
|
Reference in New Issue
Block a user