{"id":16057501,"url":"https://github.com/aduth/resolve-file-extension","last_synced_at":"2025-07-09T20:32:27.970Z","repository":{"id":66273612,"uuid":"413172579","full_name":"aduth/resolve-file-extension","owner":"aduth","description":"Resolve a file path from a base filename","archived":false,"fork":false,"pushed_at":"2021-11-18T01:06:09.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T22:35:12.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/aduth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-10-03T19:09:49.000Z","updated_at":"2021-11-18T01:06:10.000Z","dependencies_parsed_at":"2023-02-22T03:30:34.070Z","dependency_job_id":null,"html_url":"https://github.com/aduth/resolve-file-extension","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aduth/resolve-file-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fresolve-file-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fresolve-file-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fresolve-file-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fresolve-file-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aduth","download_url":"https://codeload.github.com/aduth/resolve-file-extension/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aduth%2Fresolve-file-extension/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502657,"owners_count":23618668,"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-10-09T03:02:55.689Z","updated_at":"2025-07-09T20:32:27.124Z","avatar_url":"https://github.com/aduth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `resolve-file-extension`\n\nResolve an absolute file path from a base filename.\n\n## Example\n\nFor example, this can be used to emulate the legacy Node.js \"automatic\" module resolution behavior you may be familiar with, where a file extension can be optionally omitted for specific file extensions such as `.js` and `.json`.\n\n```js\nimport { getFilePath } from 'resolve-file-extension';\n\nawait getFilePath('./example', ['.js', '.json']);\n// \"/path/to/example.js\"\n```\n\n## Installation\n\nInstall using [npm](https://www.npmjs.com/):\n\n```\nnpm install resolve-file-extension\n```\n\n## API\n\n### `getFilePath(baseFile: string, extension?: string[]): Promise\u003cstring|undefined\u003e`\n\nGiven a base file name and optional file extensions constraint, returns a promise which resolves to the first file path matching that base name and extension, or undefined if no file could be found. Extensions should be provided with a leading dot (\".\").\n\n## License\n\nCopyright 2021 Andrew Duthie\n\nReleased under the [MIT License](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faduth%2Fresolve-file-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faduth%2Fresolve-file-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faduth%2Fresolve-file-extension/lists"}