import { Injectable } from '@angular/core'; import { CordovaProperty, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; export interface IFile extends Blob { lastModified: number; lastModifiedDate: number; name: string; size: number; type: string; } 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; /** * Requests a filesystem in which to store application data. * @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT. * @param size This is an indicator of how much storage space, in bytes, the application expects to need. * @param successCallback The callback that is called when the user agent provides a filesystem. * @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied. */ requestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void; /** * Allows the user to look up the Entry for a file or directory referred to by a local URL. * @param url A URL referring to a local file in a filesystem accessable via this API. * @param successCallback A callback that is called to report the Entry to which the supplied URL refers. * @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is denied. */ resolveLocalFileSystemURL(url: string, successCallback: EntryCallback, errorCallback?: ErrorCallback): void; /** * see requestFileSystem. */ webkitRequestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void; } export interface Metadata { /** * This is the time at which the file or directory was last modified. * @readonly */ modificationTime: Date; /** * The size of the file, in bytes. This must return 0 for directories. * @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 { /** * This is the name of the file system. The specifics of naming filesystems is unspecified, but a name must be unique across the list of exposed file systems. * @readonly */ name: string; /** * The root directory of the file system. * @readonly */ root: DirectoryEntry; } export interface Entry { /** * Entry is a file. */ isFile: boolean; /** * Entry is a directory. */ isDirectory: boolean; /** * Look up metadata about this entry. * @param successCallback A callback that is called with the time of the last modification. * @param errorCallback ErrorCallback A callback that is called when errors happen. */ getMetadata(successCallback: MetadataCallback, errorCallback?: ErrorCallback): 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; /** * Move an entry to a different location on the file system. It is an error to try to: * * *
  • move a directory inside itself or to any child at any depth;
  • *
  • move an entry into its parent if a name different from its current one isn't provided;
  • *
  • move a file to a path occupied by a directory;
  • *
  • move a directory to a path occupied by a file;
  • *
  • move any element to a path occupied by a directory which is not empty.
  • *