npm install peerdb
It's super easy to store data:
var db = require('peerdb')
db.put(Buffer('some data'), function (err, id) {
// `id` is a unique identifier based on the data (content-addressed)
db.get(id, function (err, data) {
console.log(data) // 'some data'
})
})
To ensure that data remains accessible when no peers are online, store it on a centralized content delivery network (CDN):
var db = require('peerdb')
db.setup({
apiKey: '...'
})
db.put(Buffer('some data'), function (err, id) {
// `id` is a unique identifier based on the data (content-addressed)
db.get(id, function (err, data) {
console.log(data) // 'some data'
// Data can be deleted from the central server and the local database
db.del(id, function (err) {
// Data is
})
})
})
TODO
MIT. Copyright (c) Feross Aboukhadijeh.