$ cnpm install wabt
wabt.js is a port of WABT to the Web, allowing you to manipulate WebAssembly modules using a JavaScript API.
$> npm install wabt
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.
https://cdn.jsdelivr.net/gh/AssemblyScript/wabt.js@VERSION/index.jshttps://cdn.jsdelivr.net/npm/wabt@VERSION/index.jshttps://unpkg.com/wabt@VERSION/index.jsReplace VERSION with a specific version or omit it (not recommended in production) to use main/latest.
parseWat(filename: string, buffer: string | Uint8Array, options?: WasmFeatures): WasmModule
Parses a WebAssembly text format source to a module.
readWasm(buffer: Uint8Array, options: ReadWasmOptions & WasmFeatures): WasmModule
Reads a WebAssembly binary to a module.
WasmModule
A class representing a WebAssembly module.
voidvoidvoidvoidToTextOptions): stringToBinaryOptions): ToBinaryResultvoidReadWasmOptions
Options modifying the behavior of readWasm.
booleanbooleanToTextOptions
Options modifying the behavior of WasmModule#toText.
booleanbooleanToBinaryOptions
Options modifying the behavior of WasmModule#toBinary.
booleanbooleanbooleanbooleanToBinaryResult
Result object of WasmModule#toBinary.
Uint8ArraystringWasmFeatures
WebAssembly features to legalize. Finished features are enabled by default.
booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanNode.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
Copyright 2013 - present © cnpmjs.org | Home |