Closed achingbrain closed 4 years ago
The CI failure is real, though you could also use https://github.com/Gozala/web-encoding/ instead of ipfs-utils.
you could also use Gozala/web-encoding instead of ipfs-utils.
I will if using ipfs-utils
would prevent this from getting merged, but ipfs-utils
already has the TextEncoder browser/node polyfill in it so it seems redundant.
Plus once https://github.com/ipfs/js-ipfs-utils/pull/55 is merged I can remove some of the duplicated utility functions here.
I will if using
ipfs-utils
would prevent this from getting merged, butipfs-utils
already has the TextEncoder browser/node polyfill in it so it seems redundant.Plus once ipfs/js-ipfs-utils#55 is merged I can remove some of the duplicated utility functions here.
For what it's worth we have discussed option of using ipfs-utils
vs creating a web-encodings
library and chose later to avoid pulling all the extra stuff that api-utils
has. I'm fine with either option.
I've pulled out ipfs-utils
in favour of uint8arrays
which uses web-encoding
internally.
@mikeal @rvagg I'd really like to have your approval on that change. Once merged I want to release this as 1.0.0.
So, +1 in general, great to see this happening.
One concern I have taking a breaking change is just wasting the opportunity to do a bit more. Knowing that we have a more substantial CID change coming in the future it would be great to get some code into this change that will make that transition a bit easier.
For instance, we could add the .code
property to CID
and we could allow for instantiation using integers for the codec rather than just strings. This would allow people to migrate to using these newer forms even with the old API and should make the future transition to js-multiformats
a bit easier.
Basically, we know that we need to move to using integers rather than strings for codec identifiers, it would be nice if we had a transitional release that accepted both so people could upgrade gradually or at least have the opportunity to do some of that migration when they migrate off of Buffer.
One concern I have taking a breaking change is just wasting the opportunity to do a bit more
I can see the temptation but I really think to deliver this change in a reasonable timeframe we should limit the scope to what's currently in this PR.
For what it's worth I would also like to slot in asCID
into 1.0. That said, I do not think we should block this pull request on other things we want in 1.0. We should instead consider having a meeting to make some decision about how to best roll out all the breaking changes.
Relaxes input from requiring node
Buffer
s to beingUint8Arrays
.This also means that the
.buffer
(now.byte
) and.prefix
properties have changed to beUint8Array
s.Depends on:
BREAKING CHANGES:
Buffer
s have been replaced withUint8Array
s.buffer
property has been renamed to.bytes
and is now aUint8Array
.prefix
property is now aUint8Array