Synchronously load WebAssembly (.wasm
) files.
Pass an absolute filename to the wequire()
function. The result is the exports
property of a WebAssembly.Instance
.
const Wequire = require('wequire');
const Path = require('path');
const mod = Wequire(Path.join(__dirname, 'test.wasm'));
console.log(mod);
A single function is exported.
- Arguments
request
(string) - The absolute path to a.wasm
file.imports
(object) - An optional argument passed as theimportObject
argument to theWebAssembly.Instance()
constructor.
- Returns
- object - The
exports
property of aWebAssembly.Instance
.
- object - The