rezigned / node-file-walker

Node.js module that recursively traversing files/directories
4 stars 2 forks source link

Are you have some finish callback ? #2

Open sea-kg opened 8 years ago

sea-kg commented 8 years ago

Are you have some finish callback ?

for example:

:::javascript
var walk = require('file-walker');
walk('dist/pnacl', function(dir, files, level) {
    for(var i = 0; i < files.length; i++){
        if(!fs.lstatSync(src).isDirectory()){
            zipfiles.push({
                source: src,
                target: trg
            });
        }else{
            zipfiles.push({target: trg});
        }
    };
}).then(()=>{
    // prepare zip
})
manufacturedba commented 6 years ago

I would construct a promise within each callback and use Promise.all at the end. I'm -1 for mixing in a promise in this library.