title: Unable to download blob as file in Angular 7 from API
body: <p>I've been having some trouble getting file download working in my application. To download the file I made a new call in the API I am using to get data into the application. I've tested this API using Postman and it does seem to be working as I am able to download files with the call.</p>
  
  <p>Unfortunately I am running into some issues with implementing it into my Angular application. When I call the function below I am getting a 'corrupt' file as it is unable to be opened. I have checked other questions/solutions related to my problem but after trying most of them I am getting no further.</p>
  
  <p>The call in my service:</p>
  
  <pre><code>DownloadFile (companyId: string, fileId: string, extension: string, fileName: string): Observable&lt;Blob&gt; {
     const options = { responseType: 'blob' as 'json' }
     return this.http.get&lt;Blob&gt;(this.baseApiUrl + this.baseTag + "?companyId=" + companyId + "&amp;fileId=" + fileId + "&amp;extension=" + extension + "&amp;fileName=" + fileName, options)
   }
  </code></pre>
  
  <p>Using the call of the service:</p>
  
  <pre><code>this.data.DownloadFile(this.company.id, selectedItem.id, this.getFileNameWithoutExtension(selectedItem.fileName), this.getExtensionFromFileName(selectedItem.fileName))
      .subscribe(resultBlob =&gt; 
        {
          //Success
          console.log('start download:', resultBlob);
          var blob = new Blob([resultBlob], { type: "application/pdf" } );
          saveAs(blob, selectedItem.fileName);
        },
      error =&gt; {
        //Error
        console.log(error);
      });
  </code></pre>
  
  <p>I am not seeing what is wrong with this part of my code.</p>