async copy(from,to,ignore=[]){
const recursive = async (from,to,ignore) => {
this.fs.readdirSync(from,{withFileTypes:true}).filter((file)=>{
if(ignore && ignore.length){
if(ignore.filter((name)=>(new RegExp(name,"iu").test(file.name))?true:false).length>0) return false;
}
return true;
}).map((file)=>{
const fromPath = `${from.slice(0,from.length-(from.slice(-1)==='/'))}/${file.name}`;
const toPath = `${to.slice(0,to.length-(to.slice(-1)==='/'))}/${file.name}`;
if (file.isDirectory()) {
this.fs.mkdirSync(toPath,{recursive:true});
recursive(fromPath,toPath,[]);
}else{
this.fs.cpSync(fromPath,toPath);
}
})
};
await recursive(from,to,ignore);
}