1 | <a style="float:right;font-size:12px;" href="http://github.com/ionic-team/ionic-native/edit/master/src/@ionic-native/plugins/file/index.ts#L634">
|
2 | Improve this doc
|
3 | </a>
|
4 |
|
5 | # File
|
6 |
|
7 | ```
|
8 | $ ionic cordova plugin add cordova-plugin-file
|
9 | $ npm install @ionic-native/file
|
10 | ```
|
11 |
|
12 | ## [Usage Documentation](https://ionicframework.com/docs/native/file/)
|
13 |
|
14 | Plugin Repo: [https://github.com/apache/cordova-plugin-file](https://github.com/apache/cordova-plugin-file)
|
15 |
|
16 | This plugin implements a File API allowing read/write access to files residing on the device.
|
17 |
|
18 | The File class implements static convenience functions to access files and directories.
|
19 |
|
20 | Example:
|
21 | ```
|
22 | import { File } from '@ionic-native/file/ngx';
|
23 |
|
24 | constructor(private file: File) { }
|
25 |
|
26 | ...
|
27 |
|
28 | this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err =>
|
29 | console.log('Directory doesn't exist'));
|
30 |
|
31 | ```
|
32 |
|
33 | This plugin is based on several specs, including : The HTML5 File API http: //www.w3.org/TR/FileAPI/
|
34 | The (now-defunct) Directories and System extensions Latest: http: //www.w3.org/TR/2012/WD-file-system-api-20120417/
|
35 | Although most of the plugin code was written when an earlier spec was current: http:
|
36 | //www.w3.org/TR/2011/WD-file-system-api-20110419/ It also implements the FileWriter spec : http:
|
37 | //dev.w3.org/2009/dap/file-system/file-writer.html
|
38 |
|
39 | ## Supported platforms
|
40 |
|
41 | - Android
|
42 | - Browser
|
43 | - iOS
|
44 | - macOS
|
45 | - Windows
|
46 |
|
47 |
|
48 |
|