{"id":15685654,"url":"https://github.com/jonschlinkert/find-pkg","last_synced_at":"2025-05-07T14:24:40.278Z","repository":{"id":57236315,"uuid":"47008141","full_name":"jonschlinkert/find-pkg","owner":"jonschlinkert","description":"Find the first directory with a package.json, recursing up, starting with the given directory. Similar to look-up but does not support globs and only searches for package.json. Async and sync.","archived":false,"fork":false,"pushed_at":"2018-03-28T05:59:37.000Z","size":18,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T10:51:25.426Z","etag":null,"topics":["file","filepath","find","find-pkg-up","find-up","findup","javascript","jonschlinkert","node","nodejs","package","packagejson","pkg","resolve"],"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/jonschlinkert.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}},"created_at":"2015-11-28T03:09:51.000Z","updated_at":"2023-05-27T08:43:20.000Z","dependencies_parsed_at":"2022-09-11T01:10:21.171Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/find-pkg","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ffind-pkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ffind-pkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ffind-pkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Ffind-pkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/find-pkg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252668480,"owners_count":21785678,"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":["file","filepath","find","find-pkg-up","find-up","findup","javascript","jonschlinkert","node","nodejs","package","packagejson","pkg","resolve"],"created_at":"2024-10-03T17:28:21.336Z","updated_at":"2025-05-07T14:24:40.260Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# find-pkg [![NPM version](https://img.shields.io/npm/v/find-pkg.svg?style=flat)](https://www.npmjs.com/package/find-pkg) [![NPM monthly downloads](https://img.shields.io/npm/dm/find-pkg.svg?style=flat)](https://npmjs.org/package/find-pkg) [![NPM total downloads](https://img.shields.io/npm/dt/find-pkg.svg?style=flat)](https://npmjs.org/package/find-pkg) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/find-pkg.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/find-pkg)\n\n\u003e Find the first directory with a package.json, recursing up, starting with the given directory. Similar to look-up but does not support globs and only searches for package.json. Async and sync.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save find-pkg\n```\n\n## Usage\n\n```js\nconst findPkg = require('find-pkg');\n```\n\n**promise**\n\n```js\nfindPkg('a/b/c/some/path')\n  .then(file =\u003e console.log(file)) //=\u003e /User/jonschlinkert/dev/a/b/package.json\n  .catch(console.error);\n```\n\n**async-await**\n\n```js\n(async function() {\n  const file = await findPkg('a/b/c/some/path');\n  console.log(file);\n  //=\u003e '/Users/jonschlinkert/dev/a/b/package.json'\n})();\n```\n\n**callback**\n\n```js\nfindPkg('a/b/c/some/path', function(err, file) {\n  if (err) throw err;\n  console.log(file);\n  //=\u003e '/Users/jonschlinkert/dev/a/b/package.json'\n});\n```\n\n**sync**\n\n```js\nconst file = findPkg.sync('a/b/c/some/path');\n//=\u003e '/Users/jonschlinkert/dev/a/b/package.json'\n```\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [find-file-up](https://www.npmjs.com/package/find-file-up): Find a file fast, by starting at the given cwd and recursing up one directory… [more](https://github.com/jonschlinkert/find-file-up) | [homepage](https://github.com/jonschlinkert/find-file-up \"Find a file fast, by starting at the given cwd and recursing up one directory until the file is found or we run out of directories.\")\n* [findup-sync](https://www.npmjs.com/package/findup-sync): Find the first file matching a given pattern in the current directory or the nearest… [more](https://github.com/js-cli/node-findup-sync#readme) | [homepage](https://github.com/js-cli/node-findup-sync#readme \"Find the first file matching a given pattern in the current directory or the nearest ancestor directory.\")\n* [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules \"The directory used by npm for globally installed npm modules.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 28, 2018._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Ffind-pkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Ffind-pkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Ffind-pkg/lists"}