FilesystemPlugin

appendFile

appendFile(options: FileAppendOptions): Promise<FileAppendResult>
Append to a file on disk in the specified location on device
options FileAppendOptions
options for the file append
Returns: Promise<FileAppendResult> - a promise that resolves with the file write result

copy

copy(options: CopyOptions): Promise<CopyResult>
Copy a file or directory
options CopyOptions
the options for the copy operation
Returns: Promise<CopyResult> - a promise that resolves with the copy result

deleteFile

deleteFile(options: FileDeleteOptions): Promise<FileDeleteResult>
Delete a file from disk
options FileDeleteOptions
options for the file delete
Returns: Promise<FileDeleteResult> - a promise that resolves with the deleted file data result

getUri

getUri(options: GetUriOptions): Promise<GetUriResult>
Return full File URI for a path and directory
options GetUriOptions
the options for the stat operation
Returns: Promise<GetUriResult> - a promise that resolves with the file stat result

mkdir

mkdir(options: MkdirOptions): Promise<MkdirResult>
Create a directory.
options MkdirOptions
options for the mkdir
Returns: Promise<MkdirResult> - a promise that resolves with the mkdir result

readFile

readFile(options: FileReadOptions): Promise<FileReadResult>
Read a file from disk
options FileReadOptions
options for the file read
Returns: Promise<FileReadResult> - a promise that resolves with the read file data result

readdir

readdir(options: ReaddirOptions): Promise<ReaddirResult>
Return a list of files from the directory (not recursive)
options ReaddirOptions
the options for the readdir operation
Returns: Promise<ReaddirResult> - a promise that resolves with the readdir directory listing result

rename

rename(options: RenameOptions): Promise<RenameResult>
Rename a file or directory
options RenameOptions
the options for the rename operation
Returns: Promise<RenameResult> - a promise that resolves with the rename result

rmdir

rmdir(options: RmdirOptions): Promise<RmdirResult>
Remove a directory
options RmdirOptions
the options for the directory remove
Returns: Promise<RmdirResult>

stat

stat(options: StatOptions): Promise<StatResult>
Return data about a file
options StatOptions
the options for the stat operation
Returns: Promise<StatResult> - a promise that resolves with the file stat result

writeFile

writeFile(options: FileWriteOptions): Promise<FileWriteResult>
Write a file to disk in the specified location on device
options FileWriteOptions
options for the file write
Returns: Promise<FileWriteResult> - a promise that resolves with the file write result

addListener

addListener(eventName: string, listenerFunc: Function): PluginListenerHandle
eventName string
listenerFunc Function
Returns: PluginListenerHandle

Interfaces Used

FileAppendOptions

interface FileAppendOptions {
// The data to write
data : string;
// The FilesystemDirectory to store the file in
directory ?: FilesystemDirectory;
// The encoding to write the file in. If not provided, data is written as base64 encoded data.
encoding ?: FilesystemEncoding;
// The filename to write
path : string;
}

FileAppendResult

interface FileAppendResult {
}

CopyOptions

interface CopyOptions {
// The FilesystemDirectory containing the existing file or directory
directory ?: FilesystemDirectory;
// The existing file or directory
from : string;
// The destination file or directory
to : string;
// The FilesystemDirectory containing the destination file or directory. If not supplied will use the 'directory' parameter as the destination
toDirectory ?: FilesystemDirectory;
}

CopyResult

interface CopyResult {
}

FileDeleteOptions

interface FileDeleteOptions {
// The FilesystemDirectory to delete the file from
directory ?: FilesystemDirectory;
// The filename to delete
path : string;
}

FileDeleteResult

interface FileDeleteResult {
}

GetUriOptions

interface GetUriOptions {
// The FilesystemDirectory to get the file under
directory : FilesystemDirectory;
// The path of the file to get the URI for
path : string;
}

GetUriResult

interface GetUriResult {
uri : string;
}

MkdirOptions

interface MkdirOptions {
// undefined
createIntermediateDirectories ?: boolean;
// The FilesystemDirectory to make the new directory in
directory ?: FilesystemDirectory;
// The path of the new directory
path : string;
// Whether to create any missing parent directories as well. Defaults to false
recursive ?: boolean;
}

MkdirResult

interface MkdirResult {
}

FileReadOptions

interface FileReadOptions {
// The FilesystemDirectory to read the file from
directory ?: FilesystemDirectory;
// The encoding to read the file in, if not provided, data is read as binary and returned as base64 encoded data.
encoding ?: FilesystemEncoding;
// The filename to read
path : string;
}

FileReadResult

interface FileReadResult {
data : string;
}

ReaddirOptions

interface ReaddirOptions {
// The FilesystemDirectory to list files from
directory ?: FilesystemDirectory;
// The path of the directory to read
path : string;
}

ReaddirResult

interface ReaddirResult {
files : string[];
}

RenameOptions

interface RenameOptions {
// The FilesystemDirectory containing the existing file or directory
directory ?: FilesystemDirectory;
// The existing file or directory
from : string;
// The destination file or directory
to : string;
// The FilesystemDirectory containing the destination file or directory. If not supplied will use the 'directory' parameter as the destination
toDirectory ?: FilesystemDirectory;
}

RenameResult

interface RenameResult {
}

RmdirOptions

interface RmdirOptions {
// The FilesystemDirectory to remove the directory from
directory ?: FilesystemDirectory;
// The path of the directory to remove
path : string;
// Whether to recursively remove the contents of the directory Defaults to false
recursive ?: boolean;
}

RmdirResult

interface RmdirResult {
}

StatOptions

interface StatOptions {
// The FilesystemDirectory to get the file under
directory ?: FilesystemDirectory;
// The path of the file to get data about
path : string;
}

StatResult

interface StatResult {
ctime : number;
mtime : number;
size : number;
type : string;
uri : string;
}

FileWriteOptions

interface FileWriteOptions {
// The data to write
data : string;
// The FilesystemDirectory to store the file in
directory ?: FilesystemDirectory;
// The encoding to write the file in. If not provided, data is written as base64 encoded data.
encoding ?: FilesystemEncoding;
// The filename to write
path : string;
}

FileWriteResult

interface FileWriteResult {
}

FilesystemDirectory

enum FilesystemDirectory {
// The Application directory
Application: "APPLICATION"
// The Cache directory
Cache: "CACHE"
// The Data directory
Data: "DATA"
// The Documents directory
Documents: "DOCUMENTS"
// The external directory (Android only)
External: "EXTERNAL"
// The external storage directory (Android only)
ExternalStorage: "EXTERNAL_STORAGE"
}

FilesystemEncoding

enum FilesystemEncoding {
ASCII: "ascii"
UTF16: "utf16"
UTF8: "utf8"
}