Module Tarray.Buffer

ArrayBuffer objects (byte buffers).

type t

The type for ArrayBuffer objects. They hold the bytes of typed arrays.

val create : int -> t

create n is a new buffer with n bytes.

val byte_length : t -> int

byte_length b is the byte length of b.

val slice : ?⁠start:int -> ?⁠stop:int -> t -> t

slice ~start ~stop b is a new buffer holding the bytes of b in range [start;stop-1]. This is a copy. start defaults to 0 and stop to byte_length b.

If start or stop are negative they are subtracted from byte_length b. This means that -1 denotes the last byte of the buffer.