Muqriz 48f16bfc3e initail first | 4 月之前 | |
---|---|---|
.. | ||
index.js | 4 月之前 | |
license | 4 月之前 | |
package.json | 4 月之前 | |
readme.md | 4 月之前 |
Read a package.json file
$ npm install --save read-pkg
const readPkg = require('read-pkg');
readPkg().then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(__dirname).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
readPkg(path.join('unicorn', 'package.json')).then(pkg => {
console.log(pkg);
//=> {name: 'read-pkg', ...}
});
Returns a Promise
for the parsed JSON.
Returns the parsed JSON.
Type: string
Default: .
Path to a package.json
file or its directory.
Type: boolean
Default: true
Normalize the package data.
package.json
fileMIT © Sindre Sorhus