title: How to Directly Instantiate WebAssembly Module in JavaScript
body: <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate" rel="noreferrer">examples</a> I've seen show essentially this:</p>
  
  <pre><code>fetch('simple.wasm').then(response =&gt;
    response.arrayBuffer()
  ).then(bytes =&gt;
    WebAssembly.instantiate(bytes, {})
  ).then(result =&gt;
    result.instance.exports...
  )
  </code></pre>
  
  <p>But I would like to do it without making that extra HTTP request. Wondering if the only way is this (or some variation of it, which would be helpful to know):</p>
  
  <pre><code>var binary = '...mywasmbinary...'
  var buffer = new ArrayBuffer(binary.length)
  var view = new DataView(buffer)
  for (var i = 0, n = binary.length; i &lt; n; i++) {
    var x = binary[i]
    view.setInt8(i * 8, x)
  }
  </code></pre>
  
  <p>Wondering if I have to worry about endianess or anything like that.</p>
  
  <p>Or perhaps doing something with <code>URL</code> and blobs might be better, I'm not sure.</p>