Initial commit
[yaffs-website] / node_modules / load-json-file / readme.md
1 # load-json-file [![Build Status](https://travis-ci.org/sindresorhus/load-json-file.svg?branch=master)](https://travis-ci.org/sindresorhus/load-json-file)
2
3 > Read and parse a JSON file
4
5 [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom), uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs), and throws more [helpful JSON errors](https://github.com/sindresorhus/parse-json).
6
7
8 ## Install
9
10 ```
11 $ npm install --save load-json-file
12 ```
13
14
15 ## Usage
16
17 ```js
18 const loadJsonFile = require('load-json-file');
19
20 loadJsonFile('foo.json').then(json => {
21         console.log(json);
22         //=> {foo: true}
23 });
24 ```
25
26
27 ## API
28
29 ### loadJsonFile(filepath)
30
31 Returns a promise that resolves to the parsed JSON.
32
33 ### loadJsonFile.sync(filepath)
34
35 Returns the parsed JSON.
36
37
38 ## Related
39
40 - [write-json-file](https://github.com/sindresorhus/write-json-file) - Stringify and write JSON to a file atomically
41
42
43 ## License
44
45 MIT © [Sindre Sorhus](http://sindresorhus.com)