Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Allow passing Uint8Array data #52

Closed
Gozala opened this issue Jun 11, 2020 · 2 comments
Closed

Allow passing Uint8Array data #52

Gozala opened this issue Jun 11, 2020 · 2 comments

Comments

@Gozala
Copy link
Contributor

Gozala commented Jun 11, 2020

At the moment passing a block Uint8Array throws an exception

class Block {
constructor (data, cid) {
if (!data || !Buffer.isBuffer(data)) {
throw new Error('first argument must be a buffer')
}

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
Copy link
Member

vmx commented Jun 12, 2020

Fixed by #53.

@hugomrdias
Copy link
Member

should this be closed ?

@vmx vmx closed this as completed Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants