# File

This plugin implements a File API allowing read/write access to files residing on the device.

The File class implements static convenience functions to access files and directories.

Example:

```
import { File } from '@awesome-cordova-plugins/file/ngx';

constructor(private file: File) { }

...

this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err =>
  console.log('Directory doesn't exist'));

```

This plugin is based on several specs, including : The HTML5 File API http: //[www.w3.org/TR/FileAPI/](http://www.w3.org/TR/FileAPI/) The (now-defunct) Directories and System extensions Latest: http: //[www.w3.org/TR/2012/WD-file-system-api-20120417/](http://www.w3.org/TR/2012/WD-file-system-api-20120417/) Although most of the plugin code was written when an earlier spec was current: http: //[www.w3.org/TR/2011/WD-file-system-api-20110419/](http://www.w3.org/TR/2011/WD-file-system-api-20110419/) It also implements the FileWriter spec : http: //dev.w3.org/2009/dap/file-system/file-writer.html

## Installation

```bash
ionic cordova plugin add cordova-plugin-file
npm install @awesome-cordova-plugins/file
```

**Plugin Repo:** <https://github.com/apache/cordova-plugin-file>

## Supported Platforms

* Android
* Browser
* iOS
* macOS
* Windows

## Further Information

* [Installation Guide](/awesome-cordova-plugins/installation.md)
* [FAQ](/awesome-cordova-plugins/faq.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/plugins/file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
