Skip to content

Commit

Permalink
docs: update readme to be async (libp2p#11)
Browse files Browse the repository at this point in the history
docs: add badges

License: MIT
Signed-off-by: Jacob Heun <jacobheun@gmail.com>
  • Loading branch information
jacobheun authored Jul 12, 2019
1 parent 42b7b07 commit 69f1f94
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# js-libp2p-delegated-content-routing

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
[![](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-delegated-content-routing.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-delegated-content-routing)
[![](https://img.shields.io/travis/libp2p/js-libp2p-delegated-content-routing.svg?style=flat-square)](https://travis-ci.com/libp2p/js-libp2p-delegated-content-routing)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-delegated-content-routing.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-delegated-content-routing)

Leverage other peers in the network to perform Content Routing calls.

## Lead Maintainer
Expand All @@ -18,22 +26,14 @@ const routing = new DelegatedContentRouing(peerId, {
port: 443,
host: 'ipfs.io'
})
const cid = new CID('QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv')

routing.findProviders(key, (err, peerInfos) => {
if (err) {
return console.error(err)
}

console.log('found peers', peerInfos)
})
for await (const peerInfo of routing.findProviders(cid)) {
console.log('found peer', peerInfo)
}

routing.provide(key, (err) => {
if (err) {
return console.error(err)
}

console.log('providing %s', key)
})
await routing.provide(cid)
console.log('providing %s', cid.toBaseEncodedString())
```

## License
Expand Down

0 comments on commit 69f1f94

Please sign in to comment.