{"id":15672666,"url":"https://github.com/silverwind/rrdir","last_synced_at":"2025-05-06T21:44:57.347Z","repository":{"id":55543028,"uuid":"148018974","full_name":"silverwind/rrdir","owner":"silverwind","description":"Recursive directory reader with a delightful API","archived":false,"fork":false,"pushed_at":"2025-04-02T08:48:04.000Z","size":1419,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T15:33:31.851Z","etag":null,"topics":["nodejs-modules","readdir","recursive-readdir","scandir","withfiletypes"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silverwind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-09-09T11:29:40.000Z","updated_at":"2025-04-09T10:13:21.000Z","dependencies_parsed_at":"2024-02-16T03:28:54.666Z","dependency_job_id":"9e962b9b-3b21-49ed-a4fc-f3a3c1cd4321","html_url":"https://github.com/silverwind/rrdir","commit_stats":{"total_commits":189,"total_committers":2,"mean_commits":94.5,"dds":"0.010582010582010581","last_synced_commit":"e0b41529976c2a81f0e5728d96ab8d0877ce3186"},"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Frrdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Frrdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Frrdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Frrdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silverwind","download_url":"https://codeload.github.com/silverwind/rrdir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776450,"owners_count":21802460,"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":["nodejs-modules","readdir","recursive-readdir","scandir","withfiletypes"],"created_at":"2024-10-03T15:29:47.738Z","updated_at":"2025-05-06T21:44:57.280Z","avatar_url":"https://github.com/silverwind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rrdir\n[![](https://img.shields.io/npm/v/rrdir.svg?style=flat)](https://www.npmjs.org/package/rrdir) [![](https://img.shields.io/npm/dm/rrdir.svg)](https://www.npmjs.org/package/rrdir) [![](https://packagephobia.com/badge?p=rrdir)](https://packagephobia.com/result?p=rrdir)\n\n\u003e Recursive directory reader with a delightful API\n\n`rrdir` recursively reads a directory and returns entries within via an async iterator or async/sync as Array. It can typically iterate millions of files in a matter of seconds. Memory usage is `O(1)` for the async iterator and `O(n)` for the Array variants.\n\nContrary to other similar modules, this module is optionally able to read any path including ones that contain invalid UTF-8 sequences.\n\n## Usage\n```console\nnpm i rrdir\n```\n```js\nimport {rrdir, rrdirAsync, rrdirSync} from \"rrdir\";\n\nfor await (const entry of rrdir(\"dir\")) {\n  // =\u003e {path: 'dir/file', directory: false, symlink: false}\n}\n\nconst entries = await rrdirAsync(\"dir\");\n// =\u003e [{path: 'dir/file', directory: false, symlink: false}]\n\nconst entries = rrdirSync(\"dir\");\n// =\u003e [{path: 'dir/file', directory: false, symlink: false}]\n\n```\n\n## API\n### `rrdir(dir, [options])`\n### `rrdirAsync(dir, [options])`\n### `rrdirSync(dir, [options])`\n\n`rrdir` is an async iterator which yields `entry`. `rrdirAsync` and `rrdirSync` return an Array of `entry`.\n\n#### `dir` *String* | *Uint8Array*\n\nThe directory to read, either absolute or relative. Pass a `Uint8Array` to switch the module into `Uint8Array` mode which is required to be able to read every file, like for example files with names that are invalid UTF-8 sequences.\n\n#### `options` *Object*\n\n- `stats` *boolean*: Whether to include `entry.stats`. Will reduce performance. Default: `false`.\n- `followSymlinks` *boolean*: Whether to follow symlinks for both recursion and `stat` calls. Default: `false`.\n- `exclude` *Array*: Path globs to exclude, e.g. `[\"**.js\"]`. Default: `undefined`.\n- `include` *Array*: Path globs to include, e.g. `[\"**.map\"]`. Default: `undefined`.\n- `strict` *boolean*: Whether to throw immediately when reading an entry fails. Default: `false`.\n- `insensitive` *boolean*: Whether `include` and `exclude` match case-insensitively. Default: `false`.\n\n#### `entry` *Object*\n\n- `path` *string* | *Uint8Array*: The path to the entry, will be relative if `dir` is given relative. If `dir` is a `Uint8Array`, this will be too. Always present.\n- `directory` *boolean*: Boolean indicating whether the entry is a directory. `undefined` on error.\n- `symlink` *boolean*: Boolean indicating whether the entry is a symbolic link. `undefined` on error.\n- `stats` *Object*: A [`fs.stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object, present when `options.stats` is set. `undefined` on error.\n- `err` *Error*: Any error encountered while reading this entry. `undefined` on success.\n\n© [silverwind](https://github.com/silverwind), distributed under BSD licence\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Frrdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilverwind%2Frrdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Frrdir/lists"}