Get some info about UnixFS objects on public IPFS HTTP API #8528
Labels
kind/enhancement
A net-new feature or improvement to an existing feature
P2
Medium: Good to have, but can wait until someone steps up
topic/gateway
Topic gateway
Checklist
Description
I am implementing a backend to access IPFS via the Python library fsspec at ipfsspec. To do so (and to save me from implementing the IPFS protocol in Python), the plan is to access UnixFS files and directories on IPFS via a HTTP gateway. An
fsspec
backend needs to implement a functioninfo(path)
which must returnTo me, this seems to be a reasonable requirement for other generic filesystem abstractions as well, thus I assume that this feature request could be of broader interest.
While the
/v0/files/stat
provides this kind of information, this endpoint is often not reachable on public gateways.Another option to obtain this information is to perform a
HEAD
request towardshttp://gateway/ipfs/CID
, which in case of a file provides the size in thecontent-length
header and which (seemingly) lets me discriminate between file and directory using theetag
header. This method works on some public gateways, but scares me as well, as this doesn't seem to be the right use of observable API features.I see three possible ways to obtain the desired functionality:
files/stat
API to public gateway port (could this beGET
as well?)/ipfs/CID
is requestedTagging @whyrusleeping as I've been talking to him about this already on slack.
The text was updated successfully, but these errors were encountered: