这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
FileSystemFileEntry
接口方法
createWriter()
返回
FileWriter
object which can be used to write data into the file represented by the directory entry.
FileSystemFileEntry.createWriter(successCallback[, errorCallback]);
successCallback
FileWriter
has been created successfully; the
FileWriter
is passed into the callback as the only parameter.
errorCallback
可选
FileWriter
. This callback receives as input a
FileError
object describing the error.
此例子建立方法,
writeToFileEntry()
,将文本字符串输出到传入目录条目对应文件。
function writeToFileEntry(entry, text) {
entry.createWriter(function(fileWriter) {
let data = Blob([text], { type: "text/plain" });
fileWriter.write(data);
}, function(fileError) {
/* do whatever to handle the error */
});
}
The success callback for the
createWriter()
call takes the text which was passed in and creates a new
Blob
object of type
text/plain
that contains the passed text. This blob is then output to the
FileWriter
object to be written to the file.
此 API 没有正式的 W3C 或 WHATWG (Web 超文本应用程序技术工作组) 规范。
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
createWriter
弃用
非标
|
Chrome 8 | Edge 79 |
Firefox
50 — 52
|
IE No | Opera No | Safari No | WebView Android ≤37 | Chrome Android 18 |
Firefox Android
50 — 52
|
Opera Android No | Safari iOS No | Samsung Internet Android Yes |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
FileSystemFileEntry
createWriter()
file()
FileError
FileException
FileHandle
FileRequest
FileSystem
FileSystemDirectoryEntry
FileSystemDirectoryEntrySync
FileSystemDirectoryReader
FileSystemDirectoryReaderSync
FileSystemEntry
FileSystemEntrySync
FileSystemFileEntrySync
FileSystemFlags
FileSystemSync
HTMLInputElement
LocalFileSystem
LocalFileSystemSync
LockedFile
元数据
Window.requestFileSystem()
Window.resolveLocalFileSystemURL()
WorkerGlobalScope.requestFileSystemSync()