ipfs-inactive / js-ipfs-unixfs-exporter

[ARCHIVED] JavaScript implementation of the UnixFs exporter used by IPFS
MIT License
2 stars 3 forks source link

refactor: export CID instances not strings or buffers #19

Closed alanshaw closed 5 years ago

alanshaw commented 5 years ago

This PR updates the exporter to remove the hash property and replace it with a cid property in yielded objects.

I actually ended up doing this because there's a bug in the "raw" resolver - the objects it yields have a "hash" property not a "multihash" property like file, object and dir. This was causing problems with the CIDv1 base32 work where v1 forces raw leaves and we start using that raw resolver which obviously then gives us back undefined when accessing the "multihash" prop. That file probably needs more/better tests. EDIT: added a test

The upshot is that I solve that issue, as well as make progress towards https://github.com/ipfs/interface-js-ipfs-core/issues/394 and hopefully make some performance gains by not having to do so much conversion between string/buffer/CID. Hooray!