UNPKG

blake3

Version:

BLAKE3 hashing for JavaScript: native Node bindings (where available) and WebAssembly

10 lines (7 loc) 347 B
const path = require('path').join(__dirname, 'blake3_js_bg.wasm'); const bytes = require('fs').readFileSync(path); let imports = {}; imports['./blake3_js.js'] = require('./blake3_js.js'); const wasmModule = new WebAssembly.Module(bytes); const wasmInstance = new WebAssembly.Instance(wasmModule, imports); module.exports = wasmInstance.exports;