title: Angular: How to download a file from HttpClient?
body: <p>I need download an excel from my backend, its returned a file.</p>
  
  <p>When I do the request I get the error:</p>
  
  <blockquote>
    <p>TypeError: You provided 'undefined' where a stream was expected. You
    can provide an Observable, Promise, Array, or Iterable.</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>this.http.get(`${environment.apiUrl}/...`)
        .subscribe(response =&gt; this.downloadFile(response, "application/ms-excel"));
  </code></pre>
  
  <p>I tried get and map(...) but didn't work.</p>
  
  <p>Details: <strong>angular 5.2</strong></p>
  
  <p>references:</p>
  
  <pre><code>import { HttpClient } from '@angular/common/http';
  import 'rxjs/add/observable/throw';
  import 'rxjs/add/operator/finally';
  import 'rxjs/add/operator/map'
  import 'rxjs/add/operator/catch';
  </code></pre>
  
  <p>Content-Type of response:</p>
  
  <pre><code>Content-Type: application/ms-excel
  </code></pre>
  
  <p>What's wrong?</p>