node.js - node ncp filter not working -
i trying filter files through node ncp library filter not working. once filter gets false return breaks whole copying process
ncp(source, destination, options, function (err) { if (err) { console.error("backup error:", err); } console.log("backup of done!'); }); var options = { filter: function (file) { console.log("copying file:", file); var res = file.tostring().indexof("\\testdrive") !== -1; console.log("res:", res); return !res; }, //filter: new regexp("\\testdrive"),//or regex intance };
so once filter function or regex instance gets false result whole copy break
options.filter - regexp instance, against each file name tested determine whether copy or not, or function taking single parameter: copied file name, returning true or false, determining whether copy file or not.
wiki
Comments
Post a Comment