Pathologic was missing because of a .git folder inside.
[yaffs-website] / node_modules / read-pkg / readme.md
1 # read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg)
2
3 > Read a package.json file
4
5
6 ## Why
7
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)
12
13
14 ## Install
15
16 ```
17 $ npm install --save read-pkg
18 ```
19
20
21 ## Usage
22
23 ```js
24 var readPkg = require('read-pkg');
25
26 readPkg().then(function (pkg) {
27         console.log(pkg);
28         //=> {name: 'read-pkg', ...}
29 });
30
31 readPkg(__dirname).then(function (pkg) {
32         console.log(pkg);
33         //=> {name: 'read-pkg', ...}
34 });
35
36 readPkg(path.join('unicorn', 'package.json')).then(function (pkg) {
37         console.log(pkg);
38         //=> {name: 'read-pkg', ...}
39 });
40 ```
41
42
43 ## API
44
45 ### readPkg([path], [options])
46
47 Returns a promise that resolves to the parsed JSON.
48
49 ### readPkg.sync([path], [options])
50
51 Returns the parsed JSON.
52
53 #### path
54
55 Type: `string`  
56 Default: `.`
57
58 Path to a `package.json` file or its directory.
59
60 #### options
61
62 ##### normalize
63
64 Type: `boolean`  
65 Default: `true`
66
67 [Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
68
69
70 ## Related
71
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
75
76
77 ## License
78
79 MIT © [Sindre Sorhus](http://sindresorhus.com)