> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurdoverse.app/llms.txt
> Use this file to discover all available pages before exploring further.

# WebAssembly

> Run WebAssembly modules inside scripts with full WASI Preview 1 support.

The runtime supports the standard **WebAssembly JavaScript API** - you
can compile, instantiate, and run `.wasm` modules directly from your
scripts. The engine implements the full `wasi_snapshot_preview1`
interface, so WASI-compatible modules work out of the box.

```ts theme={null}
import fs from "@native/fs";

const bytes = fs.readFileSync("python.wasm");
const module = new WebAssembly.Module(bytes);
const instance = new WebAssembly.Instance(module);

try {
    instance.exports._start();
    console.log("python exited normally");
} catch (e) {
    if (String(e).includes("__wasi_proc_exit__"))
        console.log("python called proc_exit - ok");
    else
        console.log("python error:", String(e));
}
```

<Tip>
  For a deeper dive into `WebAssembly.Module`, `WebAssembly.Instance`,
  imports, memory, and tables - see the
  [MDN WebAssembly guide](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Using_the_JavaScript_API).
</Tip>
