esm.sh
esm.sh copied to clipboard
Use WebAssembly.compileStreaming for WebAssembly modules
I was reading the docs, and I noticed this example as a wasm import: https://esm.sh/@dqbd/[email protected]/tiktoken_bg.wasm?module
That code first fetches the wasm code, and then it compiles it. This can be done more efficiently, by compiling the wasm code while it is being downloaded:
export default await WebAssembly.compileStreaming(fetch("https://esm.sh/@dqbd/[email protected]/tiktoken_bg.wasm"));
@nicolo-ribaudo good to know! would you like to create a PR? or i will do it later, thanks
@nicolo-ribaudo good to know! would you like to create a PR? or i will do it later, thanks