Skip to content

Instantly share code, notes, and snippets.

@glynrob
Created February 23, 2013 20:16
Show Gist options
  • Save glynrob/5021170 to your computer and use it in GitHub Desktop.
Save glynrob/5021170 to your computer and use it in GitHub Desktop.
filesystem api get all files and folders
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