dat-peers

2.0.0 • Public • Published

dat-peers

An implementation of Beaker's experimental datPeers API. Pass in a hyperdrive, and it does the rest

npm install --save dat-peers
const DatPeers = require('dat-peers')
 
const hyperdiscovery = require('hyperdiscovery')
 
const hyperdrive = require('hyperdrive')
 
const archive = hyperdrive()
 
const discovery = hyperdiscovery(archive, {
  extensions: DatPeers.EXTENSIONS
})
 
const datPeers = new DatPeers(archive)
 
datPeers.on('message', ({message, peer}) => {
    setTimeout(() => {
      peer.send(message)
    }, 1000)
})

Package Sidebar

Install

npm i dat-peers

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

8.03 kB

Total Files

5

Last publish

Collaborators

  • rangermauve