This version of the documentation is outdated!
Click here for the latest released version.
DirectoryReader
An object that lists files and directories in a directory. Defined in the Directories and Systems specification.
Methods
- readEntries: Read the entries in a directory.
Supported Platforms
- Android
- BlackBerry WebWorks (OS 5.0 and higher)
- iOS
- Windows Phone 7 ( Mango )
readEntries
Read the entries in this directory.
Parameters:
- successCallback - A callback that is passed an array of FileEntry and DirectoryEntry objects. (Function)
- errorCallback - A callback that is called if an error occurs retrieving the directory listing. Invoked with a FileError 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);