So I already have some code from the "targz" package that packs all the files inside of a directory. Now I have seen that you can somehow ignore files (not pack them) and I wanted to do it as well. I just can't figure out how I should write the ignore section. Here is my code:
targz.compress({
src: "./" + this.sourcePath + "/",
dest: "./" + this.targetPath + "/" + "result.tar.gz",
tar: {
entries: this.fileArray,
ignore: function(name) {
return path.extname(name) === '.pdf'
}
},
gz: {
level: 6,
memLevel: 6,
}
}, function(err){
if(err) {
console.log(err);
reject(err);
} else {
resolve();
}
});
Can somebody tell me how I need to write that section so it works? It would be greatly appreciated