package
Read a package.json file
npm install read-pkgGitHub-flavored package documentation.
Across all versions, last 30 days.
245,260,061 in 30 days
Runtime metadata.
Tagged topics.
Read a package.json file
npm install read-pkgimport {readPackage} from 'read-pkg';
console.log(await readPackage());
//=> {name: 'read-pkg', …}
console.log(await readPackage({cwd: 'some-other-directory'}));
//=> {name: 'unicorn', …}Returns a Promise<object> with the parsed JSON.
Returns the parsed JSON.
Type: object
Type: URL | string
Default: process.cwd()
Current working directory.
Type: boolean
Default: true
Normalize the package data.
Parses an object or string into JSON.
Type: object | string
An object or a stringified object to be parsed as a package.json.
Type: object
Type: boolean
Default: true
Normalize the package data.
package.json fileEstimated unpacked size across 17 packages.
4.0 MB
Includes dependencies.
^8.3.0
8.3.0
^0.4.0
0.4.1
^8.0.0
9.0.0
2.4.4