LinuxCommandLibrary

wasmer

TLDR

Run a WebAssembly file

$ wasmer run [program.wasm]
copy
Run with specific function
$ wasmer run [program.wasm] -i [function_name]
copy
Run a package from registry
$ wasmer run [python/python]
copy
Install a package globally
$ wasmer install -g [package]
copy
Compile to native code
$ wasmer compile [program.wasm] -o [program.wasmu]
copy
Run with HTTP client enabled
$ wasmer run --http-client [program.wasm]
copy
Validate WebAssembly file
$ wasmer validate [program.wasm]
copy
Display Wasmer version
$ wasmer --version
copy

SYNOPSIS

wasmer [command] [options] [input] [args...]

DESCRIPTION

wasmer is a WebAssembly runtime for running Wasm modules outside the browser. It supports WASI for system access and provides fast, secure execution with multiple compiler backends.
The runtime is secure by default, with no access to files, network, or environment unless explicitly enabled. Wasmer can run packages from its registry or local .wasm files.
Compiler backends offer different tradeoffs: Singlepass provides fastest compilation, Cranelift balances compilation and execution speed (default), and LLVM produces most optimized code.
Install via: `curl https://get.wasmer.io -sSfL | sh`

PARAMETERS

-i, --invoke function

Function to invoke.
-e, --entrypoint module
Entrypoint module for packages.
--stack-size size
Stack size (default: 1048576).
--http-client
Allow HTTP requests.
--wasmer-dir dir
Wasmer home directory.
--cache-dir dir
Cache directory.
--backend backend
Compiler backend: cranelift, llvm, singlepass.
-v, --verbose
Verbose output.
-h, --help
Display help.
--version
Display version.

COMMANDS

run: Execute a WebAssembly file or package.
compile: Compile to native code.
validate: Validate WebAssembly file.
install: Install a package.
publish: Publish a package to registry.
config: Manage configuration.
self-update: Update Wasmer.

CAVEATS

WASI support varies by module. Some system interfaces require explicit flags to enable. Package registry requires account for publishing. Ahead-of-time compiled modules are platform-specific.

HISTORY

Wasmer was created by Syrus Akbary and launched in 2018. It became one of the leading standalone WebAssembly runtimes, supporting multiple languages and platforms. The project includes a package registry for distributing Wasm applications.

SEE ALSO

wasmtime(1), wasm-pack(1), node(1)

Copied to clipboard