FileSystemEntry.name
The read-only name
property of the FileSystemEntry
interface returns a USVString
specifying the entry's name; this is the entry within its parent directory (the last component of the path as indicated by the fullPath
property).
Syntax
var name = FileSystemEntry.name;
Value
A USVString
indicating the entry's name.
Example
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
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
name |
8 |
79 |
50 |
No |
No |
11.1 |
≤37 |
18 |
50 |
No |
11.3 |
1.0 |
See also
- File and Directory Entries API
- Introduction to the File System API
FileSystemEntry
FileSystemEntry.fullPath
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/name