Created
February 23, 2013 20:16
-
-
Save glynrob/5021170 to your computer and use it in GitHub Desktop.
filesystem api get all files and folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function displayDirectory(){ | |
var dirReader = fs.root.createReader(); // create reader | |
var entries = []; | |
var readEntries = function() { // new function so you can loop on itself | |
dirReader.readEntries(function(results) { // read all entries saved | |
if (!results.length) { | |
displayFilesAndFolders(entries.sort()); // display all entries saved | |
} else { | |
entries = entries.concat(toArray(results)); | |
readEntries(); | |
} | |
}, errorHandler); | |
} | |
readEntries(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment