You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
476 B
13 lines
476 B
const fs = require('fs'); |
|
const { promisify } = require('util'); |
|
|
|
const fileRead = promisify(fs.readFile); |
|
|
|
(async function() { |
|
const wasmBuffer = await fileRead('./rats.wasm'); |
|
const wasmModule = await WebAssembly.compile(wasmBuffer); |
|
const wasmInstance = await WebAssembly.instantiate(wasmModule); |
|
|
|
// Assuming the WASM module exports a function named 'myFunction' |
|
console.log('Result from myFunction:', wasmInstance.instance.exports.myFunction()); |
|
})(); |