I am looking to render IPFS CID’s on my client-side app. However, how do I know if I am dealing with an image or a video or any other sort of file or directory that could be stored as a CID?
Q: Is there any way to see what sort of data a CID represents from the CID or bytes data?
I’ll take a stab at answering this with an example.
Let’s say you have the following CID of an image: bafybeibml5uieyxa5tufngvg7fgwbkwvlsuntwbxgtskoqynbt7wlchmfm
If you load the CID in the CID inspector you can see the multicodec is dag-pb which is a MerkleDAG protobuf. This just helps decode the block that this CID points to, but won’t tell you much about the file.
If the CID doesn’t contain the information, maybe the root block does?
The answer is no. For more information, check out the UnixFS Data Format.
Below is a screenshot from the IPLD explorer for this CID