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
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Right now we accept cid, multihash and data as Buffer in various places across entire JS API. It makes sense for Node.js and there was no better alternative for use in browsers at a time.
The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer. You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer.
Proposed API Improvement
Short and sweet:
Add support for ArrayBuffer as input in every API that accepts Buffer right now.
Why?
Low risk, High win:
This is backward-compatible change (Buffer support remains)
Should be a relatively small change (internally detect and convert ArrayBuffer to Buffer for now)
DRY: removes the need of tedious type conversion of various inputs
enables browser console experimentation without need for Buffer polyfil
Together with Async Iterators makes JS API feel modern an more attractive to developers