这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
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()
.
fileSystemFlags.create = 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 | 结果 | ||
|---|---|---|---|---|
create
|
exclusive
|
|||
false
|
n/a [1] |
Path exists and matches the desired type (depending on whether the function called is
getFile()
or
getDirectory()
|
successCallback
is called with a
FileSystemFileEntry
if
getFile()
was called or a
FileSystemDirectoryEntry
if
getDirectory()
被调用。
|
|
false
|
n/a [1] | Path exists but doesn't match the desired type |
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
或
FileSystemDirectoryEntry
, as appropriate.
|
|
true
|
false
|
Path doesn't exist |
The file or directory is created, then a
FileSystemFileEntry
或
FileSystemDirectoryEntry
被传递给
successCallback
, as appropriate.
|
|
true
|
true
|
Path exists |
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
或
FileSystemDirectoryEntry
被传递给
successCallback
, as appropriate.
|
|
[1] When
create
is
false
,值对于
exclusive
is irrelevant and ignored.
| 规范 | 状态 | 注释 |
|---|---|---|
|
文件和目录条目 API
The definition of 'FileSystemFlags' in that specification. |
草案 | 最初的规范。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
create
|
Chrome
13
Prefixed
|
Edge
≤79
Prefixed
|
Firefox
部分支持
50
|
IE No | Opera No | Safari No |
WebView Android
Yes
Prefixed
|
Chrome Android
Yes
Prefixed
|
Firefox Android
部分支持
50
|
Opera Android No | Safari iOS No |
Samsung Internet Android
Yes
Prefixed
|
完整支持
部分支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
要求使用供应商前缀或不同名称。
FileSystemFlags
FileSystemDirectoryEntry.getFile()
and
FileSystemDirectoryEntry.getDirectory()
FileSystemFlags
create
exclusive
FileError
FileException
FileHandle
FileRequest
FileSystem
FileSystemDirectoryEntry
FileSystemDirectoryEntrySync
FileSystemDirectoryReader
FileSystemDirectoryReaderSync
FileSystemEntry
FileSystemEntrySync
FileSystemFileEntry
FileSystemFileEntrySync
FileSystemSync
HTMLInputElement
LocalFileSystem
LocalFileSystemSync
LockedFile
元数据
Window.requestFileSystem()
Window.resolveLocalFileSystemURL()
WorkerGlobalScope.requestFileSystemSync()