This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
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.
Option values | File/directory condition | Result | ||
---|---|---|---|---|
create
|
exclusive
| |||
false
|
n/a[1] | 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[1] | 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.
|
[1] When create
is false
, the value of exclusive
is irrelevant and ignored.
Specifications
Specification | Status | Comment |
---|---|---|
File and Directory Entries APIThe definition of 'FileSystemFlags' in that specification. | Draft | Initial specification. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome Full support 13 Full support 13 Prefixed' Implemented with the vendor prefix: webkit |
Edge Full support ≤79 Full support ≤79 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Partial support 50 Partial support 50 Notes' For security reasons, Firefox does not support creating files. This option has no effect. |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
Chrome Android Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android Partial support 50 Partial support 50 Notes' For security reasons, Firefox does not support creating files. This option has no effect. |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- See implementation notes.'
- See implementation notes.
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
See also
- File and Directory Entries API
- Introduction to the File System API
FileSystemFlags
FileSystemDirectoryEntry.getFile()
andFileSystemDirectoryEntry.getDirectory()
FileSystemFlags.create by Mozilla Contributors is licensed under CC-BY-SA 2.5.