I try to traverse dir with html5 file api (using drag folder) and have code like this:
function traverse(entry) {
if (entry.isDirectory) {
dirReader = entry.createReader();
dirReader.readEntries(function (entries) {
for (var i = 0; i < entries.length; i++) {
someFoldersArray.push(entries[i]);
traverse(entries[i]);
}})}
So, i want to send array of folders to server, when recursion will finished. How can i do it? dirReader.readEntries - this method is asynchronized.