Skip to content

Commit 69f1f94

Browse files
authoredJul 12, 2019
docs: update readme to be async (#11)
docs: add badges License: MIT Signed-off-by: Jacob Heun <jacobheun@gmail.com>
1 parent 42b7b07 commit 69f1f94

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed
 

‎README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# js-libp2p-delegated-content-routing
22

3+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
4+
[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
5+
[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
6+
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
7+
[![](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)
8+
[![](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)
9+
[![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)
10+
311
Leverage other peers in the network to perform Content Routing calls.
412

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

22-
routing.findProviders(key, (err, peerInfos) => {
23-
if (err) {
24-
return console.error(err)
25-
}
26-
27-
console.log('found peers', peerInfos)
28-
})
31+
for await (const peerInfo of routing.findProviders(cid)) {
32+
console.log('found peer', peerInfo)
33+
}
2934

30-
routing.provide(key, (err) => {
31-
if (err) {
32-
return console.error(err)
33-
}
34-
35-
console.log('providing %s', key)
36-
})
35+
await routing.provide(cid)
36+
console.log('providing %s', cid.toBaseEncodedString())
3737
```
3838

3939
## License

0 commit comments

Comments
 (0)