title: Download File from Bytes in JavaScript
body: <p>I want to download the file which is coming in the form of bytes from the AJAX response.</p>
  <p>I tried to do it this way with the help of <code>Blob</code>:</p>
  <pre><code>var blob=new Blob([resultByte], {type: &quot;application/pdf&quot;});
  var link=document.createElement('a');
  link.href=window.URL.createObjectURL(blob);
  link.download=&quot;myFileName.pdf&quot;;
  link.click();
  </code></pre>
  <p>It is in fact downloading the pdf file but the file itself is corrupted.</p>
  <p>How can I accomplish this?</p>