Class Wasmer

A package from the Wasmer registry.

Example

import { Wasmer } from "@wasmer/sdk";

const pkg = await Wasmer.fromRegistry("wasmer/python");
const instance = await pkg.entrypoint!.run({ args: ["--version"]});
const { ok, code, stdout, stderr } = await instance.wait();

if (ok) {
console.log(`Version:`, stdout);
} else {
throw new Error(`Python exited with ${code}: ${stderr}`);
}

Constructors

Properties

commands: Record<string, Command>

A map containing all commands available to the package (including dependencies).

entrypoint?: Command

The package's entrypoint.

Methods

  • Returns void

  • Load a package from a package file.

    Parameters

    • binary: Uint8Array
    • Optional runtime: Runtime

    Returns Promise<Wasmer>

  • Load a package from the Wasmer registry.

    Parameters

    • specifier: string
    • Optional runtime: Runtime

    Returns Promise<Wasmer>

Generated using TypeDoc