Skip to content

Commit 702665f

Browse files
committed
chore(dht): add API to allow options in findProvs()
As discussed in: ipfs/js-ipfs#1322 (comment) License: MIT Signed-off-by: Pascal Precht <[email protected]>
1 parent 7ed2b58 commit 702665f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SPEC/DHT.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ A great source of [examples][] can be found in the tests for this API.
3939
4040
##### `Go` **WIP**
4141

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

4444
Where `hash` is a multihash.
4545

46+
`options` an optional object with the following properties
47+
- `timeout` - a maximum timeout in milliseconds
48+
4649
`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)
4750

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

5255
```JavaScript
5356
ipfs.dht.findprovs(multihash, function (err, peerInfos) {})
57+
58+
ipfs.dht.findprovs(multihash, { timeout: 4000 }, function (err, peerInfos) {})
5459
```
5560

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

0 commit comments

Comments
 (0)