Что такое формат файла WASM?
Файл .wasm - это скомпилированный модуль WebAssembly: переносимый бинарный байт-код для стековой виртуальной машины. Разработчики пишут код на C, C++, Rust, Go или другом поддерживаемом языке и компилируют его в .wasm, чтобы он работал со скоростью, близкой к нативной. В вебе модуль работает вместе с JavaScript; браузер загружает его и выполняет в «песочнице» без прямого доступа к вашей системе.
WebAssembly - это открытый стандарт рабочей группы W3C WebAssembly, первая стабильная версия которого появилась в марте 2017 года, а с декабря 2019 года он является рекомендацией W3C. Каждый модуль начинается с 8-байтового заголовка 00 61 73 6D 01 00 00 00 (строка \0asm плюс поле версии), за которым следуют пронумерованные разделы для типов, импорта, функций, памяти, экспорта и самого кода. Текстовым аналогом является формат .wat.
Безопасность и защита
РИСК: 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.
Детали формата
в двух словах- 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.
Программы, открывающие файлы WASM
.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. Технические подробности
глубокая спецификация| 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 |
| Выпущен | 2017 |
| Последняя версия | WebAssembly 3.0 (2025); binary version field 0x01 |
| Открыть стандартное | Да · без роялти |
| Спецификация | webassembly.github.io |
Конвертации WASM
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах WASM.
Часто задаваемые вопросы
Как мне открыть файл WASM?
wasm2wat file.wasm из WABT или запустите вне браузера через Wasmtime или Wasmer.Можно ли редактировать файл WASM?
.wat с помощью wasm2wat, отредактируйте его, а затем соберите обратно через wat2wasm. Для серьезных изменений обычно редактируют исходный код на C, C++ или Rust и проводят перекомпиляцию.В чем разница между .wasm и .wat?
.wasm - это компактный бинарный файл, который исполняет машина; .wat - это эквивалентный человекочитаемый текст (WebAssembly Text Format). Они конвертируются друг в друга без потерь с помощью WABT.Почему мой браузер скачивает файл .wasm вместо того, чтобы запустить его?
.wasm с MIME-типом application/wasm. Если он передается как обычный двоичный или текстовый файл, браузер может скачать его или отказаться от потоковой компиляции. Исправьте тип контента (Content-Type) на сервере.Безопасно ли запускать файл WASM?
Какие программы создают файлы WASM?
wasm32 и wasm-pack, TinyGo/Go и Clang/LLVM, генерируют выходные файлы .wasm.