resumable.js
function processDirectory (directory, path, items, cb) {
      var dirReader = directory.createReader();
      var allEntries = [];

      function readEntries () {
        dirReader.readEntries(function(entries){
          if (entries.length) {
            allEntries = allEntries.concat(entries);
            return readEntries();
          }

          // process all conversion callbacks, finally invoke own one
          processCallbacks(
            allEntries.map(function(entry){
              // bind all properties except for callback
              return processItem.bind(null, entry, path, items);
            }),
            cb
          );
        });
      }

      readEntries();
    }
function processDirectory (directory, path, items, cb) {
      var dirReader = directory.createReader();
      var allEntries = [];

      function readEntries () {
        dirReader.readEntries(function(entries){
          if (entries.length) {
            allEntries = allEntries.concat(entries);
            return readEntries();
          }

          // process all conversion callbacks, finally invoke own one
          processCallbacks(
            allEntries.map(function(entry){
              // bind all properties except for callback
              return processItem.bind(null, entry, path, items);
            }),
            cb
          );
        });
      }

      readEntries();
    }
function processDirectory ( directory , path , items , cb ) { var dirReader = directory . createReader ( ) ; var allEntries = [ ] ; function readEntries ( ) { dirReader . readEntries ( function ( entries ) { if ( entries . length ) { allEntries = allEntries . concat ( entries ) ; return readEntries ( ) ; } // process all conversion callbacks, finally invoke own one processCallbacks ( allEntries . map ( function ( entry ) { // bind all properties except for callback return processItem . bind ( null , entry , path , items ) ; } ) , cb ) ; } ) ; } readEntries ( ) ; }
recursively traverse directory and collect files to upload
@param  {Object}   directory directory to process
@param  {string}   path      current path
@param  {File[]}   items     target list of items
@param  {Function} cb        callback invoked after traversing directory
recursively traverse directory and collect files to upload