keyvaluedb

1.4.2 • Public • Published

keyvaluedb

source issues documentation

node package manager travis-ci lgtm david-dm david-dm

Key Value database middleware for node and the browser.

Install

Node
npm i keyvaluedb

Usage

Either a specific database class can be initialized, or the defaultDB function can be used to attempt to find a DB that works in your runtime environment.

const { defaultDB, memoryDB, chromeStorageDB } = require('keyvaluedb')
const db = defaultDB()
await db.set('key', 'value')
await db.get('key') // value
await db.setMany({1: 1, 2: 2})
await db.getMany([1, 2]) // {1: 1, 2: 2}

Then you are free to make use of the promised based get, set, setMany and getMany functions. See tests for examples.

Mixin

To use as an es6 class mixin, first use object-to-class.

const o2c = require('object-to-class')
const MemoryDB = o2c(memoryDB, 'MemoryDB')
class MyDB extends MemoryDB {}
let mydb = new MyDB()
mydb instanceof MemoryDB // true

License

MIT Copyright isysd public@iramiller.com

Dependencies (0)

    Dev Dependencies (13)

    Package Sidebar

    Install

    npm i keyvaluedb

    Weekly Downloads

    0

    Version

    1.4.2

    License

    MIT

    Unpacked Size

    22.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • isysd