FileSystemEntry: isFile property
The read-onlyisFile
property oftheFileSystemEntry
interface istrue
if the entryrepresents a file (meaning it's aFileSystemFileEntry
) andfalse
if it's not.
You can also useisDirectory
to determineif the entry is a directory.
Warning:You should not assume that any entry which isn't a file is a directory or vice versa.There are other types of file descriptors on many operating systems. Be sure to usebothisDirectory
andisFile
as needed to ensure that theentry is something you know how to work with.
In this article
Value
A Boolean indicating whether or not theFileSystemEntry
is a file.
Examples
This example shows how this property might be used to determine whether to process theentry as a directory or file. If the entry is neither, an error handler is called withan appropriate message.
if (entry.isDirectory) { processSubdirectory(entry);} else if (entry.isFile) { processFile(entry);} else { displayErrorMessage("Unsupported file system entry specified.");}
Specifications
Specification |
---|
File and Directory Entries API> # dom-filesystementry-isfile> |
Browser compatibility
Loading…