The FileSystemDirectoryReader interface's readEntries() method retrieves the directory entries within the directory being read and delivers them in an array to a provided callback function.
The objects in the array are all based upon FileSystemEntry. Generally, they are either FileSystemFileEntry objects, which represent standard files, or FileSystemDirectoryEntry objects, which represent directories.
readEntries(successCallback) readEntries(successCallback, errorCallback)
successCallbackA function which is called when the directory's contents have been retrieved. The function receives a single input parameter: an array of file system entry objects, each based on FileSystemEntry. Generally, they are either FileSystemFileEntry objects, which represent standard files, or FileSystemDirectoryEntry objects, which represent directories. If there are no files left, or you've already called readEntries() on this FileSystemDirectoryReader, the array is empty.
errorCallback OptionalA callback function which is called if an error occurs while reading from the directory. It receives one input parameter: a DOMException object describing the error which occurred.
None (undefined).
See DataTransferItem.webkitGetAsEntry() for example code that uses this method.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
readEntries |
8 | 79 | 50 | 15 | 11.1 | 18 | 50 | 14 | 11.3 | 1.0 | 4.4 | 11.3 |
On Chrome 77, readEntries() will only return the first 100 FileSystemEntry instances. In order to obtain all of the instances, readEntries() must be called multiple times.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries