From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/window/requestfilesystem/index.html | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 files/zh-cn/web/api/window/requestfilesystem/index.html (limited to 'files/zh-cn/web/api/window/requestfilesystem') diff --git a/files/zh-cn/web/api/window/requestfilesystem/index.html b/files/zh-cn/web/api/window/requestfilesystem/index.html new file mode 100644 index 0000000000..17561dfda0 --- /dev/null +++ b/files/zh-cn/web/api/window/requestfilesystem/index.html @@ -0,0 +1,74 @@ +--- +title: Window.requestFileSystem() +slug: Web/API/Window/requestFileSystem +translation_of: Web/API/Window/requestFileSystem +--- +

{{APIRef("File System API")}}

+ +

这个非标准 {{domxref("Window")}} requestFileSystem() 方法是谷歌浏览器内核用来让web站点或app获得通过沙箱访问文件系统 . 它返回 {{domxref("FileSystem")}} 然后就可以和 file system APIs 一起使用了

+ +
+

甚至相比较如File和Directory Entries API, requestFileSystem() 更不规范; 只有Chrome支持它, 所有其它浏览器已经决定不支持它了. 它甚至已经从规范建议单中移除了. 因此不要使用这个方法

+
+ +

语法

+ +
+

在所有支持它的浏览器中这个方法都有webkit前缀 (实际上也仅有谷歌浏览器支持).

+
+ +
window.requestFileSystem(type, size, successCallback[, errorCallback]);
+ +

参数

+ +
+
type
+
要请求的存储类型. 指定Window.TEMPORARY 浏览器自行决定要不要删除文件, 例如低内存, 或者Window.PERSISTENT 如果你需要文件保持在这个地方必须用户或站点或app明确许可. 持久存储要求用户授予站点配额
+
size
+
你希望你的app被允许的使用空间大小.
+
successCallback
+
+

成功获取文件系统时调用的函数。回调接收单个参数: 一个 {{domxref("FileSystem")}} 表示应用程序有权使用的文件系统的对象.

+
+
errorCallback {{optional_inline}}
+
一个可选参数,指定在试图获取文件系统时发生错误或用户拒绝创建或访问文件系统的权限时调用的函数。回调接收单个参数作为输入:一个{{domxref("FileError")}}用来描述错误的对象
+
+ +

返回值

+ +

无返回值

+ +

示例

+ +

规范

+ + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('File System API')}}{{Spec2('File System API')}}Draft of proposed API
+ +

这个API没有W3C或者WHATWG的官方规范.

+ +

浏览器兼容性

+ + + +

{{Compat("api.Window.requestFileSystem")}}

+ +

相关知识

+ + -- cgit v1.2.3-54-g00ecf