feross / peerdb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

peerdb travis npm downloads

TODO -- WORK IN PROGRESS

Sauce Test Status

features

  • Encrypts files (by default)
  • Modes: central-only, P2P-only (free), hybrid (default)
  • Backed by MaxCDN
  • 100% open source client and server
  • Useful for "serverless websites" (i.e. no backend)

why?

  • Simple API (compare to Amazon S3, CloudFront, requires server-side?)
  • Cheap
  • Using a trustless server to add availability to a P2P app
  • 100% of profits will go to the development of WebTorrent and WebTorrent Desktop

install

npm install peerdb

usage

It's super easy to store data:

var db = require('peerdb')

db.put(Buffer('some data'), function (err, key) {
  // `key` is a unique identifier based on the data (content-addressed)
  db.get(key, function (err, value) {
    console.log(value) // '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, key) {
  // `key` is a unique identifier based on the data (content-addressed)
  db.get(key, function (err, value) {
    console.log(value) // 'some data'

    // Data can be deleted from the central server and the local database
    db.del(key, function (err) {
      // Data is deleted!
    })
  })
})

api

TODO

license

MIT. Copyright (c) WebTorrent, LLC.

About

License:MIT License


Languages

Language:JavaScript 100.0%