Module Brr.Blob
Blob objects.
See the Blob Interface.
Enumerations
module Ending_type : sig ... end
The line ending type enum.
Blobs
val init : ?type':Jstr.t -> ?endings:Ending_type.t -> unit -> init
init ()
is a blob initialisation object with given properties.
type t
The type for
Blob
objects.
val of_jstr : ?init:init -> Jstr.t -> t
of_jstr ~init s
is a blob containing the UTF-8 encoded data ofs
.
val of_array_buffer : ?init:init -> Tarray.Buffer.t -> t
of_array_buffer ~init b
is a blob containing the bytes ofb
.
val byte_length : t -> int
byte_length b
is the byte length of the blob.
val type' : t -> Jstr.t
type' b
is the MIME type ofb
orJstr.empty
if unknown.
val slice : ?start:int -> ?stop:int -> ?type':Jstr.t -> t -> t
slice ~start ~stop ~type b
are the bytes in range [start
;stop-1
] as blob.start
defaults to0
andstop
tobyte_length b
.If
start
orstop
are negative they are subtracted frombyte_length b
. This means that-1
denotes the last byte of the blob.type'
specifies the resulting type for the blob, defaults to the empty string.
val array_buffer : t -> Tarray.Buffer.t Fut.or_error
array_buffer b
is an array buffer with the contents ofb
.
val text : t -> Jstr.t Fut.or_error
text b
is the string that results from UTF-8 decoding the contents ofb
.
val data_uri : t -> Jstr.t Fut.or_error
data_uri b
isb
as a data URI (via theFileReader
API).