Js-ipfs: .cat subfiles

Created on 12 Sep 2016  路  8Comments  路  Source: ipfs/js-ipfs

From #476, cannot .cat files that lives inside directories, example:

node src/cli/bin.js files cat /ipfs/QmegvLXxpVKiZ4b57Xs1syfBVRd8CbucVHAp7KpLQdGieC/readme

Shows no output

kinbug

Most helpful comment

I would suggest doing the same thing as go-ipfs, i.e. implementing a core function resolve, which when given an ipfs path, returns the hash of that path.
Under the hood this would use https://github.com/ipfs/go-ipfs/blob/master/path/resolver.go to resolve through.

All 8 comments

@dignifiedquire @diasdavid would a valid approach be to first check if the path contains a subfile, and if so, do .ls and grab the hash for the file and pass that to the dag-service within core.cat?

I would suggest doing the same thing as go-ipfs, i.e. implementing a core function resolve, which when given an ipfs path, returns the hash of that path.
Under the hood this would use https://github.com/ipfs/go-ipfs/blob/master/path/resolver.go to resolve through.

This will also make it easy to add CIDs to the resolution everywhere + ipns once we add it.

@VictorBjelkholm it might be good to have that resolver in its own module, so that given an source of merkle-dag nodes, it can resolve anything

How is this one going?

@diasdavid I remember it was mentioned that this was only written (the resolve) but I cannot find out where to integrate it, any ideas?

You get the resolve from IPLD resolver, but you also have to integrate it on unixfs-engine, a IPLD Path only goes to the "root dag node of the file", then you have to fetch the leafs

adding this one to be tracked on https://github.com/ipfs/js-ipfs/issues/60

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daviddias picture daviddias  路  3Comments

daviddias picture daviddias  路  3Comments

npfoss picture npfoss  路  3Comments

pedrouid picture pedrouid  路  3Comments

dryajov picture dryajov  路  3Comments