(module
(func (export "addTwo") (param i32 i32) (result i32)
local.get 0
local.get 1
i32.add))
//this is my addTwo.wasm file
const fs = require('fs');
const buf = fs.readFileSync('./addTwo.wasm');// importing addTwo.wasm file
const lib = WebAssembly.instantiate(new Uint8Array(buf)).
then(res => res.instance.exports).catch(err=> console.log(err))
console.log(lib)
console.log(lib.addTwo(2,2))
//this is my addTwo.js file
I am just trying to add two numbers, but got the error:
[CompilerError: WebAssembly.instatiate(): expected magic word 00 61 73 6d ,but found 28 6d 6f 64 @+0]