Files
cheatsheet-tldr/tldr/wasm-opt
2025-11-29 00:20:05 +00:00

26 lines
671 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# wasm-opt
> Optimize WebAssembly binary files.
> More information: <https://manned.org/wasm-opt>.
- Apply default optimizations and write to a given file:
`wasm-opt -O {{input.wasm}} {{[-o|--output]}} {{output.wasm}}`
- Apply all optimizations and write to a given file (takes more time, but generates optimal code):
`wasm-opt -O4 {{input.wasm}} {{[-o|--output]}} {{output.wasm}}`
- Optimize a file for size:
`wasm-opt -Oz {{input.wasm}} {{[-o|--output]}} {{output.wasm}}`
- Print the textual representation of the binary to console:
`wasm-opt {{input.wasm}} --print`