To glob for pattern excluding multiple files with Node.js, we set the ignore
property.
For instance, we write
const glob = require("glob");
glob(
"**/*",
{ ignore: ["index.html", "js", "js/app.js", "js/lib.js"] },
(err, files) => {
console.log(files);
}
);
to call glob
with an object with the ignore
property to ignore the patterns listed in the array.
And then we get the results from files
.