The `blake3-wasm` package provides high-performance WebAssembly bindings for the BLAKE3 cryptographic hash function, enabling efficient hashing operations in JavaScript environments, including Node.js (>=16) and modern browsers. BLAKE3 is renowned for its speed, security, and parallel processing capabilities, making it a robust choice for various applications. This package specifically wraps the BLAKE3 WebAssembly module, offering a lean implementation focused solely on WASM performance rather than hybrid native bindings. The current stable version, 3.0.0, marks a significant shift to an ES Modules-only API and requires explicit asynchronous initialization. While the major version hasn't seen frequent updates since its release (October 2022), the underlying `connor4312/blake3` project, from which this package is derived, appears to be actively maintained, suggesting a stable, feature-complete API for `blake3-wasm`.
npm install blake3-wasmVerified import paths — ran on the pinned version, not inferred.
Demonstrates asynchronous initialization, one-shot hashing, and incremental hashing using `createHasher` for larger data streams, including custom output lengths.
Migrate your project to use ES Modules. For Node.js, ensure your `package.json` has `"type": "module"` or use `.mjs` file extension. Replace `require('blake3-wasm')` with `import { ... } from 'blake3-wasm'`.Always call and `await` the `init()` function once at the start of your application before attempting to use `hash` or `createHasher`. Example: `import { init, hash } from 'blake3-wasm'; await init();`Ensure the `.wasm` file (if external) is correctly served with `application/wasm` MIME type and is accessible from your application's origin. Handle potential `init()` rejection gracefully with a `try...catch` block.
For large inputs, instantiate a hasher with `createHasher()`, feed data in chunks using `hasher.update(chunk)`, and retrieve the final hash with `hasher.digest()`.
Ensure your project is configured for ES Modules. Add `"type": "module"` to your `package.json` or rename your file to `.mjs`. If using Node.js, upgrade to version 16 or newer.
Make sure `await init()` is called once and completes successfully before any calls to `hash()` or `createHasher()`.
Verify that `await init()` has completed and that you are using named imports: `import { init, hash } from 'blake3-wasm';`.Check your server configuration to ensure `.wasm` files are served with the `Content-Type: application/wasm` header. Verify the `.wasm` file path is correct and accessible. If self-hosting, ensure proper CORS headers are set if loading from a different origin.
No dependency data recorded yet.