npm install ministore
// create our db
var Store = require('ministore')('../path/to/db/dir')
// create some collections
var users = Store('users')
var sessions = Store('sessions', { polling: 3000 }) // will save every 3 secs
// sync way (no callback)
users.set('john', 'doe')
users.get('john') // 'doe'
// async way
users.set('mary', 'loo', function(err) {
users.get('mary', function(err, data) {
console.log(data) // 'loo'
})
})
All API methods accept a callback as the last argument, making the process async
Example:
var math = require('ministore')('mdb')('math')
math.set('add', function (a, b) { return a + b })
math.eval('add')(4, 5) // 9