Elixir bindings for Binaryen
Installation
-
Add binaryen to your list of dependencies in
mix.exs:
def deps do
[
{:binaryen},
]
endUsage
First you'll need to install binaryen
brew install binaryenThen compile some WebAssembly text format to bytecode:
# 99.wast
(module
(func $main (result i32)
(i32.const 99))
(export "main" (func $main)))-
wasm-as 99.wat 99.wasmNow you can run it in Elixir!
{:ok, code} = File.read("99.wasm")
Binaryen.interpret(code)