I am trying to download a file using angular 2
and net core 2
as the API.
When user clicks the download link, they should be able to save file in their local machine.
Every answer I've previously looked at varies a lot, and I can't seem to understand/ get them to work.
Anyway, this is what I've got the server, I return a file stream
var content = System.IO.File.ReadAllBytes(tempFilename);
var contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
var fileName = "test.xlsx";
return File(content, contentType, fileName);
The stream is returned fine. It is now my understanding I have to create a blob on the client? And then read and save the blob or something?
Currently, on my client all I have a get request returning an observable.
Here is my component call to my service:
this.reportService.generateDispensations(this.config).subscribe(data => {
});
I am not really sure what to modify in the actual http call, to turn it into a blob or something