FilesystemPlugin

appendFile

appendFile(file: string, data: string, directory: FilesystemDirectory, encoding: string): Promise<FileAppendResult>
Append to a file on disk in the specified location on device
file string
the filename to write
data string
the data to write
directory FilesystemDirectory
the FilesystemDirectory to store the file in
encoding string
the encoding to write the file in (defaults to utf8)
Returns: Promise<FileAppendResult> - a promise that resolves with the file write result

deleteFile

deleteFile(file: string, directory: FilesystemDirectory): Promise<FileDeleteResult>
Delete a file from disk
file string
the filename to write
directory FilesystemDirectory
the FilesystemDirectory to store the file in
Returns: Promise<FileDeleteResult> - a promise that resolves with the deleted file data result

mkdir

mkdir(path: string, directory: FilesystemDirectory, createIntermediateDirectories: boolean): Promise<MkdirResult>
Create a directory.
path string
the path of the directory to create
directory FilesystemDirectory
the FilesystemDirectory where the new directory will live under
createIntermediateDirectories boolean
whether to create missing parent directories
Returns: Promise<MkdirResult> - a promise that resolves with the mkdir result

readFile

readFile(file: string, directory: FilesystemDirectory, encoding: string): Promise<FileReadResult>
Read a file from disk
file string
the filename to write
directory FilesystemDirectory
the FilesystemDirectory to store the file in
encoding string
the encoding to write the file in (defaults to utf8)
Returns: Promise<FileReadResult> - a promise that resolves with the read file data result

readdir

readdir(path: string, directory: FilesystemDirectory): Promise<ReaddirResult>
Return a list of files from the directory (not recursive)
path string
the directory path to read
directory FilesystemDirectory
the FilesystemDirectory to read the directory under
Returns: Promise<ReaddirResult> - a promise that resolves with the readdir directory listing result

rmdir

rmdir(path: string, directory: FilesystemDirectory): Promise<RmdirResult>
Remove a directory
path string
the path of directory to remove
directory FilesystemDirectory
the FilesystemDirectory to remove the directory under
Returns: Promise<RmdirResult>

stat

stat(path: string, directory: FilesystemDirectory): Promise<StatResult>
Return data about a file
path string
the path of the file
directory FilesystemDirectory
the FilesystemDirectory where the file lives
Returns: Promise<StatResult> - a promise that resolves with the file stat result

writeFile

writeFile(file: string, data: string, directory: FilesystemDirectory, encoding: string): Promise<FileWriteResult>
Write a file to disk in the specified location on device
file string
the filename to write
data string
the data to write
directory FilesystemDirectory
the FilesystemDirectory to store the file in
encoding string
the encoding to write the file in (defaults to utf8)
Returns: Promise<FileWriteResult> - a promise that resolves with the file write result
enum FilesystemDirectory {
// The Application directory
Application
// The Cache directory
Cache
// The Data directory
Data
// The Documents directory
Documents
// The external directory (Android only)
External
// The external storage directory (Android only)
ExternalStorage
}
interface FileAppendResult {
}
interface FileDeleteResult {
}
interface MkdirResult {
}
interface FileReadResult {
data : string
}
interface ReaddirResult {
files : undefined
}
interface RmdirResult {
}
interface StatResult {
ctime : number
mtime : number
size : number
type : string
}
interface FileWriteResult {
}