Last active
June 2, 2018 07:52
-
-
Save hackergrrl/1dc3caebad2895bb79e6a9d85973b21c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hyperdb = require('hyperdb') | |
var json = { | |
encode: function (obj) { | |
return Buffer.from(JSON.stringify(obj)) | |
}, | |
decode: function (buf) { | |
var str = buf.toString('utf8') | |
try { var obj = JSON.parse(str) } catch (err) { return {} } | |
return obj | |
} | |
} | |
var fn = '21b2b9ff201b01e6081709d82e6b81a5cf3a68d2cd5f092d0ffec58772642892' | |
var db = hyperdb(fn, { valueEncoding: json }) | |
db.ready(function () { | |
db.get('messages/default/787', function (err, node) { | |
console.log('odd res', err, node) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This exits because nothing is on the event loop. You need to setup replication to make this work. We do need a wait: true flag tho