1.0.36 • Published 8 months ago

wabt v1.0.36

Weekly downloads
1,581
License
Apache-2.0
Repository
github
Last release
8 months ago

wabt.js

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

npm npm Build Status

Usage

$> npm install wabt
var wabt = require("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 wabt@nightly

or you can use one of the previous versions instead if necessary.

API

  • parseWat(filename: string, buffer: string | Uint8Array): WasmModule Parses a wst source to a module.
  • readWasm(buffer: Uint8Array, options: ReadWasmOptions): WasmModule Reads a wasm binaryen to a module.

  • WasmModule A class representing a WebAssembly module.

    • validate(): void Validates the module. Throws if not valid.
    • resolveNames(): void Resolves names to indexes.
    • generateNames(): void Generates textual names for function types, globals, labels etc.
    • applyNames(): void Applies textual names. Throws on error.
    • toText(options: ToTextOptions): string Converts the module to wat text format.
    • toBinary(options: ToBinaryOptions): ToBinaryResult Converts the module to a wasm binary.
    • destroy(): void Disposes the module and frees its resources.
  • ReadWasmOptions Options modifying the behavior of readWasm.

    • readDebugNames: boolean Reads textual names from the name section.
  • ToTextOptions Options modifying the behavior of WasmModule#toText.

    • foldExprs: boolean
    • inlineExport: boolean
  • ToBinaryOptions Options modifying the behavior of WasmModule#toBinary.

    • log: boolean
    • canonicalize_lebs: boolean
    • relocatable: boolean
    • write_debug_names: boolean
  • ToBinaryResult Result object of WasmModule#toBinary.

    • buffer: Uint8Array The wasm binary buffer.

    • log: string Generated log output.

1.0.36

11 months ago

1.0.35

1 year ago

1.0.32

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.26

3 years ago

1.0.25

4 years ago

1.0.27

3 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.21

4 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.13

5 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.8

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.0

7 years ago

0.0.13

8 years ago