wasmedge(1) General Commands Manual wasmedge(1)

wasmedge - standalone runtime for WebAssembly

wasmedge [SUBCOMMAND] [OPTIONS] [--] WASM_OR_SO [ARG ...]

WasmEdge is a lightweight, high-performance, and extensible WebAssembly <https://webassembly.org/> runtime for cloud native, edge, and decentralized applications. It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices.

The WasmEdge Runtime provides a well-defined execution sandbox for its contained WebAssembly bytecode program. The runtime offers isolation and protection for operating system resources (e.g., file system, sockets, environment variables, processes) and memory space. The most important use case for WasmEdge is to safely execute user-defined or community-contributed code as plug-ins in a software product (e.g., SaaS, software-defined vehicles, edge nodes, or even blockchain nodes). It enables third-party developers, vendors, suppliers, and community members to extend and customize the software product.

wasmedge accepts a file path, WASM_OR_SO, to a WebAssembly file or a native shared library object as generated by wasmedge compile(1).

ARG is the optional command line arguments array:

WasmEdge compiler subcommand. See wasmedge-compile(1) for the options applicable to this mode.
WasmEdge runtime tool subcommand. wasmedge run is an alias of wasmedge without the --version option. See below for the options applicable to this mode.

Show the help messages. Will ignore other arguments below.
Show the version information. Will ignore other arguments below.

Enable reactor mode. Reactor mode calls _initialize if exported.
Binding directories into WASI virtual filesystem. Each directory can be specified as --dir host_path. You can also map a guest directory to a host directory by --dir guest_path:host_path, where guest_path specifies the path that will correspond to host_path for calls like fopen in the guest.
Environmental variables. Each variable can be specified as --env NAME=VALUE.
Forcibly run WASM in interpreter mode.
List of plugins to ignore.

Enable generating code for counting time during execution.
Enable generating code for counting gas burned during execution.
Enable generating code for counting WebAssembly instructions executed.
Enable generating code for all statistics options include instruction counting, gas measuring, and execution time.

Limitation of maximum time(in milliseconds) for execution, default value is 0 for no limitations.
Limitation of execution gas. Upper bound can be specified as --gas-limit GAS_LIMIT.
Limitation of pages(as size of 64 KiB) in every memory instance. Upper bound can be specified as --memory-page-limit PAGE_COUNT.

Disable Import/Export of mutable globals proposal.
Disable Non-trapping float-to-int conversions proposal.
Disable Sign-extension operators proposal.
Disable Multi-value proposal.
Disable Bulk memory operations proposal.
Disable Reference types proposal.
Disable SIMD proposal.
Enable Multiple memories proposal.
Enable Tail-call proposal.
Enable Extended-const proposal.
Enable Threads proposal.
Enable all features.

Assuming a WebAssembly program placed under the file fibonacci.wasm, set up so to export a fib() function and accepting a single i32 integer as the input parameter, one can execute wasmedge in reactor mode to invoke the exported function as follows:

$ wasmedge --reactor fibonacci.wasm fib 10

Assuming a WebAssembly program contains amain()function, printing out hello` followed by the command line arguments:

$ wasmedge hello.wasm world

Copyright © 2019-2022 Second State INC. Licensed under the Apache License, Version 2.0.

wasmedge-compile(1)

A complete manual of WasmEdge <https://wasmedge.org/docs/> can be found online.

2024-04-01