{"id":17951006,"url":"https://github.com/tommy-mitchell/get-executable-bin-path","last_synced_at":"2026-03-07T17:02:51.997Z","repository":{"id":247811399,"uuid":"826901480","full_name":"tommy-mitchell/get-executable-bin-path","owner":"tommy-mitchell","description":"Get the current package's binary path and ensure it's executable.","archived":false,"fork":false,"pushed_at":"2024-07-10T16:31:08.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T15:05:28.908Z","etag":null,"topics":["bin","binary","executable","file","fs","nodejs","package","package-json","path","permissions","shell","terminal","testing","unit-testing"],"latest_commit_sha":null,"homepage":"https://npm.im/get-executable-bin-path","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/tommy-mitchell.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2024-07-10T15:53:17.000Z","updated_at":"2024-07-10T16:33:03.000Z","dependencies_parsed_at":"2024-07-10T19:56:54.921Z","dependency_job_id":"f4f64831-ea42-464b-9adb-93e07ef3b518","html_url":"https://github.com/tommy-mitchell/get-executable-bin-path","commit_stats":null,"previous_names":["tommy-mitchell/get-executable-bin-path"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-mitchell%2Fget-executable-bin-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-mitchell%2Fget-executable-bin-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-mitchell%2Fget-executable-bin-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-mitchell%2Fget-executable-bin-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommy-mitchell","download_url":"https://codeload.github.com/tommy-mitchell/get-executable-bin-path/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241774781,"owners_count":20018369,"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":["bin","binary","executable","file","fs","nodejs","package","package-json","path","permissions","shell","terminal","testing","unit-testing"],"created_at":"2024-10-29T09:42:07.796Z","updated_at":"2026-03-07T17:02:51.969Z","avatar_url":"https://github.com/tommy-mitchell.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-executable-bin-path\n\nGet the current package's binary path and ensure it's executable.\n\nUseful for making sure your CLIs are configured correctly.\n\n## Install\n\n```sh\nnpm install --save-dev get-executable-bin-path\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eOther Package Managers\u003c/summary\u003e\n\u003cp\u003e\n\n```sh\nyarn add --dev get-executable-bin-path\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## Usage\n\n```ts\nimport anyTest, { type TestFn } from \"ava\";\nimport { execa } from \"execa\";\nimport { getExecutableBinPath } from \"get-executable-bin-path\";\n\nconst test = anyTest as TestFn\u003c{\n\tbinPath: string;\n}\u003e;\n\ntest.before(\"setup context\", async t =\u003e {\n\tt.context.binPath = await getExecutableBinPath();\n});\n\ntest(\"main\", async t =\u003e {\n\tconst { stdout } = await execa(t.context.binPath);\n\tt.is(stdout, /* … */);\n});\n```\n\n## API\n\n### getExecutableBinPath(options?): `Promise\u003cstring\u003e`\n\n### getExecutableBinPathSync(options?): `string`\n\n#### options\n\nType: `object`\n\n##### name\n\nType: `string`\\\nDefault: `package.json` `name` field\n\nName of the binary. See [`get-bin-path`](https://github.com/ehmicky/get-bin-path#optionsname) for more details.\n\n##### cwd\n\nType: `string`\\\nDefault: `process.cwd()`\n\nOverride the current directory. Used when retrieving the `package.json`.\n\n##### map\n\nType: `(binPath: string) =\u003e string`\n\nAn optional mapping that resolves to a binary's path.\n\nThis can be used to get the path of the source binary, for example.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\u003cp\u003e\n\n```ts\nconst binPath = await getExecutableBinPath();\n//=\u003e \"…/dist/cli.js\"\n\nconst mappedBinPath = await getExecutableBinPath({\n\tmap: binPath =\u003e binPath.replace(\"dist\", \"src\").replace(\".js\", \".ts\"),\n});\n//=\u003e \"…/src/cli.ts\"\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## BinaryPathNotFoundError\n\nThe error thrown when a given binary cannot be resolved.\n\n## BinaryNotExecutableError\n\nThe error thrown when a given binary is not executable or resolvable.\n\n## Related\n\n- [get-bin-path](https://github.com/ehmicky/get-bin-path) - Get the current package's binary path.\n- [bin-path-cli](https://github.com/tommy-mitchell/bin-path-cli) - Execute the current package's binary.\n- [is-executable](https://github.com/sindresorhus/is-executable) - Check whether a file can be executed.\n- [execa](https://github.com/sindresorhus/execa) - Process execution for humans.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy-mitchell%2Fget-executable-bin-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommy-mitchell%2Fget-executable-bin-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy-mitchell%2Fget-executable-bin-path/lists"}