feat(file): add system paths

This commit is contained in:
Ibby 2017-03-01 20:26:55 -05:00
parent 97cf22eedb
commit f0e219570e

View File

@ -1,4 +1,4 @@
import { Plugin, pluginWarn } from './plugin';
import {CordovaProperty, Plugin, pluginWarn} from './plugin';
declare var window: any;
declare var cordova: any;
@ -350,9 +350,9 @@ export declare var FileError: {
* ```
* import { File } from 'ionic-native';
*
* declare var cordova: any;
* const fs:string = cordova.file.dataDirectory;
* File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
* const dataDirectory: string = File.dataDirectory;
*
* File.checkDir(dataDirectory, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
* ```
*
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
@ -367,6 +367,80 @@ export declare var FileError: {
repo: 'https://github.com/apache/cordova-plugin-file'
})
export class File {
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationDirectory: string;
/**
* Read-only directory where the application is installed.
*/
@CordovaProperty
static applicationStorageDirectory: string;
/**
* Where to put app-specific data files.
*/
@CordovaProperty
static dataDirectory: string;
/**
* Cached files that should survive app restarts.
* Apps should not rely on the OS to delete files in here.
*/
@CordovaProperty
static cacheDirectory: string;
/**
* Android: the application space on external storage.
*/
@CordovaProperty
static externalApplicationStorageDirectory: string;
/**
* Android: Where to put app-specific data files on external storage.
*/
@CordovaProperty
static externalDataDirectory: string;
/**
* Android: the application cache on external storage.
*/
@CordovaProperty
static externalCacheDirectory: string;
/**
* Android: the external storage (SD card) root.
*/
@CordovaProperty
static externalRootDirectory: string;
/**
* iOS: Temp directory that the OS can clear at will.
*/
@CordovaProperty
static tempDirectory: string;
/**
* iOS: Holds app-specific files that should be synced (e.g. to iCloud).
*/
@CordovaProperty
static syncedDataDirectory: string;
/**
* iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
*/
@CordovaProperty
static documentsDirectory: string;
/**
* BlackBerry10: Files globally available to all apps
*/
@CordovaProperty
static sharedDirectory: string;
static cordovaFileError: {} = {
1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR',