A Hash Mapped Trie implementation for JavaScript.
This is used by @helia/unixfs for it's HAMT-sharded directory implementation.
import { createHAMT } from 'hamt-sharding'import crypto from 'crypto-promise'// decide how to hash buffers made from keys, can return a Promiseconst hashFn = async (buf) => { return crypto .createHash('sha256') .update(buf) .digest()}const bucket = createHAMT({ hashFn: hashFn})await bucket.put('key', 'value')const output = await bucket.get('key')// output === 'value' Copy
import { createHAMT } from 'hamt-sharding'import crypto from 'crypto-promise'// decide how to hash buffers made from keys, can return a Promiseconst hashFn = async (buf) => { return crypto .createHash('sha256') .update(buf) .digest()}const bucket = createHAMT({ hashFn: hashFn})await bucket.put('key', 'value')const output = await bucket.get('key')// output === 'value'
Generated using TypeDoc
A Hash Mapped Trie implementation for JavaScript.
This is used by @helia/unixfs for it's HAMT-sharded directory implementation.
Example