2.8.0 • Published 4 years ago

mountable-hypertrie v2.8.0

Weekly downloads
382
License
MIT
Repository
github
Last release
4 years ago

mountable-hypertrie

Build Status

A Hypertrie wrapper that supports mounting of sub-Hypertries.

Usage

A MountableHypertrie can be mounted within another MountableHypertrie by using the mount command:

const store = corestore(ram)
const trie1 = new MountableHypertrie(store)
const trie2 = new MountableHypertrie(store)

trie2.ready(() => {
  trie1.mount('/a', trie2.key, ...)
})

Assuming trie2 has a value 'hello' at /b/c:

trie1.get('/a/b/c', console.log) // Will return Buffer.from('hello')

A mount can be removed by performing a del on the mountpoint :

trie1.del('/a', err => {
  trie1.get('/a/b/c', console.log) // Will print `null`
})

API

mountable-hypertrie re-exposes the hypertrie API, with the addition of the following methods (and a different constructor):

const trie = new MountableHypertrie(corestore, key, opts)

  • corestore: any object that implements the corestore interface. For now, it's recommanded to use random-access-corestore
  • key is the hypertrie key
  • opts can contain any hypertrie options

trie.mount(path, key, opts, cb)

  • path is the mountpoint
  • key is the key for the MountableHypertrie to be mounted at path

opts can include:

{
  remotePath: '/remote/path', // An optional base path within the mount.
  version: 1                  // An optional checkout version
}

Note: We're still adding support for many hypertrie methods. Here's what's been implemented so far:

  • get
  • put
  • del
  • batch
  • iterator
  • list
  • createReadStream
  • createWriteStream
  • checkout
  • watch
  • createHistoryStream
  • createDiffStream

License

MIT

2.8.0

4 years ago

2.7.0

4 years ago

2.6.0

4 years ago

2.5.3

4 years ago

2.5.0

4 years ago

2.5.2

4 years ago

2.5.1

4 years ago

2.4.15

4 years ago

2.4.14

4 years ago

2.4.13

4 years ago

2.4.12

4 years ago

2.4.11

4 years ago

2.4.10

4 years ago

2.4.9

4 years ago

2.4.8

4 years ago

2.4.7

4 years ago

2.4.6

4 years ago

2.4.5

4 years ago

2.4.4

4 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.4

5 years ago

0.9.3

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago