这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

文件和目录条目 API 接口 FileSystem 被用于表示文件系统。可以获得这些对象从 filesystem 特性在任何文件系统条目。某些浏览器提供额外 API 以创建和管理文件系统,譬如 Chrome 的 requestFileSystem() 方法。

此接口不准许访问用户文件系统。相反,将在浏览器沙盒中拥有虚拟驱动器。若想要获得对用户文件系统的访问,需要援引用户通过如安装 Chrome 扩展。相关 Chrome API 可以找到 here .

基本概念

有 2 种办法访问 FileSystem 对象:

  1. 可以直接要求仅仅为 Web APP 创建的某一沙盒文件系统表示通过直接调用 window.requestFileSystem() . If that call is successful, it executes a callback handler, which receives as a parameter a FileSystem 对象描述文件系统。
  2. 可以获取它从文件系统条目对象,透过其 filesystem 特性。

特性

FileSystem.name 只读
USVString 表示文件系统的名称。此名称在整个暴露文件系统列表中是唯一的。
FileSystem.root 只读
FileSystemDirectoryEntry 对象代表文件系统的根目录。透过此对象,可以访问文件系统中的所有文件和目录。

规范

规范 状态 注释
文件和目录条目 API
在该规范中的 FileSystem 定义。
草案

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
FileSystem Chrome 7 Alternate Name
7 Alternate Name
Alternate Name Uses the non-standard name: DOMFileSystem
Edge ≤18 Prefixed
≤18 Prefixed
Prefixed Implemented with the vendor prefix: WebKit
Edge only supports this API in drag-and-drop scenarios using the the DataTransferItem.webkitGetAsEntry() method. It's not available for use in file or folder picker panels (such as when you use an <input> element with the HTMLInputElement.webkitdirectory 属性。
Firefox 50 IE No Opera 15 Prefixed
15 Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari 11.1 WebView Android ≤37 Alternate Name
≤37 Alternate Name
Alternate Name Uses the non-standard name: DOMFileSystem
Chrome Android 18 Alternate Name
18 Alternate Name
Alternate Name Uses the non-standard name: DOMFileSystem
Firefox Android 50 Opera Android 14 Prefixed
14 Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS 11.3 Samsung Internet Android 1.0 Prefixed
1.0 Prefixed
Prefixed Implemented with the vendor prefix: webkit
名称 Chrome 7 Edge ≤18 Firefox 50 IE No Opera 15 Safari 11.1 WebView Android ≤37 Chrome Android 18 Firefox Android 50 Opera Android 14 Safari iOS 11.3 Samsung Internet Android 1.0
root Chrome 7 Edge ≤18 Firefox 50 IE No Opera 15 Safari 11.1 WebView Android ≤37 Chrome Android 18 Firefox Android 50 Opera Android 14 Safari iOS 11.3 Samsung Internet Android 1.0

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

使用非标名称。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改: