1.1.0 • Published 6 years ago

hyperdb-promise v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

hyperdb-promise

NPM Version

HyperDB but with promises instead of callbacks

npm install hyperdb-promise

Usage

import HyperDB from 'hyperdb-promise'

const db = new HyperDB('./my.db', { valueEncoding: 'utf-8' })

db.on('ready', async () => {
  await db.put('/hello', 'world')
  const [{ value }] = await db.get('/hello')
  console.log(`/hello --> ${value}`)
})

Basically, any db instance method that previously accepted a callback as a final argument is now promisified.

Visit the the original HyperDB repo to get more familiar with the API.