@dashevo/dapi-db-kvstore

1.4.2 • Public • Published

orbit-db-kvstore

npm version

An append-only log with traversable history. Useful for "latest N" use cases or as a message queue.

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 = new OrbitDB(ipfs)

Get a key-value database and add an entry to it:

const kv = 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

See orbit-db's contributing guideline.

License

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

Readme

Keywords

none

Package Sidebar

Install

npm i @dashevo/dapi-db-kvstore

Weekly Downloads

1

Version

1.4.2

License

MIT

Unpacked Size

4.78 kB

Total Files

7

Last publish

Collaborators

  • shumkov
  • alex-werner
  • nmarley
  • cofresi
  • antouhou
  • evodeploy
  • jawid-h