modules/orionode/lib/shared/sharedUtil.js
function getChildren(fileRoot, directory, depth, excludes) {
        return fs.readdirAsync(directory)
        .then(function(files) {
            return Promise.map(files, function(file) {
                if (Array.isArray(excludes) && excludes.indexOf(file) !== -1) {
                    return null; // omit
                }
                var filepath = path.join(directory, file);
                return fs.statAsync(filepath)
                .then(function(stats) {
                    var isDir = stats.isDirectory();
                    return treeJSON(file, fileRoot, 0, isDir, depth ? depth - 1 : 0);
                })
                .catch(function() {
                    return null; // suppress rejection
                });
            });
        })
        .then(function(results) {
            return results.filter(function(r) { return r; });
        });
    }
function getChildren(fileRoot, directory, depth, excludes) {
        return fs.readdirAsync(directory)
        .then(function(files) {
            return Promise.map(files, function(file) {
                if (Array.isArray(excludes) && excludes.indexOf(file) !== -1) {
                    return null; // omit
                }
                var filepath = path.join(directory, file);
                return fs.statAsync(filepath)
                .then(function(stats) {
                    var isDir = stats.isDirectory();
                    return treeJSON(file, fileRoot, 0, isDir, depth ? depth - 1 : 0);
                })
                .catch(function() {
                    return null; // suppress rejection
                });
            });
        })
        .then(function(results) {
            return results.filter(function(r) { return r; });
        });
    }
function getChildren ( fileRoot , directory , depth , excludes ) { return fs . readdirAsync ( directory ) . then ( function ( files ) { return Promise . map ( files , function ( file ) { if ( Array . isArray ( excludes ) && excludes . indexOf ( file ) !== - 1 ) { return null ; // omit } var filepath = path . join ( directory , file ) ; return fs . statAsync ( filepath ) . then ( function ( stats ) { var isDir = stats . isDirectory ( ) ; return treeJSON ( file , fileRoot , 0 , isDir , depth ? depth - 1 : 0 ) ; } ) . catch ( function ( ) { return null ; // suppress rejection } ) ; } ) ; } ) . then ( function ( results ) { return results . filter ( function ( r ) { return r ; } ) ; } ) ; }
Returns a list of children of the given directory.
Returns a list of children of the given directory .