// Type definitions for ngCordova file plugin // Project: https://github.com/driftyco/ng-cordova // Definitions by: Phil McCloghry-Laing // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// /// declare module ngCordova { export interface IFileService { getFreeDiskSpace(): IFilePromise; checkDir(path: string, directory: string): IFilePromise; checkFile(path: string, file: string): IFilePromise; createDir(path: string, directory: string, replace?: boolean): IFilePromise; createFile(path: string, file: string, replace?: boolean): IFilePromise; removeDir(path: string, directory: string): IFilePromise>; removeFile(path: string, file: string): IFilePromise>; removeRecursively(path: string, directory: string): IFilePromise>; writeFile(path: string, file: string, text: string | Blob, replace?: boolean): IFilePromise; writeExistingFile(path: string, file: string, text: string | Blob): IFilePromise; readAsText(path: string, file: string): ng.IPromise; readAsDataURL(path: string, file: string): ng.IPromise; readAsBinaryString(path: string, file: string): ng.IPromise; readAsArrayBuffer(path: string, file: string): ng.IPromise; moveDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; moveFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; copyDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; copyFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; } export interface IFilePromise extends ng.IPromise { then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; catch(onRejected: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; } export interface IFileRemoveResult { success: boolean; fileRemoved: TEntry; } export interface IFileError extends FileError { message: string; } }