### Table of Contents - [constructor][1] - [root][2] - [get][3] - [set][4] - [delete][5] - [done][6] - [flush][7] - [rootExists][8] - [emptyTreeState][9] - [ArrayConstructor][10] - [getMerkleLink][11] ## constructor [index.js:18-25][12] **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; alternatively, `opts.graph` can be used - `opts.graph` {object} an instance of [ipld-graph-builder][13]; alternatively, `opts.dag` can be used - `opts.dag` {object} an instance if [ipfs.dag][14]. If there is no `opts.graph` this will be used to create a new graph instance. - `opts.decoder` {object} a cbor decoder ## root [index.js:31-33][15] the root of the tree Type: [Buffer][16] ## get [index.js:44-48][17] gets a value given a key **Parameters** - `key` **any** Returns **[Promise][18]** ## set [index.js:98-101][19] stores a value at a given key returning the tree node that the value was saved in **Parameters** - `key` **any** - `value` Returns **[Promise][18]** ## delete [index.js:150-153][20] smContainer.js deletes a value at a given key **Parameters** - `key` **any** Returns **[Promise][18]** ## done [index.js:212-218][21] returns a promise that resolve when the tree is done with all of its writes Returns **[Promise][18]** ## flush [index.js:234-238][22] creates a merkle root for the current tree and stores the data persistently Returns **[Promise][18]** ## rootExists [index.js:250-258][23] Checks if a given root exists or not **Parameters** - `root` **[Buffer][16]** Returns **[Promise][18]<[boolean][24]>** ## emptyTreeState [index.js:279-281][25] returns the state of an empty tree ## ArrayConstructor [index.js:287-289][26] returns an Uint1Array constructor which is used to represent keys Returns **[object][27]** ## getMerkleLink [index.js:296-298][28] returns a merkle link for some given data **Parameters** - `data` **[Buffer][16]** the data which you would like to hash Returns **[Buffer][16]** [1]: #constructor [2]: #root [3]: #get [4]: #set [5]: #delete [6]: #done [7]: #flush [8]: #rootexists [9]: #emptytreestate [10]: #arrayconstructor [11]: #getmerklelink [12]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L18-L25 "Source code on GitHub" [13]: https://github.com/ipld/js-ipld-graph-builder [14]: https://github.com/ipfs/js-ipfs#dag [15]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L31-L33 "Source code on GitHub" [16]: https://nodejs.org/api/buffer.html [17]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L44-L48 "Source code on GitHub" [18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise [19]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L98-L101 "Source code on GitHub" [20]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L150-L153 "Source code on GitHub" [21]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L212-L218 "Source code on GitHub" [22]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L234-L238 "Source code on GitHub" [23]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L250-L258 "Source code on GitHub" [24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean [25]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L279-L281 "Source code on GitHub" [26]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L287-L289 "Source code on GitHub" [27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object [28]: https://github.com/dfinity/js-dfinity-radix-tree/blob/588bfeefe36f73792935e70a42db416f2a0d838c/index.js#L296-L298 "Source code on GitHub"