Irina Glushko 2389e7160b HW1 done | 3 rokov pred | |
---|---|---|
.. | ||
node_modules | 3 rokov pred | |
index.js | 3 rokov pred | |
license | 3 rokov pred | |
package.json | 3 rokov pred | |
readme.md | 3 rokov pred |
Read a package.json file
$ npm install 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: process.cwd()
Path to a package.json
file or its directory.
Type: boolean
Default: true
Normalize the package data.
package.json
fileMIT © Sindre Sorhus