title: Save a response body as file with FileSaver and blob
body: <p>I want to download and save a file from an api. The name of my file is <code>text.txt</code> but the saved file is called: <code>_text.txt_</code> and the content of this file is: <code>[object Object]</code></p>
  
  <p>This is my function to download as file:</p>
  
  
  
  <pre><code>const options = {
        headers: new HttpHeaders().append('Authorization', this.oAuthService.getAccessToken()),
        params: new HttpParams().append('responseType', 'text'),
        observe: 'response' as 'response'
      }
  
      return this.http.get(this.fileServerUrl + 'file/download/' + filename + '/' + version, options)
        .subscribe(
          resp =&gt; { this.saveToFileSystem(resp)
  
        });
    }
  
    private saveToFileSystem(response) {
      const contentDispositionHeader: string = response.headers.get('Disposition');
      const parts: string[] = contentDispositionHeader.split(';');
      const filename = parts[1].split('=')[1];
      filename.replace(/"/g, '');
      console.log(filename);
      console.log(response.body)
      const blob = new Blob([response.body], { type: 'text/plain' });
      saveAs(blob, filename);
    }
  </code></pre>
  
  <p>the output of the first console.log is text.txt and the console.log of the  response.body is: this is a test text..</p>
  
  <p>so why is the saved file name with _ at the begin and end and the content not the text from the response body.</p>
  
  <p>Thanks in advnace</p>