Function createPlugin

  • Create a Plugin given a ManifestLike and ExtismPluginOptions.

    Plugins wrap Wasm modules, exposing rich access to exported functions.

    const plugin = await createPlugin(
    'https://github.com/extism/plugins/releases/download/v0.3.0/count_vowels.wasm',
    { useWasi: true }
    );

    try {
    const result = await plugin.call('count_vowels', 'hello world');
    const parsed = result.json();

    console.log(parsed); // { count: 3, total: 3, vowels: "aeiouAEIOU" }
    } finally {
    await plugin.close();
    }

    Plugin can run on a background thread when the environment supports it. You can see if the current environment supports background plugins by checking the hasWorkerCapability property of CAPABILITIES.

    Parameters

    Returns Promise<Plugin>

    a promise for a Plugin.

Generated using TypeDoc