title: Angular: Convert base64 string to Byte Array in IE
body: <p>I am trying to convert a <code>base64</code> string to byte array and open it as a <code>pdf</code> file in IE. The only problem is <code>atob</code> is not supported in IE, so trying to use Buffer like this:</p>
  
  <pre><code>let b64Data = myBase64Url.split(',', 2)[1];
  var byteArray = new Buffer(b64Data ,'base64').toString('binary');
  var blob = new Blob([byteArray], {type: 'application/pdf'});
  window.navigator.msSaveOrOpenBlob(blob); 
  </code></pre>
  
  <p>I am getting a popup successfully to open the file</p>
  
  <p><a href="https://i.stack.imgur.com/hLzAT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hLzAT.png" alt="enter image description here"></a></p>
  
  <p>But the file is corrupted</p>
  
  <p><a href="https://i.stack.imgur.com/N6C0f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N6C0f.png" alt="enter image description here"></a></p>
  
  <p>What am i doing wrong ? Is there a better way to convert <code>base64</code> to byte array in IE ?</p>