You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed this while testing with the ipfs block api in node. Buffer extends Uint8Array which is great, but it seems to override some of the characteristics of Uint8Array.
The text was updated successfully, but these errors were encountered:
mm, I tend to not mind and just deal with them as if they are Uint8Array and in almost all cases it doesn't matter either way (except when you're optimising for perf .. where it matters quite a bit!). The contract says you should expect a Uint8Array, which is true, but proper is certainly is a worthy goal here, especially since these APIs can be implemented by a wide variety of implementations.
Would you like to submit a PR to address this? We can just extract the underlying .buffer and use that and not suffer a copy penalty.
this line in the Block constructor seems like the best place to add it. i'm feeling wishy/washy, it might be good to make this change if ipfs ever starts only returning Uint8Array. if js-ipfs doesnt use Buffer instance methods currently (not sure if it does or not); why not return Uint8Array everywhere?
rvagg
added
the
P2
Medium: Good to have, but can wait until someone steps up
label
Nov 29, 2022
Would like to know if this is the desired behavior:
Noticed this while testing with the ipfs block api in node. Buffer extends Uint8Array which is great, but it seems to override some of the characteristics of Uint8Array.
The text was updated successfully, but these errors were encountered: