GitHub - AssemblyScript/wabt.js: A buildbot for wabt.js, a port of WABT to the Web, with TypeScript support. (original) (raw)

wabt.js

wabt.js is a port of WABT to the Web, allowing you to manipulate WebAssembly modules using a JavaScript API.

Build status npm version npm nightly version

Usage

require("wabt")().then(wabt => { var wasm = ...; // a buffer holding the contents of a wasm file

var myModule = wabt.readWasm(wasm, { readDebugNames: true }); myModule.applyNames();

var wast = myModule.toText({ foldExprs: false, inlineExport: false });

console.log(wast); });

The buildbot also publishes nightly versions once a day if there have been changes. The latest nightly can be installed through

$> npm install --save-exact wabt@nightly

or you can use one of the previous versions instead if necessary. Note the --save-exact when using a nightly.

Usage with a CDN

Replace VERSION with a specific version or omit it (not recommended in production) to use main/latest.

API

CLI

Node.js ports of the following command line tools are included in the package as well:

The tools can also be run ad hoc (without explicitly installing the package), for example with:

$> npx -p wabt wasm2wat myModule.wasm -o myModule.wat