LinuxCommandLibrary

wat2wasm

Assemble WebAssembly text to binary

TLDR

Compile WAT to WASM

$ wat2wasm [input.wat]
copy
Output to file
$ wat2wasm [input.wat] -o [output.wasm]
copy
Validate only
$ wat2wasm --validate [input.wat]
copy
Verbose output
$ wat2wasm -v [input.wat]
copy
Debug names
$ wat2wasm --debug-names [input.wat]
copy

SYNOPSIS

wat2wasm [-o output] [-v] [options] input

DESCRIPTION

wat2wasm is an assembler from the WABT (WebAssembly Binary Toolkit) that compiles WebAssembly Text Format (WAT) files into binary WebAssembly (.wasm) modules. It is the counterpart to wasm2wat, which performs the reverse conversion.
The tool validates the input WAT source against the WebAssembly specification during compilation, reporting syntax and type errors before producing output. A validate-only mode can check files without generating binary output, which is useful in build pipelines.
The --debug-names option embeds function and variable names from the WAT source into the binary as custom sections, making the output easier to debug in browsers and other tools that display named symbols.

PARAMETERS

-o FILE

Output file.
-v
Verbose.
--validate
Validate only.
--debug-names
Include debug names.
--help
Show help.

CAVEATS

WAT syntax required. Part of WABT. Strict validation.

HISTORY

wat2wasm is part of WABT (WebAssembly Binary Toolkit), compiling WAT text format to binary WASM.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community