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

How to find out whether an IPFS hash is a directory or file? #1230

Closed
AdityaNambiar opened this issue Jan 31, 2020 · 1 comment
Closed

How to find out whether an IPFS hash is a directory or file? #1230

AdityaNambiar opened this issue Jan 31, 2020 · 1 comment

Comments

@AdityaNambiar
Copy link

Hello,
is there a way to programmatically figure out when a multihash is received whether it is a directory or a raw file?
I tested this by doing a ipfs ls on the multihash of a raw file and it returned nothing. So I assume thats the same case for the ipfs.ls() method from this library.
So I wonder if there is any method that this library might be providing or reflecting from the IPFS API methods to fetch some metadata that gives answer to my question asked above?

@AdityaNambiar
Copy link
Author

ipfs.files.stat returns a Promise object containing a "type" key that does what is mentioned in the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant