title: Download File in Angular4 using file-saver
body: <p>I am trying to implement download file functionality in my angular 4 app. My api returns base 64 string of the file which I download from SharePoint. I am using file-saver module to get the file downloaded. Below is the code used.  </p>
  
  <pre><code>let byteArray = new Uint8Array(res.data)
   , blob = new Blob([byteArray], {type: 'application/pdf'});
   saveAs(blob, "test.pdf");
  </code></pre>
  
  <p>res.data is the base64 string of file.
  The file gets downloaded, however, could not be opened. The error message is "file is corrupted or damaged". Text file gets downloaded and can be opened but is alway blank with no content. Am I doing something wrong.</p>