- Overview
- Platform Support
- The Command-Line Interface
- Platform Guides
- Using Plugman to Manage Plugins
- The config.xml File
- Icons and Splash Screens
- Embedding WebViews
- Plugin Development Guide
- Privacy Guide
- Whitelist Guide
- Accelerometer
- Camera
- Capture
- Compass
- Connection
- Contacts
- Device
- Events
- File
- Geolocation
- Globalization
- InAppBrowser
- Media
- Notification
- Splashscreen
- Storage
This version of the documentation is outdated!
Click here for the latest released version.
DirectoryReader
An object that lists files and directories within a directory, as defined in the W3C Directories and Systems specification.
Methods
- readEntries: Read the entries in a directory.
Supported Platforms
- Amazon Fire OS
- Android
- BlackBerry WebWorks 5.0+
- iOS
- Windows Phone 7 and 8
- Windows 8
readEntries
Read the entries in this directory.
Parameters:
-
successCallback: A callback that is passed an array of
[FileEntry](../fileentry/fileentry.html)
and[DirectoryEntry](../directoryentry/directoryentry.html)
objects. (Function) -
errorCallback: A callback that executes if an error occurs when retrieving the directory listing. Invoked with a
[FileError](../fileerror/fileerror.html)
object. (Function)
Quick Example
function success(entries) {
var i;
for (i=0; i<entries.length; i++) {
console.log(entries[i].name);
}
}
function fail(error) {
alert("Failed to list directory contents: " + error.code);
}
// Get a directory reader
var directoryReader = dirEntry.createReader();
// Get a list of all the entries in the directory
directoryReader.readEntries(success,fail);