1 # read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg)
3 > Read a package.json file
8 - [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
9 - [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom)
10 - [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
11 - [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
17 $ npm install read-pkg
24 const readPkg = require('read-pkg');
26 readPkg().then(pkg => {
28 //=> {name: 'read-pkg', ...}
31 readPkg(__dirname).then(pkg => {
33 //=> {name: 'read-pkg', ...}
36 readPkg(path.join('unicorn', 'package.json')).then(pkg => {
38 //=> {name: 'read-pkg', ...}
45 ### readPkg([path], [options])
47 Returns a `Promise` for the parsed JSON.
49 ### readPkg.sync([path], [options])
51 Returns the parsed JSON.
56 Default: `process.cwd()`
58 Path to a `package.json` file or its directory.
67 [Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
72 - [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
73 - [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
74 - [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
79 MIT © [Sindre Sorhus](https://sindresorhus.com)