A tool for formatting .wat
code.
Available as a command-line tool and a library.
For more information on how to use the library, see the API docs.
To get wasmfmt
, you have two options:
To install from crates.io:
sh
cargo install wasmfmt
To install from source:
sh
cargo install --path /path/to/wasmfmt
To format a file in-place, use wasmfmt fix
:
sh
wasmfmt fix /path/to/file.wat
To determine if a file is formatted properly, use wasmfmt check
:
sh
wasmfmt check /path/to/file.wat
To simply see the formatted version of a file, use wasmfmt print
:
sh
wasmfmt print /path/to/file.wat
For more information on how to use the tool, use wasmfmt help
:
sh
wasmfmt help
To build the binary, use Cargo:
sh
cargo build --release
The generated binary is located in target/release/wasmfmt
.
To run the tests, use Cargo:
sh
cargo test
wasmfmt
is distributed under the terms of the MIT license. See LICENSE for details.