Web Assembly can make use of OS capabilities with the Web Assembly System Interface. It allows calls to OS functionality like clock, fs, network etc.
- WASM is the fourth W3C web standard next to HTML, CSS and JS
- WASI is an additional spec that standardizes how Web Assembly can do more than just run in a sandboxed environment but interact with system resources.
- Runtimes supporting WASI:
- wasmtime
- wasmer
- wasm3
- wasmer offers a package manager for WASM modules called WAPM
- WASI needs to be implemented for each language/platform (browsers use a memory FS)
- WASI is bound to the WASM module as imports during instanciation
- Many languages already compile to WASM: C/C++ via Emscripten, Rust, many more to come
- WASM runs in JS engines by default, Other languages can use bindings for a WASM runtime like WASMER
- edge support: for example in cloudflare workers
- More lightweight than containers
- Highly portable (just need a WASM runtime)
- Functions as a compile target for nearly every language
- No killer feature for majoriy classic web use cases, extra effort not justified since JS does the job well enough already
- high performance:
- web
- TensorFlow JS
- Google Earth
- Unity (Game Engine)
- Auto CAD
- devops: lightweight deployments with WASM and Docker
- web
- edge computing: very fast startup (example: Cloud flare workers
- using a different language that doesn't run in the browser: Python in the browser (PyScript
- security: sandboxed enviroment, fine-grained control over what the WASM program can see (env vars, folder & files, args, sockets, etc)