Skip to content

Commit

Permalink
chore(dht): add API to allow options in findProvs()
Browse files Browse the repository at this point in the history
As discussed in: ipfs/js-ipfs#1322 (comment)

License: MIT
Signed-off-by: Pascal Precht <[email protected]>
  • Loading branch information
0x-r4bbit committed Jul 20, 2018
1 parent 7ed2b58 commit 702665f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SPEC/DHT.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ A great source of [examples][] can be found in the tests for this API.
##### `Go` **WIP**

##### `JavaScript` - ipfs.dht.findprovs(hash, [callback])
##### `JavaScript` - ipfs.dht.findprovs(hash, [options, callback])

Where `hash` is a multihash.

`options` an optional object with the following properties
- `timeout` - a maximum timeout in milliseconds

`callback` must follow `function (err, peerInfos) {}` signature, where `err` is an error if the operation was not successful. `peerInfos` is an array of objects of type [PeerInfo](https://github.com/libp2p/js-peer-info)

If no `callback` is passed, a promise is returned.
Expand All @@ -51,6 +54,8 @@ If no `callback` is passed, a promise is returned.

```JavaScript
ipfs.dht.findprovs(multihash, function (err, peerInfos) {})

ipfs.dht.findprovs(multihash, { timeout: 4000 }, function (err, peerInfos) {})
```

A great source of [examples][] can be found in the tests for this API.
Expand Down

0 comments on commit 702665f

Please sign in to comment.