javascript - Recursive directory search including files inside ZIP's and RAR's -
i'm trying find solution problem. need files inside target directory, including files inside zip , rars. possible? i'm working version, takes files inside directories, including zips , rars files, not inside.
var fs = require('fs'); var path = require('path'); var walk = function(dir, done) { var results = []; fs.readdir(dir, function(err, list) { if (err) return done(err); var pending = list.length; if (!pending) return done(null, results); list.foreach(function(file) { file = path.resolve(dir, file); fs.stat(file, function(err, stat) { if (stat && stat.isdirectory()) { walk(file, function(err, res) { results = results.concat(res); if (!--pending) done(null, results); }); } else { results.push(file); if (!--pending) done(null, results); } }); }); }); };
thanks in advance.
while recursively looking file,if zip file can use module adm-zip getentries of zip file , recursive search again.
Comments
Post a Comment