wasm-tools print: Convert Wasm Binary to WAT
wasm-tools print decodes a binary module or component into readable text (WAT for modules, component text for components).
Where wasm2wat handles core modules, wasm-tools print also renders components, making it the tool to read component-model artifacts in CI logs and diffs.
What it does
wasm-tools print parses a binary and prints its text form. For a component it renders the component text with nested modules and instances; for a core module it renders WAT. The inverse is wasm-tools parse (text to binary).
Common usage
wasm-tools print module.wasm
wasm-tools print component.wasm -o component.wat
wasm-tools print --skeleton component.wasm
wasm-tools parse module.wat -o module.wasmOptions
| Flag | What it does |
|---|---|
| -o <file> | Write text output to a file |
| --skeleton | Print only the structure, omitting function bodies |
| parse (subcommand) | The inverse: assemble WAT/WIT text into a binary |
In CI
Use --skeleton to diff the imports/exports and structure of two artifacts without the noise of full function bodies. print is read-only and safe on any artifact.
Common errors in CI
"error: expected ( but got ..." appears when a text file is passed to a binary path expectation, or vice versa. "error: input is not valid wasm" means a corrupt or non-wasm file. Component-specific decode errors name the failing component section.