Js.Blob
Bindings to Blob
type t = Js.blob;
type options = {
type_: option(string),
A string representing the MIME type of the content that will be put into the file. Defaults to a value of "".
*/endings: option([ `transparent | `native ]),
How to interpret newline characters (\n) within the contents, if the data is text. The default value, transparent, copies newline characters into the blob without changing them. To convert newlines to the host system's native convention, specify the value native.
*/};
let options:
?type_:string =>
?endings:[ `transparent | `native ] =>
unit =>
options;
let make: Js.iterator(string) => ?options:options => unit => t;
make (Js.Array.values contents_array)
creates a new file from an iterable object such as an Array, having ArrayBuffers, TypedArrays, DataViews, Blobs, strings, or a mix of any of such elements, that will be put inside the File. Note that strings here are encoded as UTF-8, unlike the usual JavaScript UTF-16 strings.
let size: t => float;
size t
returns the size of the Blob in bytes
let type_: t => string;
type_ t
returns the MIME type of the file.
let arrayBuffer: t => Js.promise(Js.arrayBuffer);
arrayBuffer t
returns a Promise that resolves with the contents of the blob as binary data contained in a Js.arrayBuffer
.
let bytes: t => Js.promise(Js.uint8Array);
bytes t
returns a Promise that resolves with a Js.uint8Array
containing the contents of the blob as an array of bytes.
slice ?start ?end_ ?contentType t
creates and returns a new Blob object which contains data from a subset of the blob on which it's called.
let text: t => Js.promise(string);
text t
returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.