Class: GDDirectoryReader

GDDirectoryReader()

An interface that lists the files and directories in a directory.

Methods

readEntries(successCallback, errorCallback)

Returns a list of entries from a directory.
Parameters:
Name Type Description
successCallback function Called with a list of entries
errorCallback function Called with a FileError
Source:
Example
requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
    var options = {create: true, exclusive: false};

    fileSystem.root.getDirectory("parentDirectory", options, function (parentDirectory) {
        // "/parentDirectory" is created here
        fileSystem.root.getDirectory("parentDirectory/nestedDirectory", options, function (nestedDirectory) {
            var directoryReader = parentDirectory.createReader();
            directoryReader.readEntries(function (entries) {
                console.log(entries[0].isFile); //false
                console.log(entries[0].isDirectory); //true
                console.log(entries[0].name); // "nestedDirectory"
                console.log(entries[0].fullPath); // "/parentDirectory/nestedDirectory"
                console.log(entries[0].filesystem); // "/"
                console.log(entries.length); // 1
            }, null);
        }, null);
    }, null);
}, null);