Module Brr.Blob
Blob objects.
See the Blob Interface.
Enumerations
module Ending_type : sig ... endThe line ending type enum.
Blobs
val init :
?type':Jstr.t ->
?endings:Brr.Blob.Ending_type.t ->
unit ->
Brr.Blob.initinit () is a blob initialisation object with given properties.
The type for Blob objects.
val of_jstr : ?init:Brr.Blob.init -> Jstr.t -> Brr.Blob.tof_jstr ~init s is a blob containing the UTF-8 encoded data of s.
val of_array_buffer : ?init:Brr.Blob.init -> Brr.Tarray.Buffer.t -> Brr.Blob.tof_array_buffer ~init b is a blob containing the bytes of b.
val byte_length : Brr.Blob.t -> intbyte_length b is the byte length of the blob.
val type' : Brr.Blob.t -> Jstr.ttype' b is the MIME type of b or Jstr.empty if unknown.
val slice :
?start:int ->
?stop:int ->
?type':Jstr.t ->
Brr.Blob.t ->
Brr.Blob.tslice ~start ~stop ~type b are the bytes in range [start;stop-1] as blob. 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 blob.
type' specifies the resulting type for the blob, defaults to the empty string.
Loading
The type for loading progress callbacks.
If the length is computable the function is periodically called with Some (loaded, total) which are respectively the loaded and total fields of the progress event. If the length is not computable it is called with None.
val array_buffer :
?progress:Brr.Blob.progress ->
Brr.Blob.t ->
Brr.Tarray.Buffer.t Fut.or_errorarray_buffer b is an array buffer with the contents of b. If progress is specified, the given callback reports it (in this case the load happens via a FileReader object).
val stream : Brr.Blob.t -> Jv.tstream b is a stream to read the contents of b.
val text : ?progress:Brr.Blob.progress -> Brr.Blob.t -> Jstr.t Fut.or_errortext b is the string that results from UTF-8 decoding the contents of b. If progress is specified, the given callback reports it (in this case the load happens via a FileReader object).
val data_uri : ?progress:Brr.Blob.progress -> Brr.Blob.t -> Jstr.t Fut.or_errordata_uri b is b as a data URI. If progress is specified, the given callback reports it. This function always goes through FileReader object.
val to_jv : Brr.Blob.t -> Jv.jvval of_jv : Jv.jv -> Brr.Blob.t