| 
				
					 | 
			3 周之前 | |
|---|---|---|
| .. | ||
| node_modules | 3 周之前 | |
| index.js | 3 周之前 | |
| license | 3 周之前 | |
| package.json | 3 周之前 | |
| readme.md | 3 周之前 | |
Find the closest package.json file
$ npm install --save pkg-up
/
└── Users
    └── sindresorhus
        └── foo
            ├── package.json
            └── bar
                ├── baz
                └── example.js
// example.js
const pkgUp = require('pkg-up');
pkgUp().then(filepath => {
	console.log(filepath);
	//=> '/Users/sindresorhus/foo/package.json'
});
Returns a Promise for either the filepath or null if it could be found.
Returns the filepath or null.
Type: string
Default: process.cwd()
Directory to start from.
MIT © Sindre Sorhus