How do I download a file with Angular2 or greater

The problem is that the observable runs in another context, so when you try to create the URL var, you have an empty object and not the blob you want. One of the many ways that exist to solve this is as follows: this._reportService.getReport().subscribe(data => this.downloadFile(data)),//console.log(data), error => console.log(‘Error downloading the file.’), () => console.info(‘OK’); … Read more

How to set File objects and length property at FileList object where the files are also reflected at FormData object?

Edit: As proven by OP, in one of their gist, there is actually a way to do it… The DataTransfer constructor (currently only supported by Blink, and FF >= 62), should create a mutable FileList (chrome currently always return a new FileList, but it doesn’t really matter for us), accessible through the DataTransferItemList. If I’m … Read more