title: JS hex string to actual byte values of a file
body: <p>I have this array called data and at each index there's a byte's worth of hex strings, it looks like this</p>
  
  <pre><code>var data = new Array("0A", "31", "55", "AA", "FF")
  </code></pre>
  
  <p>If i inspect the file in a hex editor I should expect to see that sequence. So if I want to write a file so that the values starting at memory address 0x00000000 is that sequence of hex values, how would I go about that? </p>
  
  <p>currently I'm creating the downloadable files with this code.</p>
  
  <pre><code>function download(filename, text) {
     var file = document.createElement('a');
     file.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
     file.setAttribute('download', filename);
     file.click();
  }
  </code></pre>