Find the closest package.json file
$ npm install pkg-up
/
└── Users
└── sindresorhus
└── foo
├── package.json
└── bar
├── baz
└── example.js
// example.js const pkgUp = require('pkg-up'); (async () => { console.log(await pkgUp()); //=> '/Users/sindresorhus/foo/package.json' })();
Returns a Promise<string> for the filepath, or Promise<null> if it couldn't be found.
Returns the filepath, or null if it couldn't be found.
Type: Object
Type: string
Default: process.cwd()
Directory to start from.
MIT © Sindre Sorhus