# @mymonero/capacitor-file-picker

> This plugin presents the native UI for picking a file.

Latest version **3.0.0** (published 2022-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mymonero/capacitor-file-picker
pnpm add @mymonero/capacitor-file-picker
yarn add @mymonero/capacitor-file-picker
bun add @mymonero/capacitor-file-picker
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2022-12-22 |
| First published | 2022-04-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 493.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jose Martinez |
| Maintainers | amilumibe, tekkzbadger, karlbuys |
| Keywords | capacitor, plugin, native |

## Links

- npm: https://www.npmjs.com/package/@mymonero/capacitor-file-picker
- Repository: https://github.com/mymonero-utils
- Issues: https://github.com/mymonero-utils
- npm.io page: https://npm.io/package/@mymonero/capacitor-file-picker

## Dependencies (1)

- [@capacitor/core](https://npm.io/package/@capacitor/core.md) ^3.0.2

## Recent versions

- 3.0.0 (latest) — 2022-12-22
- 2.1.33 — 2022-11-29
- 2.1.32 — 2022-10-28
- 2.1.29 — 2022-10-28
- 2.1.27 — 2022-09-30
- 2.2.0-alpha.0 — 2022-09-28
- 2.1.26 — 2022-09-13
- 2.1.25 — 2022-09-12
- 2.1.24 — 2022-09-12
- 2.1.23 — 2022-09-07
- 2.1.22 — 2022-09-07
- 2.1.21 — 2022-09-07
- 2.1.20 — 2022-09-02
- 2.1.19 — 2022-08-26
- 2.1.14 — 2022-08-10
- … 11 more at https://npm.io/package/@mymonero/capacitor-file-picker/versions

## README

# Capacitor File Picker (forked from https://github.com/epicshaggy/capacitor-file-picker)

## Important

This fork exists as a stopgap to address an issue with the plugin not working correctly with MyMonero's specified versions of various Java packages. A PR will be submitted to the original maintainer, and this package will be removed if/when the original author accepts the PR. We do not suggest relying on this package at any stage.

The original README content is preserved below

## Description

Presents the device's native file picking ui and returns the selected file's uri.

## Installation

### Capacitor 2

Not supported

### Capacitor 3

- `npm i @mymonero/capacitor-file-picker`

## Usage

```ts
import { Plugins } from "@capacitor/core";

const { FilePicker } = Plugins;

FilePicker.showFilePicker({
  fileTypes: ["image/*", "application/pdf"],
}).then(
  (fileResult: FilePickerResult) => {
    const fileUri = fileResult.uri;
    const fileName = fileResult.name;
    const fileMimeType = fileResult.mimeType;
    const fileExtension = fileResult.extension;
  },
  (error) => {
    console.log(error);
  }
);
```

## Methods

| Method                                         | Default | Type                        | Description                                                                       |
| ---------------------------------------------- | ------- | --------------------------- | --------------------------------------------------------------------------------- |
| showFilePicker(options: {fileTypes: string[]}) |         | `Promise<FilePickerResult>` | Presents the device's native file picking ui and returns the selected file's uri. |

## Interfaces

FilePickerResult

| Properties | Default | Type     | Description                               |
| ---------- | ------- | -------- | ----------------------------------------- |
| uri        |         | `string` | Uri string pointing to the selected file. |
| name       |         | `string` | The name of the selected file.            |
| mimeType   |         | `string` | The MIME type of the selected file.       |
| extension  |         | `string` | The extension of the selected file.       |

## Android

Register the plugin by adding it to your MainActivity's onCreate:

```java
import com.epicshaggy.filepicker.FilePicker;

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(FilePicker.class);
    }});
  }
}
```

## Notes

The file picker only accpets:

- application/pdf
- image/\*

This is because it was developed to meet the need to meet a specific need, but feel free to contribute to the plugin's development. :)

---
_Source: https://npm.io/package/@mymonero/capacitor-file-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
