{"id":21131393,"url":"https://github.com/jrop/rc2","last_synced_at":"2026-05-01T20:31:13.251Z","repository":{"id":144984806,"uuid":"92987016","full_name":"jrop/rc2","owner":"jrop","description":"Load your rc files with ease - fully async","archived":false,"fork":false,"pushed_at":"2017-09-01T17:34:18.000Z","size":46,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T14:42:11.010Z","etag":null,"topics":["configuration","configuration-files","ini","json","json5","loader","loader-configuration","rc","rc-files","yaml","yml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jrop.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-31T20:42:35.000Z","updated_at":"2017-12-01T01:32:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"73c57137-039a-4e87-bb09-5856a3c5e06c","html_url":"https://github.com/jrop/rc2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jrop/rc2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Frc2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Frc2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Frc2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Frc2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrop","download_url":"https://codeload.github.com/jrop/rc2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Frc2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32512662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["configuration","configuration-files","ini","json","json5","loader","loader-configuration","rc","rc-files","yaml","yml"],"created_at":"2024-11-20T05:55:22.173Z","updated_at":"2026-05-01T20:31:13.242Z","avatar_url":"https://github.com/jrop.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rc2\n\nA follow-up to [rc](https://github.com/dominictarr/rc) that is more configurable.\n\n*More configure!  Such less bloat!*\n\n## Features\n\n* Fully asynchronous: no synchronous I/O in the module\n* Looks only in locations/ranges of directories which you tell it to\n* Loaders are **fully** configurable\n* Zero-dependencies (all bundled)\n\n## Example\n\n```ts\nimport rc2 from 'rc2'\nasync function main() {\n\tconst loaders = rc2.loaders()\n\t\t.default(['ini', 'json', 'js', 'yaml'])\n\t\t.ini()  // must have the `ini` module installed\n\t\t.json() // uses `json5` module, if installed, otherwise uses `JSON.parse(...)`\n\t\t.js()   // uses `require(...)`\n\t\t.yaml() // must have the `js-yaml` module installed\n\tconst config = await rc2({\n\t\tname: 'myapp', // will look for '.myapprc' files\n\t\tlocations: [{bottom: __dirname}],\n\t\tloaders,\n\t})\n}\nmain().catch(e =\u003e {\n\tprocess.exitCode = 1\n\tconsole.error(e)\n})\n```\n## API\n\n* `rc2(options) =\u003e Promise\u003cany\u003e`\n* `rc2.loaders() =\u003e Loaders`\n\n`rc2(...)` will only look in the locations you specify (see options below) for rc files.  In each directory, it searches the following globs:\n\n* `.${name}rc`\n* `.${name}rc.*`\n* `.${name}/config`\n* `.${name}/config.*`\n* `.config/${name}`\n* `.config/${name}.*`\n* `.config/${name}/config`\n* `.config/${name}/config.*`\n* Environment variables (`${name}_some__property`)\n* CLI args (parsed by minimist)\n\n### Options\n\n```ts\nexport interface Options {\n\tname: string            // the name of the app\n\tlocations?: {           // locations to search for rc files\n\t\ttop?: string          // if specified, denotes the \"top\" directory at which to stop looking\n\t\tbottom: string        // the start directory at which to start looking for rc files\n\t}[]\n\tloaders?: Loaders       // an instance created with `rc2.loaders()`\n\tdefault?: any           // default configuration if none are found\n\targv?: string[]\n\tenv?: any\n}\n```\n\n### Loaders\n\nA loader instance can be created with `rc2.loaders()`.  This instance has the following methods:\n\n```ts\ndeclare class Loaders {\n\tadd(ext: string, loader: (f: string) =\u003e any): this\n\tdefault(exts: string[]): this\n\tini(): this\n\tjs(): this\n\tjson(): this\n\tyaml(): this\n}\n```\n\n#### Example `loaders.add(...)`:\n\n```ts\nrc2.loaders()\n    .add('xml', f =\u003e {\n        // Async is handled with `co`, so return\n        // any yieldable for this function to be async\n        return new Promise(...) // for example\n    })\n```\n\nFor reference, [here is a list of valid `co` yieldables](https://github.com/tj/co#yieldables).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrop%2Frc2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrop%2Frc2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrop%2Frc2/lists"}