Closed taietel closed 9 years ago
@taietel Yeah, I think you may have a slight misunderstanding here. With scan_recursively
set to false
, the module will not scan sub-directories. scan_recursively
means to "scan the specified path _and_ all subpaths". Obviously, if you set that option to false
, it will not scan all sub-paths. On UNIX, if you run clamdscan manually in the shell, it does this by default but does not give any feedback on a file-by-file basis.
I guess it comes down to this... if you want to run a deep scan on a folder and all it's sub-folders (apparently to a limit at the moment) and get an array of all the good and bad files while using the clamdscan
option as your scanner, you have specify scan_recursively: true
and you must supply a you must supply a per-file callback (even if it does nothing).
Here's an example:
var clamscan = require('clamscan')({
scan_recursively: true
});
clamscan.scan_dir('/path/of/folder/to/scan', function(err, good_files, bad_files) {
if (!err) {
if (bad_files.length > 0) {
console.log("Your directory was infected.");
console.log("BadFiles: ", good_files);
} else {
console.log("Your directory and sub-directories are clean!");
}
}
}, function(err, file, is_infected) {
// You can just leave this part blank if you want.
});
I've just tested this and it works as expected.
Ok, thanks for clearing that out for me, I used the solution from your example, since yesterday, and it works.
I think that the issue with clamdscan and scan_recursively is not entirely fixed or I didn't understood right what needs to output. Now it works, but only shows the files that are directly in that folder, the ones that are in subfolders are not shown, they are not even scanned.