This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The exclusive
property on the FileSystemFlags
dictionary is used in tandem with the create property to determine whether or not it's acceptable to require that the file not already exist when the reference to it is created by calling FileSystemDirectoryEntry.getFile()
or FileSystemDirectoryEntry.getDirectory()
.
fileSystemFlags.exclusive = booleanValue
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.
Specification | Status | Comment |
---|---|---|
File and Directory Entries API The definition of 'FileSystemFlags' in that specification. | Draft | Initial specification. |
This API has no official W3C or WHATWG specification.
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 13
|
? | 50
|
No | No | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes
|
Yes
|
? | 50
|
No | No | ? |
FileSystemFlags
FileSystemDirectoryEntry.getFile()
and FileSystemDirectoryEntry.getDirectory()
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFlags/exclusive