Module

std/wasi/snapshot_preview1.ts

Deno standard library
Go to Latest
import * as mod from "https://deno.land/std@0.158.0/wasi/snapshot_preview1.ts";

Provides an implementation of the WebAssembly System Interface.

Example

import Context from "https://deno.land/std@0.158.0/wasi/snapshot_preview1.ts";

const context = new Context({
  args: Deno.args,
  env: Deno.env.toObject(),
});

const binary = await Deno.readFile("path/to/your/module.wasm");
const module = await WebAssembly.compile(binary);
const instance = await WebAssembly.instantiate(module, {
  "wasi_snapshot_preview1": context.exports,
});

context.start(instance);

Classes

The Context class provides the environment required to run WebAssembly modules compiled to run with the WebAssembly System Interface.