package brr

  1. Overview
  2. Docs
On This Page
  1. Files
Legend:
Library
Module
Module type
Parameter
Class
Class type

File objects and reads.

There are various ways to get File.t values. On of them is to create an El.input element of type file and use the El.Input.files function. Another way is to use drag and drop events and get them via the Ev.Data_transfer values.

Files

type init

The type for file initialisation objects.

val init : ?blob_init:Blob.init -> ?last_modified_ms:int -> unit -> init

init () is a file initialisation object with the given properties.

type t

The type for File objects.

val of_blob : ?init:init -> Jstr.t -> Blob.t -> t

of_blob name b is a file named name with data b.

Note. Reading the constructor specificaton it seems this will not look into b to define the Blob.type' of the resulting file object's blob. You should define it via the init object.

val name : t -> Jstr.t

name f is the filename of f.

val relative_path : t -> Jstr.t

relative_path is the webkitRelativePath of f.

val last_modified_ms : t -> int

last_modified_ms f is the last modified time in milliseconds since the POSIX epoch.

val as_blob : t -> Blob.t

as_blob f is f's Blob interface.

OCaml

Innovation. Community. Security.