Linux command
wasmer 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a WebAssembly file
wasmer run [program.wasm]
Run with specific function
wasmer run [program.wasm] -i [function_name]
Run a package from registry
wasmer run [python/python]
Install a package globally
wasmer install -g [package]
Compile to native code
wasmer compile [program.wasm] -o [program.wasmu]
Run with HTTP client enabled
wasmer run --http-client [program.wasm]
Validate WebAssembly file
wasmer validate [program.wasm]
Display Wasmer version
wasmer --version
说明
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`
参数
- -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.
FAQ
What is the wasmer command used for?
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`
How do I run a basic wasmer example?
Run `wasmer run [program.wasm]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --invoke _function_ do in wasmer?
Function to invoke.