Is it possible for node-glob to support function-type options.ignore ?
Case
If we want to list all files according to the .gitignore, and the .gitignore file is:
node_modules/*
!node_modules/dir-to-be-included/
Suppose there are thousands of things inside node_modules, we should filter out those useless directories at the certain stage of glob and not after globbing, or the matching process of glob will be very slow.
But it is not that easy to use glob pattern to imitate the behavior of gitignore.
Proposal
glob('**/*', {
ignore: function(path){
return whetherShouldIgnoreByGitignore(path)
// Pay attention that gitignore patterns are not glob patterns
}
}, (err, files) => {
doThingsWith(files)
})
Is it possible for
node-globto supportfunction-typeoptions.ignore?Case
If we want to list all files according to the
.gitignore, and the.gitignorefile is:Suppose there are thousands of things inside
node_modules, we should filter out those useless directories at the certain stage ofgloband not afterglobbing, or the matching process of glob will be very slow.But it is not that easy to use glob pattern to imitate the behavior of gitignore.
Proposal