Function writeBytes

  • Writes a sequence of bytes (as a Uint8Array) to a DataView 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

    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]

    Parameters

    • view: DataView

      The DataView instance where the bytes will be written.

    • offset: number

      The offset (in bytes) at which to start writing.

    • value: Uint8Array

      The Uint8Array containing the bytes to write.

    Returns number

Generated using TypeDoc