Created
June 17, 2018 18:32
-
-
Save gskachkov/fb2757701d8745a69cfa31f533260374 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function utf8ToString(h, p) { | |
let s = ""; | |
for (i = p; h[i]; i++) { | |
s += String.fromCharCode(h[i]); | |
} | |
return s; | |
} | |
let m = new WebAssembly.Instance(new WebAssembly.Module(buffer)); | |
let h = new Uint8Array(m.exports.memory.buffer); | |
let p = m.exports.hello(); | |
const value = utf8ToString(h, p); | |
console.log(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment