FileOpener
Asks the person to choose a file and reads it as text. Nothing is
uploaded: the file is read in the browser and given only to the caller.
Rejects only with a FileOpenError.
This is an interface exported by @mapcairn/core, checked against version 0.2.0.
Signature
import type { FileOpener } from "@mapcairn/core";
interface FileOpener
Methods
open
open(options: FileOpenOptions): Promise<OpenedFile>;
Shows a file picker and resolves with the file the person chose. It rejects with a FileOpenError when none is read.
options(FileOpenOptions)
Remarks
Call open straight from the handler of the press that asked
for it, before any await, or a browser may refuse to show the picker.
A second open while one is waiting settles the first as cancelled.