mountable-hypertrie
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 = const trie1 = storeconst trie2 = store trie2
Assuming trie2
has a value 'hello' at /b/c
:
trie1 // Will return Buffer.from('hello')
A mount can be removed by performing a del
on the mountpoint :
trie1
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 userandom-access-corestore
key
is the hypertrie keyopts
can contain anyhypertrie
options
trie.mount(path, key, opts, cb)
path
is the mountpointkey
is the key for the MountableHypertrie to be mounted atpath
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