then-flat-file-db

1.0.0 • Public • Published

then-flat-file-db

Promise based interface for flat-file-db

Build Status

Installation

npm install then-flat-file-db

Usage

var db = require('then-flat-file-db')(require('flat-file-db')('./data.db'))
 
db.on('open')
    .then(() => {
        db.put('hello', { world: 1 }) // store some data
        console.log(db.get('hello')) // -> { world: 1 }
        // 'hello' might not be fully persisted yet
        return db.put('hey', { world: 2 })
    })
    .then(() => {
        // 'hey' is fully persisted, so the Promise resolves
        console.log(db.get('hey')) // -> { world: 2 }
    })

License

Copyright ©️ 2017 Maximilian Stoiber, licensed under the MIT license. See LICENSE for more information.

Package Sidebar

Install

npm i then-flat-file-db

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mxstbr