File and Directory Entries API
The read-only name property of
the FileSystemEntry interface returns a string
specifying the entry's name; this is the entry within its parent directory (the last
component of the path as indicated by the FileSystemEntry.fullPath property).
Value
A string indicating the entry's name.
Examples
This example shows a function called isFileWithExtension() which returns
true if the specified FileSystemEntry is both a file and the file's name
ends with a given extension.
function isFileWithExtension(entry, extension) {
return entry.isFile && entry.name.endsWith(`.${extension}`);
}
Specifications
Browser compatibility
See also
- File and Directory Entries API
- FileSystemEntry
- FileSystemEntry.fullPath
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
