Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix(dht): allow for options object in findProvs() API
Browse files Browse the repository at this point in the history
This is to complement: ipfs-inactive/interface-js-ipfs-core#337

Fixes #1322
  • Loading branch information
0x-r4bbit committed Jul 20, 2018
1 parent 48aceb1 commit 6844dfb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/components/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ module.exports = (self) => {
* @param {function(Error, Array<PeerInfo>)} [callback]
* @returns {Promise<PeerInfo>|void}
*/
findprovs: promisify((key, callback) => {
findprovs: promisify((key, opts, callback) => {
if (typeof key === 'string') {
key = new CID(key)
}

self._libp2pNode.contentRouting.findProviders(key, callback)
if (typeof opts === 'function') {
callback = opts
opts = {}
}

opts = opts || {}

self._libp2pNode.contentRouting.findProviders(key, opts.timeout || null, callback)
}),

/**
Expand Down

0 comments on commit 6844dfb

Please sign in to comment.