Skip to content

Latest commit

 

History

History

import-wasm

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

import-wasm npm

Async/sync helpers to import .wasm modules in Node.js without --experimental-wasm-modules flag which was added only in v12.3.0.

Install

$ yarn add import-wasm

Usage

importWasm<T = WebAssembly.Exports>(filePath: string, importObject?: WebAssembly.Imports) => Promise<T>

importWasmSync<T = WebAssembly.Exports>(filePath: string, importObject?: WebAssembly.Imports) => T
import { importWasm, importWasmSync } from 'import-wasm'

(async () => {
  const exports = await importWasm('./example.wasm')
})()

const exports = importWasmSync('./example.wasm')