Ionic File.dataDirectory

hello i’m trying to use the File from ionic-native, but when i try the example on the docs the console give me this error.

Typescript Error
Property ‘dataDirectory’ does not exist on type ‘typeof File’.

Any help is appreciated!

1 Like

Are you using ionic-native v3, by chance?

not, is ionic-native 2.4.1…

File.dataDirectory no funciona en ionic-native 2.4.1.

La solución fue declarar globalmente la variable cordova:

import { File, Transfer } from “ionic-native”;

declare var cordova: any;

@Component({

y luego:


cordova.file.dataDirectory;

hola, funciono!

muchas gracias.

I would recommend upgrading to 2.8.1.

thanks, now it works like the example in the docs.

could you explain clearly in this part

@Component({

y luego:


cordova.file.dataDirectory;

cordova is not defined issue? do you hava any idea? I followed the @williamdelvalle suggestions

Don’t. If they were ever relevant, they definitely aren’t now.