Closed vmx closed 4 years ago
FWIW, I vastly prefer the DX of using strings rather than numbers.
@achingbrain From the DX it's is string vs. constants.
Yes, but the constants are numbers, which opens the door to new CID(1, 7, mh)
as @alanshaw points out.
which opens the door to
new CID(1, 7, mh)
Which is the whole point in order to make custom IPLD Formats easier to add (writing down why I want this is on my TODO list).
This effort is superseded by https://github.com/multiformats/js-multiformats, which does exactly that. Thanks @mikeal for picking up that idea.
The codec used to be defined as string. Now you can use the numbers as defined per multicodec constants. The codec is stored in a field called
code
.Ideally we would store it in
codec
, but for backwards compatibility reasons that one will still return the name of the codec as a string.New code should use
code
instead ofcodec
to check for the codec a CID is using.This change needs https://github.com/multiformats/js-multicodec/pull/35 to be merged first.