Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

findprovs returns object or string #76

@victorb

Description

@victorb

using the method ipfs.dht.findprovs in node environment does not work like one would expect. Using the following code:

var ipfsAPI = require('ipfs-api')

var ipfs = ipfsAPI('localhost', '5001')

const hash = "QmXFmCEhamPHvpbzQ3HMFABrpAXgE7D9jzp6QtvyC8Xp55"

ipfs.dht.findprovs(hash, (err, res) => {
    if(err) throw err
    console.log(res)
    console.log(typeof res)
    console.log("Streamable?", !!res.readable)
    console.log('So what to do with `res` here?')
})

I get the following output sometimes (which works correctly):

object
Streamable? false
So what to do with `res` here?

but other times, it returns this (which is neither streamable or valid json)

string
Streamable? false
So what to do with `res` here?

Originally open issue ipfs/kubo#1851 on go-ipfs but seems to be a bug in this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions