ipfs / js-ipfs

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

Missing function in ipfs-core that is in kubo: Getting a list of child blocks that make up a cid #4300

Closed AwesomeKalin closed 1 year ago

AwesomeKalin commented 1 year ago

Severity:

Low-Medium (Depends on what you are doing)

Description:

In my code, I need to get all the child blocks of a file. However, ipfs-core doe not contain the functionality necessary to get the blocks that make up a cid. In kubo, there is ipfs ls which will get all the blocks that make up a cid, but no ipfs-core

Steps to reproduce the error:

N/A

welcome[bot] commented 1 year ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

achingbrain commented 1 year ago

js-IPFS is in the process of being deprecated, the replacement is Helia - please see the State of IPFS in JS post for a bit of background and the migration guide for how to port your app over.

To list all the CIDs in a block, see dagPbWalker. You will need to call helia.blockstore.get with each yielded CID and recursively invoke the DAG walker until you've traversed the entire graph.