-
Notifications
You must be signed in to change notification settings - Fork 20
Conversation
@diasdavid to support your last point (resolving from non-pb nodes), I had to implement a resolver for "unknown" file types. Could you please take a look at https://github.com/ipfs/js-ipfs-unixfs-engine/blob/b446b0d219f902173c0ef389392a7e95c0fa1b59/src/exporter/unknown.js and see if there would be a better way of doing this? |
@pgte what is the logical difference between:
In terms of resolving? It should agnostically use the IPLD Resolver to traverse to the file and export it, correct? Can you also make sure with tests the expected behaviour in js-ipfs is respected, namely: (it might be already, I haven't checked) |
@diasdavid the problem I found by trying to use the I was hoping that the IPLD resolver would quit at the time it entered UnixFS territory and just return me the remainder path, but that hasn't happened.. Bug or am I using this wrong? |
@diasdavid for your reference, here is the test I'm running: |
Having said that, with the exception of sharded dirs (where the link names do not correspond to dir entries), it should map pretty well though.. Any thoughts? |
Got it! Yeah, that is definitely the issue, it doesn't speak UnixFS so that paths don't map directly. Makes sense to have that unknown exporter. Could use a better name then, subTreeExporter?
Now I'm unclear, you already got support for shared dirs, right? Using the UnknownExporter Did you verify if you reproduce exactly the above with js-ipfs now? |
@diasdavid paths into shared dirs is supported in this branch, but in theory, not natively by resolving through IPLD (because the link names are prefixed with the shard bucket number). |
@diasdavid regarding the IPLD resolver not being able to resolve up until the file protobuf, I think we can live with it for now, since I'm resolving "by hand". I'll open an issue to solve this later. |
@diasdavid other than that, I think this feature is ready to be merged. |
That's the desired behavior What about #175 (comment), did you npm link in js-ipfs and checked? |
@pgte exactly, not the different between #175 (comment) and #175 (comment). go-ipfs doesn't preserve the whole path when fetching a subtree, just the file name. |
@diasdavid subtree path preserved, just like in go, given by 8dcdac6. |
awesome! :D |
export('/ipfs/QmHash', ipldResolver)
export('/ipfs/QmHash/a', ipldResolver)
export('/ipfs/QmHash/b.txt', ipldResolver)
export('/ipfs/QmHash/a/b/c.txt', ipldResolver)
export('QmHash/a/b/c.txt', ipldResolver)
export('QmHash/a/b/c.txt', ipldResolver)