File

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

备注: 此特性在 Web Worker 中可用。

File 接口提供有关文件的信息,并允许网页中的 JavaScript 访问其内容。

File 对象通常从用户使用 <input> 元素选择文件返回的 FileList 对象中检索,或者从拖放操作返回的 DataTransfer 对象中检索。

File 对象是一种特定类型的 Blob,并且可以在 Blob 可以使用的任何上下文中使用。特别地,以下 API 都接受 Blob 对象和 File 对象: