fshost / node-dir

Recursive asynchronous file and directory operations for Node.js
MIT License
221 stars 44 forks source link

Return subfiles in paths.dirs #56

Open ridhwaans opened 6 years ago

ridhwaans commented 6 years ago

Is there a way to iterate the files in the paths.dirs returned by node-dir? It also returns paths.files but they are not necessarily in the same subdir

I want to avoid rereading dirs like:

 ...
root_dir.subdirs(__dirname, function(err, subdirs) { // read root_dir
    if (err) throw err;
    map(subdirs, function(dir){ // for each dir in subdirs
    fs.readdir( dir, function( err, files ) { // read dir
            if(err) console.log(err)
            files.forEach( function( file, index ) {
            ...