Skip to main content
Version: 1.x

WASI Support

info

The WASI support pages regarding imports and exports below were autogenerated from the wasmcloud runtime crate using wit-bindgen. The autogenerated pages were last updated as of the v1.4.0 release.

Inspecting a component

wasmCloud supports many WASI APIs out of the box. Any WebAssembly component that uses these APIs will work with wasmCloud, regardless of the source language. Thanks to the embedded wit in each component, you can see what APIs a component uses by running wash inspect --wit <component_reference> with either a file or OCI reference.

Inspecting the component from the Hello World example shows the following imports and exports:

bash
wash inspect --wit ghcr.io/wasmcloud/components/http-hello-world-rust:0.1.0
wit
package root:component;

world root {
  import wasi:io/error@0.2.0;
  import wasi:io/streams@0.2.0;
  import wasi:http/types@0.2.0;
  import wasi:cli/environment@0.2.0;
  import wasi:cli/exit@0.2.0;
  import wasi:cli/stdin@0.2.0;
  import wasi:cli/stdout@0.2.0;
  import wasi:cli/stderr@0.2.0;
  import wasi:clocks/wall-clock@0.2.0;
  import wasi:filesystem/types@0.2.0;
  import wasi:filesystem/preopens@0.2.0;

  export wasi:http/incoming-handler@0.2.0;
}

Imports

When looking at a component's wit world, like in the above example, you'll see a list of imports. Each import here needs to be exported by the host, which in our case is wasmCloud. You can see a list of supported imports by checking the messaging-handler, logging, and incoming-http pages.

Exports

Just like imports, each export in the wit world needs to be imported by the host in order to satisfy the component's requirements. You can see a list of supported exports by checking the interfaces page.