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 (#1457)
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 authored and alanshaw committed Aug 2, 2018
1 parent 7860d0f commit 99911b1
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 99911b1

Please sign in to comment.