/**
 * Created by Pillar on 2015/6/20.
 */
// a util to traverse folder and filter files
'use strict';

// do a bfs search to certain folder with ceratin depth
function bfs(){

}

module.exports = {
    bfs: bfs
};
/**
 * Created by Pillar on 2015/6/20.
 */
// a util to traverse folder and filter files
'use strict';
var fs = require('fs');

// do a bfs search to certain folder with ceratin depth
function bfs() {
    // TODO:
}

function dfs(dir) {
    var result = [];
    var root = fs.readdirSync(dir);
    for (var i = 0; i < root.length; i++) {
        var filePath = dir + '/' + root[i];
        var stat = fs.statSync(filePath);
        if (stat && stat.isDirectory()) {
            result = result.concat(dfs(filePath));
        } else {
            result.push(filePath);
        }
    }
    return result;
}

module.exports = {
    bfs: bfs,
    dfs: dfs
};
Add dfs for walk files
Add dfs for walk files

need to add the bfs one, in order to show a tree view
