1.0.0 • Published 6 years ago

simple-wasm v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

SimpleWASM

SimpleWasm lets you execute WASM code without worrying about array buffers or memory management.

Installation

Using npm:

$ npm i --save simple-wasm

Usage

async function run() {
  const Promise = require("bluebird");
  const readFile = Promise.promisify(require("fs").readFile);

  wasm = new SimpleWasm({
    exports: {
      log: console.log
    }
  });
  code = await readFile("./myprogram.wasm");
  await wasm.load(code);
  wasm.call("sum", [[1, 2, 3], 3]);
  # => 6
}
run();

For an example of how to generate wasm files check out the test app in this project.