The LocalFileSystem object is used to supply arguments to DirectoryEntry objects such as the getFile and getDirectory methods, which you can use to look up or create files and directories, respectively.
The following are the properties.
- create : This is used to specify that a file or directory should be created, if it does not exist.
- exclusive : This is used with create. The exclusive flag causes the file or directory creation to fail if the target path already exists.
The following is an Example:
// Get the data directory, creating it if it doesn't exist.
dataDirect = fileSystem.root.getDirectory("data", {create: true});
// Create the status file, if and only if it doesn't exist.
statusFile = dataDir.getFile("statusfile.txt", { create: true, exclusive: true });
Using LocalFileSystem
This object provides a way to obtain root filesystems. It has two methods:
-
requestFileSystem : This method is used to request a fileSystem.
-
resolveLocalFileSystemURI : This method is used to retrieve a DirctoryEntry or FileEntry object using a local URI.
Two constants define a local filesystem.
-
LocalFileSystem.PERSISTENT : This is used for the storage that is not deleted by any user agent without permission from the application or user.
-
LocalFileSystem.TEMPORARY : This is used for storage with no guarantee of persistence.
The following is an example that requests the local filesystem:

Join the conversation! Your thoughts help the community grow.