ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

refs and resolve don't work with sharded directories #2389

Closed lidel closed 1 year ago

lidel commented 5 years ago

Filling this so we don't forget to match recent fixes in go-ipfs (https://github.com/ipfs/go-ipfs/issues/6596)

Version information:

0.37.0

Description:

jsipfs refs does not work with HAMT-sharded unixfs directories:

$ jsipfs refs -r /ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html
Failed to get refs for /ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html: Object has no property 'wiki'

same problem with ipfs resolve:

$ jsipfs resolve -r /ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/
Object has no property 'wiki'

Interop notes

resolve works fine in go-ipfs v0.4.22 and refs was fixed in https://github.com/ipfs/go-ipfs/issues/6596 and will land in v0.5.0

achingbrain commented 5 years ago

I wonder if we couldn't refactor all the refs code to use the unixfs-exporter - it operates on paths, will return dag-pb, dag-cbor, etc nodes and handles all the hamt stuff transparently.

dirkmc commented 5 years ago

Originally I wrote it to use unixfs-exporter, but I believe at that time unixfs-exporter didn't have a streaming API, and it would only traverse unixfs objects. Have both of those things changed now? See conversation here: https://github.com/ipfs/js-ipfs/pull/2004#issuecomment-486208248

achingbrain commented 5 years ago

Yes - it's all async iterators now and has resolvers for common types - we can always add more.

dirkmc commented 5 years ago

Great 🎉

whizzzkid commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can follow the migration plan here https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

This issue has been resolved in Helia! if this does not address your concern please let us know by reopening this issue before 2023-06-05!