示例#1
0
文件: index.js 项目: batilc1/fs-list
            list.forEach(function(subpath){
                var subdir;
                if (options && options.fullPath) subdir = path.resolve(dir, subpath);
                else subdir = path.join(dir, subpath);

                fq.stat(subdir, function(err, stat){
                    if(err) return reject(err);

                    if(stat && stat.isDirectory()){
                        dirs.push(subdir);
                        listFolders(subdir).then(function(res){
                            dirs = dirs.concat(res);
                            if(!--pending) resolve(dirs);
                        });
                    } else {
                        if(!--pending) resolve(dirs);
                    }
                });
            });
示例#2
0
文件: index.js 项目: batilc1/fs-list
            list.forEach(function(file) {
                var file;
                if (options && options.fullPath) file = path.resolve(dir, file);
                else file = path.join(dir, file);

                fq.stat(file, function(err, stat) {
                    if(err) return reject(err);

                    if (stat && stat.isDirectory()) {
                        listFiles(file, options).then(function(res) {
                            results = results.concat(res);
                            if (!--pending) resolve(results);
                        });
                    } else {
                        results.push(file);
                        if (!--pending) resolve(results);
                    }
                });
            });