wasm-instantiate-streaming
Polyfill of WebAssembly.instantiateStreaming
instantiateStreaming
loading WebAssembly modules efficiently
The optimizations we applied can be summarized as follows:
- Use asynchronous APIs to avoid blocking the main thread
- Use streaming APIs to compile and instantiate WebAssembly modules more quickly
- Don’t write code you don’t need
— Loading WebAssembly modules efficiently | Web | Google Developers
Install
npm install wasm-instantiate-streaming
Usage
Using import/require
// For browser // Use with node-fetchconst fetch = // Use with fs moduleconst fs = const promisify = const readFile =
Using without import/require
Please use build/browser.min.js
Pass importsObject
const importObject = imports: { console }
API
See MDN document
Development
git clone git@github.com:Leko/wasm-instantiate-streaming.gitcd wasm-instantiate-streaming git submodule update --init --recursivecd deps/wabtmakecd ../.. npm installnpm test