FileSystemHandle:name 属性
Baseline 2023Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
备注: 此特性在 Web Worker 中可用。
FileSystemHandle
接口的 name
只读属性返回句柄所代表的条目的名称。
值
一个字符串。
示例
下面的函数允许用户在文件选择器选择一个文件并获取句柄的 name
属性。
js
// 存放对文件句柄的引用
let fileHandle;
async function getFile() {
// 打开文件选择器
[fileHandle] = await window.showOpenFilePicker();
const fileName = fileHandle.name;
}
规范
Specification |
---|
File System # ref-for-dom-filesystemhandle-name① |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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.