Socket
Socket
Sign inDemoInstall

hamt-sharding

Package Overview
Dependencies
3
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hamt-sharding

JavaScript implementation of sharding using hash array mapped tries


Version published
Weekly downloads
43K
decreased by-16.08%
Maintainers
2
Install size
471 kB
Created
Weekly downloads
 

Changelog

Source

3.0.6 (2024-02-06)

Trivial Changes

  • rename master to main (4e780c0)
  • update urls (e2a5ccc)

Documentation

Readme

Source

hamt-sharding

codecov CI

JavaScript implementation of sharding using hash array mapped tries

About

A Hash Mapped Trie implementation for JavaScript.

This is used by @helia/unixfs for it's HAMT-sharded directory implementation.

Example

import { createHAMT } from 'hamt-sharding'
import crypto from 'crypto-promise'

// decide how to hash buffers made from keys, can return a Promise
const 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'

Install

$ npm i hamt-sharding

Browser <script> tag

Loading this module through a script tag will make it's exports available as HamtSharding in the global namespace.

<script src="https://unpkg.com/hamt-sharding/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Keywords

FAQs

Last updated on 06 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc