# cordova-plugin-afile

> A Cordova plugin to read a file as text using a URI

Latest version **0.0.4** (published 2023-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-afile
pnpm add cordova-plugin-afile
yarn add cordova-plugin-afile
bun add cordova-plugin-afile
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-06-08 |
| First published | 2023-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 1 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | SmallBlueE@PPP |
| Maintainers | bluee |
| Keywords | cordova, android, file, read, text |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-afile
- Repository: https://github.com/SmallBlueE/CordovaPluginAfile
- Homepage: https://github.com/SmallBlueE/CordovaPluginAfile#readme
- Issues: https://github.com/SmallBlueE/CordovaPluginAfile/issues
- npm.io page: https://npm.io/package/cordova-plugin-afile

## Dependencies (1)

- [cordova](https://npm.io/package/cordova.md) ^10.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2023-06-08
- 0.0.3 — 2023-06-08
- 0.0.2 — 2023-06-08
- 0.0.1 — 2023-06-08

## README

# Cordova Plugin: Read Text File via Android Intent

This Cordova plugin is designed to read text files through Android Intents, supporting Android SDK 31.
## Installation

cordova plugin add cordova-plugin-afile



## Usage

You can use this plugin in your Cordova project by following the example below:

```javascript
window.plugins.intentShim.getIntent(function(intent) {
    // Log the intent object
    console.log(intent);

    // Extract the content URI from the intent
    let contentUri = intent.data;
    console.log(contentUri);

    // Use the plugin to read text from the URI
    window.CordovaPluginAFile.readTextFromUri(contentUri, 
        function(data) {
            // Success callback: log the read data
            console.log(data);
        }, 
        function(err) {
            // Error callback: log the error message
            console.log(err);
        }
    );
}, function() {
    // Failure callback for getting the intent
    console.log('Failed to get the intent');
});
```

This code retrieves the current intent using `window.plugins.intentShim.getIntent()`, extracts the content URI from the intent, and then uses the `window.CordovaPluginAFile.readTextFromUri()` method to read the text from the file located at the URI. The read data is then logged to the console.

## Support

This plugin is tested and confirmed to work under Android SDK 31. Please ensure your project meets this requirement.

## Troubleshooting

If you encounter any issues while using this plugin, please check the logged error messages for clues about what might be going wrong. If you're unable to resolve the issue, please consider opening an issue on the plugin's GitHub page.

---
_Source: https://npm.io/package/cordova-plugin-afile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
