# 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

```ts
import type { FileOpener } from "@mapcairn/core";
 
interface FileOpener
```

## Methods

### open

```ts
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`.

## See also

- [`FileOpenOptions`](https://docs.mapcairn.com/api/core/FileOpenOptions.md)
- [`OpenedFile`](https://docs.mapcairn.com/api/core/OpenedFile.md)

Source: [packages/core/src/ports/files.ts:59](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/ports/files.ts#L59)
