FileSystemFlags
The FileSystemFlags dictionary defines a set of values which are used when specifying option flags when calling certain methods in the File and Directory Entries API. Methods which accept an options parameter of this type may specify zero or more of these flags as fields in an object, like this:
dataDirectoryEntry.getDirectory("Workspace", { create: true }, function(entry) { });
Here, we see that the create property is provided, with a value of true, indicating that the directory should be created if it's not already there.
Note: These option flags currently don't have any useful meaning when used in the scope of Web content, where security precautions prevent the creation of new files or the replacement of existing ones.
Properties
- 
createOptional
-  If this property is true, and the requested file or directory doesn't exist, the user agent should create it. The default isfalse. The parent directory must already exist.
- 
exclusiveOptional
-  If true, and thecreateoption is alsotrue, the file must not exist prior to issuing the call. Instead, it must be possible for it to be created newly at call time. The default isfalse.
Values and results
The table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
Note that, when create is false, the value of exclusive is irrelevant and ignored.
| Option values | File/directory condition | Result | |
|---|---|---|---|
| create | exclusive | ||
| false | n/a | Path exists and matches the desired type (depending on whether the function called is getFile()orgetDirectory() | The successCallbackis called with aFileSystemFileEntryifgetFile()was called or aFileSystemDirectoryEntryifgetDirectory()was called. | 
| false | n/a | Path exists but doesn't match the desired type | The errorCallbackis called with an appropriate error code (if the callback was provided). | 
| true | false | Path exists | The existing file or directory is removed and replaced with a new one, then the successCallbackis called with aFileSystemFileEntryor aFileSystemDirectoryEntry, as appropriate. | 
| true | false | Path doesn't exist | The file or directory is created, then a FileSystemFileEntryor aFileSystemDirectoryEntryis passed to thesuccessCallback, as appropriate. | 
| true | true | Path exists | The errorCallbackis called with an appropriate error, such asFileError.PATH_EXISTS_ERR. | 
| true | true | Path doesn't exist | The file or directory is created, then a FileSystemFileEntryor aFileSystemDirectoryEntryis passed to thesuccessCallback, as appropriate. | 
Specifications
| Specification | Status | Comment | 
|---|---|---|
| File and Directory Entries API | Draft | 
See also
- File and Directory Entries API
- Introduction to the File System API
- FileSystemDirectoryEntry
- FileSystemFileEntry
    © 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFlags