Hacker News new | comments | show | ask | jobs | submit login

Right, I thought it was odd; I remember reading that part of the big benefit of WASM was more compact, faster-to-parse source code. Going all the way up to text form and back down to binary data is at odds with that.

> an explicit Uint8Array should only only necessary if you want to inline the wasm directly with the JS that instantiates it.

Are there any realistic scenarios where this is the more sensible option?

Anyway, I should have searched MDN first, the relevant bit of documentation is pretty clear:

    fetch('simple.wasm').then(response =>
    ).then(bytes =>
      WebAssembly.instantiate(bytes, importObject)
    ).then(results => {

I suppose you could avoid having the extra request roundtrip by inlining a uint8array (or a base64 encoded string or something), and it also lets you have wasm and it's associated JS be put together which would automatically avoid cache/version mismatch without any extra work, but I would be surprised if that makes sense in any normal scenario.

Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact