Skip to main content
Module

x/wasm/examples/deno/helloworld.ts

Monorepo for Javascript WebAssembly packages by Wasmer
Go to Latest
File
import { init, WASI } from 'https://deno.land/x/wasm/wasi.ts';
// This is needed to load the WASI library firstawait init();
let wasi = new WASI({ env: {}, args: [],});
const moduleBytes = fetch("https://cdn.deno.land/wasm/versions/v1.0.1/raw/tests/demo.wasm");const module = await WebAssembly.compileStreaming(moduleBytes);await wasi.instantiate(module, {});
let exitCode = wasi.start();let stdout = wasi.getStdoutString(); // This should print "hello world (exit code: 0)"console.log(`${stdout}(exit code: ${exitCode})`);