example cont stack wat
build / build (push) Failing after 1m15s

This commit is contained in:
2026-07-14 17:36:36 -06:00
parent 8a800fdcb2
commit 60482e3567
4 changed files with 112 additions and 3 deletions
+18
View File
@@ -0,0 +1,18 @@
const imports = {
guppy: {
print: (arg) => console.log (arg)
}
}
// Assume add.wasm file exists that contains a single function adding 2 provided arguments
const fs = require('node:fs');
// Use the readFileSync function to read the contents of the "add.wasm" file
const wasmBuffer = fs.readFileSync('u.wasm');
// Use the WebAssembly.instantiate method to instantiate the WebAssembly module
WebAssembly.instantiate(wasmBuffer, imports).then(wasmModule => {
// Exported function lives under instance.exports object
const { main } = wasmModule.instance.exports;
main ()
});