8000 GitHub - bnchrch/orbit-db-kvstore: Key-Value database for orbit-db
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bnchrch/orbit-db-kvstore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

orbit-db-kvstore

Gitter Matrix Discord npm version

Key-Value database for orbit-db

A key-value database just like your favourite key-value database.

Used in orbit-db.

Table of Contents

Install

npm install orbit-db ipfs

Usage

First, create an instance of OrbitDB:

const IPFS = require('ipfs')
const OrbitDB = require('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 = orbitdb.kvstore('settings')
kv.events.on('ready', () => {
  console.log(kv.get('volume'))
  // 100
})

API

See orbit-db's API Documenations for full details.

Contributing

If you think this could be better, please open an issue!

Please note that all interactions in @orbitdb fall under our Code of Conduct.

License

MIT ©️ 2016-2018 Protocol Labs Inc., 2018 Haja Networks Oy

About

Key-Value database for orbit-db

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0