In my angular app I have the following code:
.ts file
download() {
this._fileService
.getDownloadUrl(this.id)
.subscribe(r => {
window.location.href = r;
});
}
.html
<span class="btn" download (click)="download()">
<i class="fas fa-download"></i>
</span>
For larger files it works good (like 10mb or more), the file is downloaded normally. But if the file has something like 2mb, it redirect to the link and show its content. How to avoid this and download always?