title: How can I download a server file in angular2
body: <p>I have the path of image file. I want that when users click the download button, the file should be downloaded to their computers or devices.</p>
  
  <pre><code>&lt;button (click)="downloadfile()"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>When the button is clicked , the following component code should download the file to the user's device:</p>
  
  <pre><code>downloadfile(){
     const id = "c64eb0be068249333fd092957aa99190";
     this.storageRef = firebase.storage().ref().child(`audios/${id}`);
      this.storageRef.getDownloadURL().then(url =&gt; {
      const fileUrl = url;
     });
  }
  </code></pre>
  
  <p>How can I use headers in angular2 to download the file , setting the file type and filename?</p>