Is any tiny library in javascript (for node) for ignore files

I would like implement a ingnore file in my node script like .ignore

exemple .projectignore:

file*
dir/*
dir/**/dir
*.swp

and with a with a javascript function

fs.readdir("/", function(err, files){
  if(!FileLib.isIgnored(files){
    ...
  }
});

Is any library can do this or how i can implement it easily ?

Check out the glob and minimatch packages.