FileSystemEntry: name property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("File and Directory Entries API")}}
The read-only **name** property of the {{domxref("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 {{domxref("FileSystemEntry.fullPath", "fullPath")}} property).
Value
A string indicating the entry's name.
Examples
This example shows a function called isFileWithExtension() which returns true if the specified {{domxref("FileSystemEntry")}} is both a file and the file's name ends with a given extension.
js
function isFileWithExtension(entry, extension) {
return entry.isFile && entry.name.endsWith(`.${extension}`);
}Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- File and Directory Entries API
- {{domxref("FileSystemEntry")}}
- {{domxref("FileSystemEntry.fullPath")}}