MCPcopy Index your code
hub / github.com/mailru/FileAPI / ondone

Function ondone

lib/FileAPI.core.js:1593–1622  ·  view source on GitHub ↗
(entries)

Source from the content-addressed store, hash-verified

1591 callback('DirectoryError.code: ' + err.code, files, all);
1592 };
1593 var ondone = function ondone(entries){
1594 if( firstAttempt ){
1595 firstAttempt = false;
1596 if( !entries.length ){
1597 entry.error = new Error('directory is empty');
1598 }
1599 }
1600
1601 // success
1602 if( entries.length ){
1603 api.afor(entries, function (next, entry){
1604 _readEntryAsFiles(entry, function (err, entryFiles, allEntries){
1605 if( !err ){
1606 files = files.concat(entryFiles);
1607 }
1608 all = all.concat(allEntries);
1609
1610 if( next ){
1611 next();
1612 }
1613 else {
1614 reader.readEntries(ondone, onerror);
1615 }
1616 });
1617 });
1618 }
1619 else {
1620 callback(false, files, all);
1621 }
1622 };
1623
1624 reader.readEntries(ondone, onerror);
1625 }

Callers

nothing calls this directly

Calls 2

_readEntryAsFilesFunction · 0.85
nextFunction · 0.85

Tested by

no test coverage detected