Open aschmahmann opened 1 year ago
or error on it.
FWIW I use this feature here. With an alternative, I'd be happy to switch to that 😄.
@TheDiscordian any reason you couldn't use ipfs files stat /ipfs/<cid>
? Seems like that'd be even better for what you're doing since you wouldn't have to add up the chunks yourself.
@aschmahmann I believe that endpoint would require me to add the CID to my MFS first, which would retrieve all the blocks, which I don't necessarily want to retrieve (because I'm trying to estimate the total size beforehand).
@TheDiscordian iirc things are bit counterintuitive around these APIs:
ipfs files stat
works with detached /ipfs/cid
paths (outside MFS, even when CID it is not in MFS)
ipfs files cp /ipfs/cid /path/in/mfs
it will be lazy, it won't prefetch entire DAG, only root blockIf we reach an agreement on this, I would be more than happy to clean this up. It's just a matter of removing the handler for ErrNotADir
.
Checklist
Location
https://github.com/ipfs/kubo/blob/255e64e49e837afce534555f3451e2cffe9f0dcb/core/commands/ls.go#L50
Description
For some reason
ipfs ls
works on UnixFS files and lists the blocks and dag sizes linked from a file root. I don't know why but IIUC it's been that way for a while. We should either document this feature or error on it. The current setup is confusing.