I am trying to get a File from an api url. My objective is to show this file (that was previously uploaded) in an input file field with its name. At the moment I have created the following service function:
getDocument(): Observable<Blob> {
const request = this.documentUrl;
return this.http.get(request, { responseType: 'blob' });
}
And when I use it
this.myService.getDocument().subscribe(
response => {
console.log(response);
}
I get a Blob which by definition doesn't have a name. I have seen that I can convert it into a file and give it a name but this solution doesn't fit my necessities. Is there a way I can get a File from the backend instead or is there a way to reconstruct it from the Blob with the original name it had?