Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Guides · Binary Data

Convert a Uint8Array to a DataView

Create a DataView over the same bytes as a Uint8Array using its buffer, byteOffset and byteLength.

A Uint8Array is a typed array, a view over data in an underlying ArrayBuffer. To convert it to a DataView, create one over the same range of data.

const arr: Uint8Array = ...
const dv = new DataView(arr.buffer, arr.byteOffset, arr.byteLength);

See Binary Data.