# File Plugin for Ionic 2

**URL:** <https://forum.ionicframework.com/t/file-plugin-for-ionic-2/78170>\
**Category:** ionic-v3\
**Created:** [February 2, 2017, 11:55am UTC](https://forum.ionicframework.com/t/file-plugin-for-ionic-2/78170 "2017-02-02T11:55:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljacobv](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pauljacobv](https://forum.ionicframework.com/u/pauljacobv)\
**Post date:** [February 2, 2017, 11:55am UTC](https://forum.ionicframework.com/t/file-plugin-for-ionic-2/78170/1 "2017-02-02T11:55:33Z")

</div>

HI All 🙂

I was trying to develop a windows 10 application for windows 10 mobiles using Ionic 2, I have a scenario for offline data storage, I tried the [sqlite plugin](https://ionicframework.com/docs/v2/native/sqlite/) but it was in vain and finally my thoughts end up to use files to store the data using [file plugin](http://ionicframework.com/docs/v2/native/file/) sadly this plugin returns me this JavaScript run time error: Unable to get property ‘applicationDirectory’ of undefined or null reference. Can someone provide me a working example or any suggestions to solve this issue.

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![mark2k](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mark2k/32/120573_2.png) [@mark2k](https://forum.ionicframework.com/u/mark2k)\
**Post date:** [February 2, 2017, 1:15pm UTC](https://forum.ionicframework.com/t/file-plugin-for-ionic-2/78170/2 "2017-02-02T13:15:43Z")

</div>

Can you share that portion of your code?

However, if you check the [file plugin github doc](https://github.com/apache/cordova-plugin-file) in the where to store files section you find out that some methods are not supported on windows.

---

<div class="post-metadata">

**Author:** ![pauljacobv](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pauljacobv](https://forum.ionicframework.com/u/pauljacobv)\
**Post date:** [February 3, 2017, 5:36am UTC](https://forum.ionicframework.com/t/file-plugin-for-ionic-2/78170/3 "2017-02-03T05:36:09Z")

</div>

Hi @mark2k 🙂

this is the code snippet that i am working on. its taken from the [native file plugin page.](https://ionicframework.com/docs/v2/native/file/)

```
import { Component } from '@angular/core';

import { NavController } from 'ionic-angular';

import { File } from 'ionic-native';

declare var cordova: any;

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  fs: string = cordova.file.dataDirectory;

  constructor(public navCtrl: NavController) {

    File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
  }

}
```
