On this pageFunctions
File
/** The file's MIME type (e.g. `"application/pdf"`), or empty string if the browser cannot determine one. */
(file: File): string/**
* Reads the file's contents as raw binary data. Mirrors Elm's `File.toBytes`.
*
* Use this when you need the full binary payload (e.g. to upload, hash, or
* parse a custom file format). For images you usually want `readAsDataUrl`
* instead.
*/
(file: File): Effect<ArrayBuffer, FileReadError>/**
* Reads the file's contents as a base64-encoded data URL. Useful for rendering
* image previews without uploading the file first. Mirrors Elm's `File.toUrl`.
*/
(file: File): Effect<string, FileReadError>/**
* Reads the file's contents as a UTF-8 string. Mirrors Elm's `File.toString`.
*
* Fails with a `FileReadError` if the browser's `FileReader` encounters an
* error (e.g. the file was deleted while reading). Handle failures with
* `Effect.catchAll` to convert them into a failure Message.
*/
(file: File): Effect<string, FileReadError>/**
* Opens the native file picker allowing a single file to be selected. Resolves
* with an array containing the selected file, or an empty array if the user
* cancelled. Mirrors Elm's `File.Select.file`.
*
* The `accept` argument is a list of MIME types or file extensions that
* restrict what the picker shows. Pass an empty array to allow any file.
*/
(accept: readonly Array<string>): Effect<readonly Array<File>>/**
* Opens the native file picker allowing multiple files to be selected at
* once. Resolves with the array of selected files, or an empty array if the
* user cancelled. Mirrors Elm's `File.Select.files`.
*/
(accept: readonly Array<string>): Effect<readonly Array<File>>/**
* A file selected by the user. Direct alias for the browser's native `File`
* type — opaque by convention (Foldkit never constructs files itself, only
* receives them from `File.select`, `File.selectMultiple`, or from
* `OnFileChange`/`OnDropFiles` event attributes).
*/
type File = globalThis.File