Kepler FileSystem TurboModule.
This is the interface contains basic methods to manipulate the contents of the local filesystem.
It makes querying into the file system, traversing it, reading and writing to files possible.
Extends
KeplerTurboModule
Properties
openFile
openFile: (path: string, mode: FileSystemTypes.OpenMode) => Promise<void>
Opens a file with the specified mode.
Parameters
path
string
The path of the file to open.
mode
FileSystemTypes.OpenMode
The mode to open the file in.
The promise that resolves when the file is opened.
Returns
Promise<void>
removeFile
removeFile: (path: string) => Promise<void>
Deletes a file at the path.
Parameters
path
string
The path of the file to delete.
The promise that resolves when the file is deleted.
Returns
Promise<void>
removeDir
removeDir: (path: string) => Promise<void>
Deletes a directory at the path.
Parameters
path
string
The path of the directory to delete.
The promise that resolves when the directory is deleted.
Returns
Promise<void>
removeDirAll
removeDirAll: (path: string) => Promise<void>
Deletes a directory at the path and all its content.
Parameters
path
string
The path of the directory to delete.
The promise that resolves when the directory is recursively deleted.
Returns
Promise<void>
readFileAsString
readFileAsString: (path: string, encoding: string) => Promise<string>
Reads the entire content of a text file into a string.
Parameters
path
string
The path to the file.
encoding
string
The encoding to use when reading the file.
The promise that resolves with the file content.
Returns
Promise<string>
writeStringToFile
writeStringToFile: (path: string, content: string, encoding: string) => Promise<number>
Writes a string to a text file.
Parameters
path
string
The path to the file.
content
string
The string content to write.
encoding
string
The encoding to use when writing the file.
The promise that resolves with the number of bytes written.
Returns
Promise<number>
getMetadata
getMetadata: (path: string, noFollow: boolean) => Promise<FileSystemTypes.Metadata>
Gets metadata about the file or symbolic link referred to by path.
Parameters
path
string
The path to the file.
noFollow
boolean
defines whether stat or lstat is used.
The promise that resolves with the metadata.
Returns
Promise<FileSystemTypes.Metadata>
getEntries
getEntries: (path: string) => Promise<string[]>
Gets directory entries for the given path.
Parameters
path
string
The path to the directory.
The promise that resolves with the directory entries.
Returns
Promise<string[]>
exists
exists: (path: string) => Promise<boolean>
Checks if a file or directory exists at the given path.
Parameters
path
string
The path to check.
The promise that resolves with true if the path exists, false otherwise.
Returns
Promise<boolean>
