hyperdb-json
v1.0.0
Published
A json-like interface for hyperdb
Downloads
2
Readme
hyperdb-json
A JSON-like interface for hyperdb.
This is a simple wrapper which lets you set
and get
complex objects as key/value mapped prefixes in a hyperdb instance.
TODO:
- [ ] add support for conflicts
- [ ] overwrite old values on set
- [ ] add .delete()
- [ ] add .update()
Installation
npm install hyperdb-json
Usage
var hyperdb = require('hyperdb')
var HyperJson = require('hyperdb-json')
var ram = require('random-access-memory')
var ramStore = () => ram()
var ramStore = () => ram()
var db = hyperdb(ramStore)
var json = HyperJson(db)
db.on('ready', () => {
var bar = {
x: [3, { a: 1 }],
y: {
b: ['it’s', 'good'],
c: 'ok'
}
}
hyperJson.set('foo', bar, (err) => {
hyperJson.get('foo', (err, data) => {
console.log(data)
})
})
})