WasmEdge command line tool (CLI)
The binary file is a command line interface (CLI) program that runs WebAssembly bytecode programs.
- If the WebAssembly program contains a
main()
function,wasmedge
would execute it as a standalone program in the command mode. - If the WebAssembly program contains one or more public functions,
wasmedge
could execute individual functions in the reactor mode.
- (Optional) Statistics information:
- Use
--enable-time-measuring
to show the execution time. - Use
--enable-gas-measuring
to show the amount of used gas. - Use
--enable-instruction-count
to display the number of executed instructions.
- Use
- (Optional) Resource limitation:
- Use
--gas-limit
to limit the execution cost. - Use
--memory-page-limit
to set the limitation of pages(as size of 64 KiB) in every memory instance.
- Use
- (Optional) Reactor mode: use to enable reactor mode. In the reactor mode,
wasmedge
runs a specified function from the WebAssembly program.- WasmEdge will execute the function which name should be given in
ARG[0]
. - If there’s exported function which names
_initialize
, the function will be executed with the empty parameter at first.
- WasmEdge will execute the function which name should be given in
- (Optional) Binding directories into WASI virtual filesystem.
- Each directory can be specified as
--dir guest_path:host_path
.
- Each directory can be specified as
- (Optional) Environ variables.
- Wasm file (
/path/to/wasm/file
). - (Optional) Arguments.
- In reactor mode, the first argument will be the function name, and the arguments after
ARG[0]
will be parameters of wasm functionARG[0]
. - In command mode, the arguments will be parameters of function
_start
. They are also known as command line arguments for a standalone program.
- In reactor mode, the first argument will be the function name, and the arguments after
Once installed, you can .
The options and flags for the wasmedgec
are as follows.
- Input Wasm file(
/path/to/input/wasm/file
). - Output file name(
/path/to/output/file
).- By default, it will generate the universal Wasm binary format.
- Users can still generate native binary only by specifying the
.so
,.dylib
, or.dll
extensions.
wasmedgec app.wasm app.so