import { File } from '@ionic-native/file' ; export interface IFile extends Blob { /**
     * Name of the file, without path information
     */ name : string ; /**
     * Last modified date
     */ lastModified : number ; /**
     * Last modified date
     */ lastModifiedDate : number ; /**
     * Size in bytes
     */ size : number ; /**
     * File mime type
     */ type : string ; localURL : string ; start : number ; end : number ; param start { Number } param end { Number } slice ( start , end ) : Blob ; } export interface LocalFileSystem { /**
     * Used for storage with no guarantee of persistence.
     */ TEMPORARY : number ; /**
     * Used for storage that should not be removed by the user agent without application or user permission.
     */ PERSISTENT : number ; param type param size param successCallback param errorCallback requestFileSystem ( type , size , successCallback , errorCallback ? ) : void ; param url param successCallback param errorCallback resolveLocalFileSystemURL ( url , successCallback , errorCallback ? ) : void ; /**
     * see requestFileSystem.
     */ webkitRequestFileSystem ( type , size , successCallback , errorCallback ? ) : void ; } export interface Metadata { readonly modificationTime : Date ; readonly size : number ; } export interface Flags { /**
     * Used to indicate that the user wants to create a file or directory if it was not previously there.
     */ create ? : boolean ; /**
     * By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists.
     */ exclusive ? : boolean ; } /**
 * This export interface represents a file system.
 */ export interface FileSystem { readonly name : string ; readonly root : DirectoryEntry ; toJSON ( ) : string ; encodeURIPath ( path ) : string ; } export interface Entry { /**
     * Entry is a file.
     */ isFile : boolean ; /**
     * Entry is a directory.
     */ isDirectory : boolean ; param successCallback param errorCallback getMetadata ( successCallback , errorCallback ? ) : void ; param successCallback { Function } param errorCallback { Function } param metadataObject { Metadata } setMetadata ( successCallback , errorCallback , metadataObject ) : void ; /**
     * The name of the entry, excluding the path leading to it.
     */ name : string ; /**
     * The full absolute path from the root to the entry.
     */ fullPath : string ; /**
     * The file system on which the entry resides.
     */ filesystem : FileSystem ; /**
     * an alternate URL which can be used by native webview controls, for example media players.
     */ nativeURL : string ; /**
     * Move an entry to a different location on the file system. It is an error to try to:
     *
     * <ui>
     * <li>move a directory inside itself or to any child at any depth;</li>
     * <li>move an entry into its parent if a name different from its current one isn't provided;</li>
     * <li>move a file to a path occupied by a directory;</li>
     * <li>move a directory to a path occupied by a file;</li>
     * <li>move any element to a path occupied by a directory which is not empty.</li>
     * <ul>
     *
     * A move of a file on top of an existing file must attempt to delete and replace that file.
     * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
     */ moveTo ( parent , newName ? , successCallback ? , errorCallback ? ) : void ; /**
     * Copy an entry to a different location on the file system. It is an error to try to:
     *
     * <ul>
     * <li> copy a directory inside itself or to any child at any depth;</li>
     * <li> copy an entry into its parent if a name different from its current one isn't provided;</li>
     * <li> copy a file to a path occupied by a directory;</li>
     * <li> copy a directory to a path occupied by a file;</li>
     * <li> copy any element to a path occupied by a directory which is not empty.</li>
     * <li> A copy of a file on top of an existing file must attempt to delete and replace that file.</li>
     * <li> A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.</li>
     * </ul>
     *
     * Directory copies are always recursive--that is, they copy all contents of the directory.
     */ copyTo ( parent , newName ? , successCallback ? , errorCallback ? ) : void ; /**
     * Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists.
     */ toURL ( ) : string ; return toInternalURL ( ) : string ; param successCallback param errorCallback remove ( successCallback , errorCallback ? ) : void ; param successCallback param errorCallback getParent ( successCallback , errorCallback ? ) : void ; } /**
 * This export interface represents a directory on a file system.
 */ export interface DirectoryEntry extends Entry { /**
     * Creates a new DirectoryReader to read Entries from this Directory.
     */ createReader ( ) : DirectoryReader ; param path param options param successCallback param errorCallback getFile ( path , options ? , successCallback ? , errorCallback ? ) : void ; param path param options param successCallback param errorCallback getDirectory ( path , options ? , successCallback ? , errorCallback ? ) : void ; param successCallback param errorCallback removeRecursively ( successCallback , errorCallback ? ) : void ; } /**
 * This export interface lets a user list files and directories in a directory. If there are no additions to or deletions from a directory between the first and last call to readEntries, and no errors occur, then:
 * <ul>
 * <li> A series of calls to readEntries must return each entry in the directory exactly once.</li>
 * <li> Once all entries have been returned, the next call to readEntries must produce an empty array.</li>
 * <li> If not all entries have been returned, the array produced by readEntries must not be empty.</li>
 * <li> The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].</li>
 * </ul>
 */ export interface DirectoryReader { localURL : string ; hasReadEntries : boolean ; param successCallback param errorCallback readEntries ( successCallback , errorCallback ? ) : void ; } /**
 * This export interface represents a file on a file system.
 */ export interface FileEntry extends Entry { param successCallback param errorCallback createWriter ( successCallback , errorCallback ? ) : void ; param successCallback param errorCallback file ( successCallback , errorCallback ? ) : void ; } /**
 * When requestFileSystem() succeeds, the following callback is made.
 */ export interface FileSystemCallback { param filesystem ( filesystem ) : void ; } /**
 * This export interface is the callback used to look up Entry objects.
 */ export interface EntryCallback { param entry ( entry ) : void ; } /**
 * This export interface is the callback used to look up FileEntry objects.
 */ export interface FileEntryCallback { param entry ( entry ) : void ; } /**
 * This export interface is the callback used to look up DirectoryEntry objects.
 */ export interface DirectoryEntryCallback { param entry ( entry ) : void ; } /**
 * When readEntries() succeeds, the following callback is made.
 */ export interface EntriesCallback { ( entries ) : void ; } /**
 * This export interface is the callback used to look up file and directory metadata.
 */ export interface MetadataCallback { ( metadata ) : void ; } /**
 * This export interface is the callback used to create a FileWriter.
 */ export interface FileWriterCallback { ( fileWriter ) : void ; } /**
 * This export interface is the callback used to obtain a File.
 */ export interface FileCallback { ( file ) : void ; } /**
 * This export interface is the generic callback used to indicate success of an asynchronous method.
 */ export interface VoidCallback { ( ) : void ; } /**
 * When an error occurs, the following callback is made.
 */ export interface ErrorCallback { ( err ) : void ; } export interface RemoveResult { success : boolean ; fileRemoved : Entry ; } hidden export declare class FileSaver extends EventTarget { /**
     * When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
     * This constructor must be visible when the script's global object is either a Window object or an object implementing the WorkerUtils interface.
     */ constructor ( data ) ; /**
     * When the abort method is called, user agents must run the steps below:
     * <ol>
     * <li> If readyState == DONE or readyState == INIT, terminate this overall series of steps without doing anything else. </li>
     * <li> Set readyState to DONE. </li>
     * <li> If there are any tasks from the object's FileSaver task source in one of the task queues, then remove those tasks. </li>
     * <li> Terminate the write algorithm being processed. </li>
     * <li> Set the error attribute to a DOMError object of type "AbortError". </li>
     * <li> Fire a progress event called abort </li>
     * <li> Fire a progress event called writeend </li>
     * <li> Terminate this algorithm. </li>
     * </ol>
     */ abort ( ) ; readonly INIT : number ; readonly WRITING : number ; readonly DONE : number ; readonly readyState : number ; readonly error : Error ; /**
     * Handler for writestart events
     */ onwritestart : ( event : ProgressEvent ) => void ; /**
     * Handler for progress events.
     */ onprogress : ( event : ProgressEvent ) => void ; /**
     * Handler for write events.
     */ onwrite : ( event : ProgressEvent ) => void ; /**
     * Handler for abort events.
     */ onabort : ( event : ProgressEvent ) => void ; /**
     * Handler for error events.
     */ onerror : ( event : ProgressEvent ) => void ; /**
     * Handler for writeend events.
     */ onwriteend : ( event : ProgressEvent ) => void ; } hidden export declare class FileWriter extends FileSaver { /**
     * The byte offset at which the next write to the file will occur. This must be no greater than length.
     * A newly-created FileWriter must have position set to 0.
     */ position : number ; /**
     * The length of the file. If the user does not have read access to the file, this must be the highest byte offset at which the user has written.
     */ length : number ; param data write ( data ) ; param offset seek ( offset ) ; param size truncate ( size ) ; } export interface IWriteOptions { replace ? : boolean ; append ? : boolean ; truncate ? : number ; } hidden export declare class FileError { constructor ( code ) ; static NOT_FOUND_ERR : number ; static SECURITY_ERR : number ; static ABORT_ERR : number ; static NOT_READABLE_ERR : number ; static ENCODING_ERR : number ; static NO_MODIFICATION_ALLOWED_ERR : number ; static INVALID_STATE_ERR : number ; static SYNTAX_ERR : number ; static INVALID_MODIFICATION_ERR : number ; static QUOTA_EXCEEDED_ERR : number ; static TYPE_MISMATCH_ERR : number ; static PATH_EXISTS_ERR : number ; /** Error code */ code : number ; message : string ; } hidden export declare class FileReader { static EMPTY : number ; static LOADING : number ; static DONE : number ; static READ_CHUNK_SIZE : number ; readyState : number ; error : Error ; result : string | ArrayBuffer ; onloadstart : ( evt : ProgressEvent ) => void ; onprogress : ( evt : ProgressEvent ) => void ; onload : ( evt : ProgressEvent ) => void ; onerror : ( evt : ProgressEvent ) => void ; onloadend : ( evt : ProgressEvent ) => void ; onabort : ( evt : ProgressEvent ) => void ; abort ( ) ; readAsText ( fe , encoding ? ) ; readAsDataURL ( fe ) ; readAsBinaryString ( fe ) ; readAsArrayBuffer ( fe ) ; hidden [ key ] : any ; } export class FileMock extends File { /**
     *  Read-only directory where the application is installed.
     */ applicationDirectory : string ; /**
     *  Read-only directory where the application is installed.
     */ applicationStorageDirectory : string ; /**
     * Where to put app-specific data files.
     */ dataDirectory : string ; /**
     * Cached files that should survive app restarts.
     * Apps should not rely on the OS to delete files in here.
     */ cacheDirectory : string ; /**
     * Android: the application space on external storage.
     */ externalApplicationStorageDirectory : string ; /**
     *  Android: Where to put app-specific data files on external storage.
     */ externalDataDirectory : string ; /**
     * Android: the application cache on external storage.
     */ externalCacheDirectory : string ; /**
     * Android: the external storage (SD card) root.
     */ externalRootDirectory : string ; /**
     * iOS: Temp directory that the OS can clear at will.
     */ tempDirectory : string ; /**
     * iOS: Holds app-specific files that should be synced (e.g. to iCloud).
     */ syncedDataDirectory : string ; /**
     * iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files)
     */ documentsDirectory : string ; /**
     * BlackBerry10: Files globally available to all apps
     */ sharedDirectory : string ; cordovaFileError : any ; returns { Promise < number > } getFreeDiskSpace ( ) { return new Promise ( ( resolve , reject ) => { resolve ( 1 ) ; } ) ; } ; param { string } path param { string } dir returns { Promise < boolean > } checkDir ( path , dir ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; param { string } path param { string } dirName param { boolean } replace returns { Promise < DirectoryEntry > } createDir ( path , dirName , replace ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } dirName returns { Promise < RemoveResult > } removeDir ( path , dirName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } dirName param { string } newPath param { string } newDirName returns { Promise < DirectoryEntry | Entry > } moveDir ( path , dirName , newPath , newDirName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } dirName param { string } newPath param { string } newDirName returns { Promise < Entry > } copyDir ( path , dirName , newPath , newDirName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } dirName returns { Promise < Entry [ ] > } listDir ( path , dirName ) { let response = [ ] ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } dirName returns { Promise < RemoveResult > } removeRecursively ( path , dirName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } file returns { Promise < boolean > } checkFile ( path , file ) { return new Promise ( ( resolve , reject ) => { resolve ( true ) ; } ) ; } ; param { string } path param { string } fileName param { boolean } replace returns { Promise < FileEntry > } createFile ( path , fileName , replace ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } fileName returns { Promise < RemoveResult > } removeFile ( path , fileName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } fileName param { string | Blob } text param { IWriteOptions } options returns { Promise < any > } writeFile ( path , fileName , text , options ? ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; hidden param { FileEntry } fe param { string | Blob } text param { IWriteOptions } options returns { Promise < FileEntry > } param { string } path param { string } fileName param { string | Blob } text returns { Promise < void > } writeExistingFile ( path , fileName , text ) { return ; } ; param { string } path param { string } file returns { Promise < string > } readAsText ( path , file ) { return new Promise ( ( resolve , reject ) => { resolve ( '' ) ; } ) ; } ; param { string } path param { string } file returns { Promise < string > } readAsDataURL ( path , file ) { return new Promise ( ( resolve , reject ) => { resolve ( '' ) ; } ) ; } ; param { string } path param { string } file returns { Promise < string > } readAsBinaryString ( path , file ) { return new Promise ( ( resolve , reject ) => { resolve ( '' ) ; } ) ; } ; param { string } path param { string } file returns { Promise < ArrayBuffer > } readAsArrayBuffer ( path , file ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } fileName param { string } newPath param { string } newFileName returns { Promise < Entry > } moveFile ( path , fileName , newPath , newFileName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param { string } path param { string } fileName param { string } newPath param { string } newFileName returns { Promise < Entry > } copyFile ( path , fileName , newPath , newFileName ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; hidden param fileUrl { string } returns { Promise < Entry > } resolveLocalFilesystemUrl ( fileUrl ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param directoryUrl { string } returns { Promise < DirectoryEntry > } resolveDirectoryUrl ( directoryUrl ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param directoryEntry { DirectoryEntry } param directoryName { string } param flags { Flags } returns { Promise < DirectoryEntry > } getDirectory ( directoryEntry , directoryName , flags ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param directoryEntry { DirectoryEntry } param fileName { string } param flags { Flags } returns { Promise < FileEntry > } getFile ( directoryEntry , fileName , flags ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; }