Wasm Builders

Cover image for What is WASMER ?
Shraddha Vijay Inamdar
Shraddha Vijay Inamdar

Posted on • Updated on

What is WASMER ?

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).

Features

  • 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, ...)

Installation

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
Enter fullscreen mode Exit fullscreen mode

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 :

Now you can run Wasmer to get a QuickJS prompt which you can use to run JavaScript.

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 > 


Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Discussion (0)