Another Example of my SyncArray November 2, 2011
I refer you to my original post with my SyncArray code
function getSubdirs = function(path, callback){
fs.readdir(path, function(err, files){
var sync = new SyncArray(files);
var subdirs = [];
sync.forEach(function(file, index, array, finishedOne){
fs.stat(file, function(err, stats){
if (stats.isDirectory()){
subdirs.push(file);
}
finishedOne();
});
}, function(){
callback(subdirs);
});
});
}