1.0.0-2 • Published 7 years ago

wasm-to-js-module v1.0.0-2

Weekly downloads
4
License
MIT
Repository
-
Last release
7 years ago

wasm-to-js-module

Exports a webassembly file to be required as a js module.

version downloads Build Status license XO code style

Installation

$ npm install -g wasm-to-js-module

Command line usage

Usage: wasm-to-js-module [<in.wasm>] [<out.js>]

Options:
  --help            Show help                                          [boolean]
  --version         Show version number                                [boolean]
  --es6-export, -e  Uses "export default" instead of "module.exports"  [boolean]

Programmatic usage

This module exports a function which takes a Buffer in input containing binary Webassembly representation, returning a string containing the converted javascript module.

const fs = require('fs');
const convert = require('wasm-to-js-module');

const wasmBuffer = fs.readFileSync('test.wasm');
const jsSource = convert(wasmBuffer, {es6Export: true}); //es6Export is optional, defaults to false

fs.writeFileSync('out.js', jsSource);
1.0.0-2

7 years ago

1.0.0-1

7 years ago

1.0.0

7 years ago