1

i am trying to get image from usb biometric fingerprint reader device using webusb api. The data returned from device is a DataView() (typed array? arraybuffer?). i google it, and can not find a way to convert/extract image from this dataview object. is it black hole for javascript? I would appreciate any ideas.

logged returned data:

DataView(512)
    ArrayBuffer(512)
      [[Int8Array]]: Int8Array(512) [19, 1, …]
      [[Int16Array]]: Int16Array(256) [275, 310, …]
      [[Int32Array]]: Int32Array(128) [20316435, 22806905, …]
      [[Uint8Array]]: Uint8Array(512) [19, 1, ..]

1 Answer 1

1

The result is returned as a DataView for convenience, if you need it as an ArrayBuffer just access the buffer property. From an ArrayBuffer you can construct another kind of Typed Array or if you want to treat the data as an image turn it into a data URL for use in an tag.

Sign up to request clarification or add additional context in comments.

1 Comment

i tagged webusb for future searches. i tried data URL. i have four nested arrays, they convert only Uint8Array(). as promised, thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.