Interface ExtismPluginOptions

Options for initializing an Extism plugin.

Hierarchy

  • ExtismPluginOptions

Properties

allowHttpResponseHeaders?: boolean

Determines whether or not HTTP response headers should be exposed to plugins, when set to true, extism:host/env::http_headers will return the response headers for HTTP requests made using extism:host/env::http_request

allowedHosts?: string[]

A list of allowed hostnames. Wildcard subdomains are supported via *.

Requires the plugin to run in a worker using runInWorker: true.

Example

await createPlugin('path/to/some/wasm', {
runInWorker: true,
allowedHosts: ['*.example.com', 'www.dylibso.com']
})
allowedPaths?: {
    [key: string]: string;
}

Type declaration

  • [key: string]: string
enableWasiOutput?: boolean

Whether WASI stdout should be forwarded to the host.

Overrides the EXTISM_ENABLE_WASI_OUTPUT environment variable.

fetch?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: URL | RequestInfo
      • Optional init: RequestInit

      Returns Promise<Response>

    • (input, init?): Promise<Response>
    • Parameters

      • input: any
      • Optional init: RequestInit

      Returns Promise<Response>

functions?: {
    [key: string]: {
        [key: string]: ((callContext, ...args) => any);
    };
}

A map of namespaces to function names to host functions.

const functions = {
'my_great_namespace': {
'my_func': (callContext: CallContext, input: bigint) => {
const output = callContext.read(input);
if (output !== null) {
console.log(output.string());
}
}
}
}

Type declaration

  • [key: string]: {
        [key: string]: ((callContext, ...args) => any);
    }
    • [key: string]: ((callContext, ...args) => any)
        • (callContext, ...args): any
        • Parameters

          Returns any

logLevel?: LogLevel

The log level to use.

logger?: Console

A logger implementation. Must provide trace, info, debug, warn, and error methods.

memory?: MemoryOptions
runInWorker?: boolean

Whether or not to run the Wasm module in a Worker thread. Requires CAPABILITIES.hasWorkerCapability to be true. Defaults to false.

This feature is marked experimental as we work out a bug.

sharedArrayBufferSize?: number
timeoutMs?: null | number
useWasi?: boolean

Whether or not to enable WASI preview 1.

Generated using TypeDoc