Writes a sequence of bytes (as a Uint8Array) to a DataView at the specified offset.
Uint8Array
DataView
Each byte in the array is written in sequence, starting from the given offset.
The new offset after writing the bytes.
const buffer = new ArrayBuffer(10);const view = new DataView(buffer);let offset = 0;offset = writeBytes(view, offset, new Uint8Array([1, 2, 3, 4]));console.log(new Uint8Array(buffer)); // Logs: Uint8Array [1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
The DataView instance where the bytes will be written.
The offset (in bytes) at which to start writing.
The Uint8Array containing the bytes to write.
Generated using TypeDoc
Writes a sequence of bytes (as a
Uint8Array
) to aDataView
at the specified offset.Each byte in the array is written in sequence, starting from the given offset.
Returns
The new offset after writing the bytes.
Example