@ruby/wasm-wasi
    Preparing search index...

    Function consolePrinter

    • Create a console printer that can be used as an overlay of WASI imports. See the example below for how to use it.

      const imports = {
      "wasi_snapshot_preview1": wasi.wasiImport,
      }
      const printer = consolePrinter();
      printer.addToImports(imports);

      const instance = await WebAssembly.instantiate(module, imports);
      printer.setMemory(instance.exports.memory);

      Note that the stdout and stderr functions are called with text, not bytes. This means that bytes written to stdout/stderr will be decoded as UTF-8 and then passed to the stdout/stderr functions every time a write occurs without buffering.

      Parameters

      • __namedParameters: { stdout: (str: string) => void; stderr: (str: string) => void } = ...

      Returns { addToImports(imports: WebAssembly.Imports): void; setMemory(m: Memory): void }

      An object that can be used as an overlay of WASI imports.