Wasmer is a WebAssembly runtime that enables super lightweight containers to run anywhere from Desktop to the Cloud, Edge and IoT devices.
Wasmer provides a CLI in order to easily execute wasm files in the command line. It supports multiple backends including LLVM, Cranelift, and Single pass (dynasm).
- Fast. Run WebAssembly at near-native speeds.
- Secure by default. No file, network, or environment access, unless explicitly enabled.
- Supports WASI and Emscripten out of the box.
- Embeddable in multiple programming languages
- Compliant with latest WebAssembly Proposals (SIMD, Reference Types, Threads, ...)
Wasmer provides a CLI in order to easily execute wasm files in the command line.
On Linux you can install it like this:
curl https://get.wasmer.io -sSfL | sh
On Windows, you can go to the Github Releases Page, and there you can find .exe installers.
To check if everything is working fine you can download the qjs.wasm file at the WAPM website.
You can also refer to the below picture to install quickjs :
Take a look at the below example :
kali@kali:~/Downloads$ wasmer qjs.wasm QuickJS - Type "\h" for help qjs > [1, 2, 3, 4].map(t =>t*t*t) [1, 2, 3, 4].map(t =>t*t*t) [ 1, 8, 27, 64 ] qjs >
WAPM - Package Manager for WebAssembly
WAPM is a package manager for WebAssembly modules which comes bundled with the Wasmer itself.
In previous section, we downloaded QuickJS manually but using WAPM we can install the QuickJS package much easily.
You can use the below command to install QuickJS.
wapm install -g quickjs