-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ipfs.files.exists? #780
Comments
@aphelionz I believe that is what
A
Please consider making a proposal to https://github.com/ipfs/interface-ipfs-core/tree/master/API/files with a PR. |
Right, I'm still getting the nomenclature right. Checking to see if the hash exists locally should be enough. Let me try with that and I'll report back and close the issue if it suffices. |
@diasdavid Though, should the pull() function have an error state that throws and therefore doesnt break the promise chain? Or am I using that / reading that incorrectly? |
@aphelionz apologize for the delay. The reason is that right now we don't have timeouts intentionally, which means that the pull/promise chain will wait forever. See: https://github.com/ipfs/interface-ipfs-core/issues/58 Did you consider to add this call to the interface definition? |
Created the issue to get tracked there: ipfs-inactive/interface-js-ipfs-core#146 |
Another possible "exists" request.
I'm working with
ipfs.files.cat
and I may have the need to detect whether a hash exists in the local repo before trying to get it from a gateway. Since the browser node isn't autoatically peering and retrieving files from the DHT yet (or I don't know how to manually implement it yet (or both)), I need to create a workflow that's something like:However, looking at the code for
cat
, I see the pull stream calls at the bottom:I don't think that pull.colllect call is fired if the hash doesn't exist, so when I create a promise chain like below, it never fails or resolves.
Not sure exactly how to proceed. Any advice or workaround is appreciated. Thank you!
The text was updated successfully, but these errors were encountered: