### Table of Contents - [constructor](#constructor) - [get](#get) - [set](#set) - [delete](#delete) - [flush](#flush) - [emptyTreeState](#emptytreestate) - [ArrayConstructor](#arrayconstructor) - [getMerkleLink](#getmerklelink) ## constructor [index.js:18-25](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L18-L25 "Source code on GitHub") **Parameters** - `opts` - `opts.root` {object} a merkle root to a radix tree. If none, RadixTree will create an new root. - `opts.db` {object} a level db instance alternitly `opts.graph` can be used - `opts.graph` {object} an instance of [ipld-graph-builder](https://github.com/ipld/js-ipld-graph-builder) alternitvly `opts.dag` can be used - `opts.dag` {object} an instance if [ipfs.dag](https://github.com/ipfs/js-ipfs#dag). If there is no `opts.graph` this will be used to create a new graph instance. ## get [index.js:114-122](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L114-L122 "Source code on GitHub") gets a value given a key. The promise resolves with an object containing `node` the node in the merkle tree and `value` the value of the that the node contains **Parameters** - `key` **any** - `decode` Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## set [index.js:129-167](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L129-L167 "Source code on GitHub") stores a value at a given key **Parameters** - `key` **any** - `value` Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## delete [index.js:174-226](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L174-L226 "Source code on GitHub") deletes a value at a given key **Parameters** - `key` **any** Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## flush [index.js:232-234](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L232-L234 "Source code on GitHub") creates a merkle root for the current tree and stores the data perstantly Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ## emptyTreeState [index.js:30-32](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L30-L32 "Source code on GitHub") returns the state of an empty tree ## ArrayConstructor [index.js:38-40](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L38-L40 "Source code on GitHub") returns an Uint1Array constructir which is used to repersent keys Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## getMerkleLink [index.js:47-49](https://github.com/dfinity/js-dfinity-radix-tree/blob/fda15f34eac1f4b4ff2d0ef6a7a5fad66936f6ad/index.js#L47-L49 "Source code on GitHub") returns a merkle link for some given data **Parameters** - `data` **[Buffer](https://nodejs.org/api/buffer.html)** the data which you would like to hash Returns **[Buffer](https://nodejs.org/api/buffer.html)**