Wat is het WASM-bestandsformaat?
Een .wasm-bestand is een gecompileerde WebAssembly-module: draagbare binaire bytecode voor een op een stack gebaseerde virtuele machine. Ontwikkelaars schrijven code in C, C++, Rust, Go of een andere ondersteunde taal en compileren deze naar .wasm zodat deze op bijna-native snelheid draait. Op het web draait de module naast JavaScript; de browser haalt deze op en voert deze uit in een sandbox zonder directe toegang tot uw systeem.
WebAssembly is een open standaard van de W3C WebAssembly Working Group, voor het eerst stabiel in maart 2017 en een W3C-aanbeveling sinds december 2019. Elke module begint met de 8-byte header 00 61 73 6D 01 00 00 00 (de string \0asm plus een versieveld), gevolgd door genummerde secties voor types, imports, functies, geheugen, exports en de code. De leesbare tekstuele tegenhanger is het .wat-formaat.
Beveiliging & veiligheid
RISICO: MEDIUMWebAssembly runs inside a sandbox with no direct access to the file system, network, or DOM unless the host grants it, so a module cannot escape on its own. The risk comes from what the surrounding page or runtime allows: malicious sites have used Wasm for in-browser cryptomining and for obfuscating logic that is harder to read than JavaScript. Only run standalone .wasm files from sources you trust, since a WASI runtime can be given file and network permissions.
Formaatdetails
in een notendop- Wavefront / general 3D scene data - A few older or niche 3D and simulation tools have used .wasm for scene or mesh data, unrelated to WebAssembly.
- Application-specific save or cache files - Some standalone programs have reused the .wasm extension for internal data files; these are not WebAssembly modules and lack the \0asm header.
Programma's die WASM-bestanden openen
.wasm served by a page and shows the disassembled module in the Debugger panel. .wasm modules automatically when a web page instantiates them; DevTools can disassemble and debug them. wasm2wat file.wasm -o file.wat to disassemble the binary into readable text; wasm-objdump prints section details. wasm2wat file.wasm; installable via Homebrew. wasm2wat file.wasm or dump sections with wasm-objdump -x file.wasm. Technische details
diepe specificaties| Encoding | Binary bytecode (stack-machine instructions) |
| Byte order | Little-endian for multi-byte scalars; LEB128 for integers |
| Container | Module = 8-byte header followed by a sequence of numbered sections |
| Compression | None built in; commonly served with gzip or Brotli over HTTP |
| Typical size | Tens of KB to several MB depending on the compiled program |
| Structure | Header (magic + version) then sections: Type, Import, Function, Table, Memory, Global, Export, Start, Element, Code, Data, plus optional Custom sections (names, DWARF debug info). |
| Integrity | No internal checksum; integrity handled by transport (HTTPS) or Subresource Integrity on the web |
| Platforms | Windows, macOS, Linux, Android, iOS, Web |
| Initial Release Full | March 2017 (MVP / binary format version 1) |
| Notes | Text-format counterpart is the .wat file. Source languages such as C, C++, Rust and Go compile to .wasm. Runs sandboxed in browsers and in standalone runtimes (Wasmtime, Wasmer, WasmEdge, WAMR). WASI extends it to server and CLI use. |
| Instruction Set | Virtual stack machine, structured control flow, 32/64-bit integers and floats, linear memory |
| Debug Info | Optional DWARF data and a name section carried in Custom sections |
| Uitgebracht | 2017 |
| Laatste versie | WebAssembly 3.0 (2025); binary version field 0x01 |
| Open standaard | Ja · royaltyvrij |
| Specificatie | webassembly.github.io |
WASM conversies
Community V&A
gevraagd door gebruikersNog geen vragen - wees de eerste om iets te vragen over WASM-bestanden.
Veelgestelde vragen
Hoe open ik een WASM-bestand?
wasm2wat file.wasm van WABT, of voert u het buiten een browser uit met Wasmtime of Wasmer.Kan ik een WASM-bestand bewerken?
.wat-tekstformaat met wasm2wat, bewerk dat, en zet het weer in elkaar met wat2wasm. Voor echte wijzigingen bewerkt u normaal gesproken de originele C, C++ of Rust-broncode en compileert u deze opnieuw.Wat is het verschil tussen .wasm en .wat?
.wasm is het compacte binaire bestand dat een machine uitvoert; .wat is de equivalente menselijk leesbare tekst (WebAssembly Text Format). Ze kunnen zonder verlies heen en weer worden geconverteerd met WABT.Waarom downloadt mijn browser een .wasm-bestand in plaats van het uit te voeren?
.wasm verzenden met het MIME-type application/wasm. Als het wordt geserveerd als een generiek of teksttype, kan de browser het downloaden of weigeren het via stream-compilatie uit te voeren. Pas het content-type van de server aan.Is een WASM-bestand veilig om uit te voeren?
Welke programma's maken WASM-bestanden?
wasm32 target met wasm-pack, TinyGo/Go en Clang/LLVM produceren .wasm-output.