{"id":18657790,"url":"https://github.com/lightsofapollo/match-files","last_synced_at":"2025-11-05T22:30:21.992Z","repository":{"id":2146271,"uuid":"3091043","full_name":"lightsofapollo/match-files","owner":"lightsofapollo","description":"NodeJS util for file/directory filtering","archived":false,"fork":false,"pushed_at":"2012-04-04T18:28:33.000Z","size":107,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-28T12:39:56.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsofapollo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-03T00:30:54.000Z","updated_at":"2019-03-06T00:49:54.000Z","dependencies_parsed_at":"2022-08-28T14:50:22.005Z","dependency_job_id":null,"html_url":"https://github.com/lightsofapollo/match-files","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmatch-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmatch-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmatch-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsofapollo%2Fmatch-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsofapollo","download_url":"https://codeload.github.com/lightsofapollo/match-files/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239475960,"owners_count":19645041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:29:53.155Z","updated_at":"2025-11-05T22:30:21.964Z","avatar_url":"https://github.com/lightsofapollo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MatchFiles\n\nSimple (recursive) file finder. Designed to find files (not directories).\nHas simple filtering functionality built in for filtering by file and directory.\n\n## Examples\n\n    /*Imagine this structure:\n\n      lib/\n        file.js\n        other.md\n        module/\n          file.js\n          other.js\n\n    */\n\n\n\n### Simple no filtering\n    \n    var MatchFiles = require('match-files');\n\n    //1st is path, 2nd is options, 3rd is callback\n    MatchFiles.find(__dirname + '/lib', {}, function(err, files){\n      //following standard node conventions\n\n      console.log(files);\n      //will output (in absolute paths)\n      //Paths are *not* sorted so they may not appear\n      //in the order you expect\n      //['lib/file.js', 'lib/other.md' 'lib/module/file.js', 'lib/module/other.js']\n    });\n\n\n### Filtering Options\n\n    var MatchFiles = require('match-files');\n\n    //You can filter by file and by directory.\n    //If a directory is filtered files and directories under the\n    //filtered directory will *not* be searched.\n\n    function matchJsFiles(path){\n      //paths are relative to the 'basepath' which is the initial\n      //path set or the .basepath option given\n    }\n\n    function excludeModuleDir(path){\n      //Exclude all directories named module (and their children)\n      return !path.match(/\\/module/);\n    }\n\n    MatchFiles.find(__dirname + '/lib', {\n      fileFilters: [matchJsFiles], //always an array of functions\n      directoryFilters: [excludeModuleDir]\n    }, function(err, files){\n      console.log(files);\n      //['lib/file.js']\n    });\n\n## Options\n\nNote: the object given for options will be modified.\nI use file filters to exclude certain file types and\ndirectory filters to exclude things like .svn or .git.\n\n    {\n      //String used to create relative paths for filters\n      basepath: (default the path used for find) ,\n\n      //Default an empty array. Used for recursion you can\n      //pass an array of files to use as a base.\n      files: [],\n\n      //An array of functions that must return true for the \n      //file to be included in the results. Recieves a path relative to\n      //base root as an argument.\n      fileFilters: null,\n\n      //An array of functions that must return true for the \n      //file to be included in the results. Recieves a path relative to\n      //base root as an argument.\n      directoryFilters: null\n\n    }\n\n## License\n\nSee LICENSE (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fmatch-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsofapollo%2Fmatch-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsofapollo%2Fmatch-files/lists"}