FileSystemFlags.create
The create property on the FileSystemFlags dictionary is used to indicate whether or not the file should be created if it's missing. FileSystemFlags is only used when calling FileSystemDirectoryEntry.getFile() or FileSystemDirectoryEntry.getDirectory().
Syntax
fileSystemFlags.create = booleanValue
Values
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() or getDirectory() | The successCallback is called with a FileSystemFileEntry if getFile() was called or a FileSystemDirectoryEntry if getDirectory() was called. |
false | n/a | Path exists but doesn't match the desired type | The errorCallback is 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 successCallback is called with a FileSystemFileEntry or a FileSystemDirectoryEntry, as appropriate. |
true | false | Path doesn't exist | The file or directory is created, then a FileSystemFileEntry or a FileSystemDirectoryEntry is passed to the successCallback, as appropriate. |
true | true | Path exists | The errorCallback is called with an appropriate error, such as FileError.PATH_EXISTS_ERR. |
true | true | Path doesn't exist | The file or directory is created, then a FileSystemFileEntry or a FileSystemDirectoryEntry is passed to the successCallback, 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
FileSystemFlags-
FileSystemDirectoryEntry.getFile()andFileSystemDirectoryEntry.getDirectory()
© 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/create