{"id":22221940,"url":"https://github.com/fabiospampinato/tiny-readdir-glob-gitignore","last_synced_at":"2025-07-27T16:31:49.436Z","repository":{"id":228601057,"uuid":"774463894","full_name":"fabiospampinato/tiny-readdir-glob-gitignore","owner":"fabiospampinato","description":"A simple promisified recursive readdir function, with support for globs and .gitignore files.","archived":false,"fork":false,"pushed_at":"2024-06-20T23:10:13.000Z","size":29,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-25T01:04:36.675Z","etag":null,"topics":["gitignore","glob","promise","readdir","recursive","simple","tiny"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/fabiospampinato.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2024-03-19T15:40:31.000Z","updated_at":"2024-08-11T08:31:33.000Z","dependencies_parsed_at":"2024-03-19T16:11:05.851Z","dependency_job_id":"462f8d63-7476-48b6-8aa2-918680a23d1d","html_url":"https://github.com/fabiospampinato/tiny-readdir-glob-gitignore","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"c0114fd30ad6b00142f067ad88f4373a9f8a0c8e"},"previous_names":["fabiospampinato/tiny-readdir-glob-gitignore"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-readdir-glob-gitignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-readdir-glob-gitignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-readdir-glob-gitignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ftiny-readdir-glob-gitignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/tiny-readdir-glob-gitignore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817017,"owners_count":17824200,"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":["gitignore","glob","promise","readdir","recursive","simple","tiny"],"created_at":"2024-12-02T23:16:18.346Z","updated_at":"2025-07-27T16:31:49.430Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# Tiny Readdir Glob Gitignore\n\nA simple promisified recursive readdir function, with support for globs and `.gitignore` files.\n\nCompared to simply searching for `.gitignore` files first, and normal files second, this approach is more efficient because both are searched for simultaneously, meaning that a single folder is entered at most once, and if a folder is discarded by a `.gitignore` file it won't be entered at all.\n\n## Install\n\n```sh\nnpm install --save tiny-readdir-glob-gitignore\n```\n\n## Usage\n\n```ts\nimport readdir from 'tiny-readdir-glob-gitignore';\n\n// Let's recursively read into a directory using a glob, in a .gitignore-aware fashion\n\nconst aborter = new AbortController ();\nconst result = await readdir ( ['src/**/*.js'], {\n  cwd: process.cwd (), // The root directory to start searching from\n  depth: 20, // Maximum depth to look at\n  limit: 1_000_000, // Maximum number of files explored, useful as a stop gap in some edge cases\n  followSymlinks: true, // Whether to follow symlinks or not\n  ignore: ['**/.git', '**/node_modules'], // Globs, or raw function, that if returns true will ignore this particular file or a directory and its descendants\n  ignoreFiles: ['.gitignore'], // List of .gitignore-like files to look for, defaults to ['.gitignore']\n  ignoreFilesFindAbove: true, // Whether to look for .gitignore-like files in parent directories also, defaults to true\n  ignoreFilesFindBetween: true, // Whether to look for .gitignore-like files between the \"cwd\" directory, and the actual search directories, which due to some optimizations could not be the same\n  ignoreFilesStrictly: true, // Whether to strictly follow the rules in .gitignore-like files, even if they exclude the folder you are explicitly searching into, defaults to false\n  signal: aborter.signal, // Optional abort signal, useful for aborting potentially expensive operations\n  onDirents: dirents =\u003e console.log ( dirents ) // Optional callback that will be called as soon as new dirents are available, useful for example for discovering \".gitignore\" files while searching\n});\n\n// This is the basic information we'll get\n\nresult.directories; // =\u003e Array of absolute paths pointing to directories, filtered by the provided glob\nresult.files; // =\u003e Array of absolute paths pointing to files, filtered by the provided glob\nresult.symlinks; // =\u003e Array of absolute paths pointing to symlinks, filtered by the provided glob\n\n// This is more advanced information we'll get, which is useful in some cases\n\nresult.directoriesFound; // =\u003e Array of absolute paths pointing to directories, not fully filtered by the provided glob yet\nresult.filesFound; // =\u003e Array of absolute paths pointing to files, not fully filtered by the provided glob yet\nresult.symlinksFound; // =\u003e Array of absolute paths pointing to symlinks, not fully filtered by the provided glob yet\n\nresult.directoriesFoundNames; // =\u003e Set of directories names found\nresult.filesFoundNames; // =\u003e Set of files name found\nresult.symlinksFoundNames; // =\u003e Set of symlinks names found\n\nresult.directoriesFoundNamesToPaths; // =\u003e Record of directories names found to their paths\nresult.filesFoundNamesToPaths; // =\u003e Record of files name found to their paths\nresult.symlinksFoundNamesToPaths; // =\u003e Record of symlinks names found to their paths\n\nsetTimeout ( () =\u003e aborter.abort (), 10000 ); // Aborting if it's going to take longer than 10s\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftiny-readdir-glob-gitignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Ftiny-readdir-glob-gitignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ftiny-readdir-glob-gitignore/lists"}