ipld / js-ipld-block

Implementation of the Block data structure in JavaScript.
MIT License
13 stars 16 forks source link

Allow passing Uint8Array data #52

Closed Gozala closed 3 years ago

Gozala commented 4 years ago

At the moment passing a block Uint8Array throws an exception

https://github.com/ipld/js-ipld-block/blob/7059cc8370e44cc9d9bc4ed73b3836acf38b0a05/src/index.js#L17-L21

I would like to propose a change that recognizes Uint8Array and if it is passed instead of throwing it creates a Buffer view for the same underlying ArrayBuffer

vmx commented 4 years ago

Fixed by https://github.com/ipld/js-ipld-block/pull/53.

hugomrdias commented 3 years ago

should this be closed ?