I have been using IPFS at the IPLD level for a while, but now I have to deal with files, i.e. UnixfsV1. I need to do some sanity checks on CIDs passed into my code, such as checking if it’s a file or a directory, and checking the file size before downloading a potentially huge stream of bytes.
Therefore I am looking for a way to obtain metadata given a dag-pb CID, and in particular the
filesize fields of the ProtoBuf record, using the HTTP API. In principle, I can use the block API (
/api/v0/block/get) to obtain the raw data and decode the ProtoBuf myself, but I would prefer to avoid going into such low-level details.
Is there a simpler way?