Key-Value database for orbit-db
A key-value database just like your favourite key-value database.
Used in orbit-db.
npm install orbit-db ipfs
First, create an instance of OrbitDB:
import * as IPFS from 'ipfs'
import OrbitDB from 'orbit-db'
const ipfs = new IPFS()
const orbitdb = await OrbitDB.createInstance(ipfs)
Get a key-value database and add an entry to it:
const kv = await orbitdb.kvstore('settings')
kv.put('volume', '100')
.then(() => {
console.log(kv.get('volume'))
// 100
})
Later, when the database contains data, load the history and query when ready:
const kv = await orbitdb.kvstore('settings')
kv.events.on('ready', () => {
console.log(kv.get('volume'))
// 100
})
See orbit-db's API Documentation for full details.
If you think this could be better, please open an issue!
Please note that all interactions in @orbitdb fall under our Code of Conduct.
MIT ©️ 2016-2018 Protocol Labs Inc., 2018 Haja Networks Oy