{"name":"read-data","description":"Read JSON or YAML files.","version":"0.3.0","homepage":"https://github.com/jonschlinkert/read-data","author":{"name":"Jon Schlinkert","url":"http://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/read-data.git"},"bugs":{"url":"https://github.com/jonschlinkert/read-data/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/read-data/blob/master/LICENSE"},"files":["index.js"],"scripts":{"test":"mocha"},"dependencies":{"read-yaml":"^1.0.0"},"devDependencies":{"js-yaml":"^3.2.7","mocha":"^2.2.1","should":"^5.2.0"},"keywords":["async","data","file","fs","json","read","reader","sync","system","yaml"],"gitHead":"441c7836cda224e408a9b92d610419e59ff75f3e","_id":"read-data@0.3.0","_shasum":"7210719238cc21048e88b61b8be721a7cdf7f2da","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7210719238cc21048e88b61b8be721a7cdf7f2da","tarball":"http://registry-npm.ywwl.com/read-data/download/read-data-0.3.0.tgz","integrity":"sha512-JVIQPJF+IRo8LbDVuq/jFwB5B+fURTVR4B3orxQidpN64Lt3Mn+2UZwbyeq3j9LbcGYl4hbCMqr82qSOfsqIOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDp4MgDwbsxsTpjchK40POBdoomds8Hv/OT0tiDjhya3wIhAKfVrxIYuFGaF+HKOqDuWL4jhJpRzZc0Ri59d5l3TNe0"}],"size":3013,"noattachment":false,"key":"/read-data/-/read-data-0.3.0.tgz"},"directories":{},"readme":"# read-data [![NPM version](https://img.shields.io/npm/v/read-data.svg?style=flat)](https://www.npmjs.com/package/read-data) [![NPM monthly downloads](https://img.shields.io/npm/dm/read-data.svg?style=flat)](https://npmjs.org/package/read-data)  [![NPM total downloads](https://img.shields.io/npm/dt/read-data.svg?style=flat)](https://npmjs.org/package/read-data) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/read-data.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/read-data)\n\n> Read JSON or YAML files.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save read-data\n```\n\n**Heads up!**\n\nPlease read the [release history](#history), there were breaking changes in 1.0.0!\n\n## Usage\n\n```js\nvar read = require('read-data');\n\n// sync\nconsole.log(read.sync('foo.yml'));\nconsole.log(read.sync('foo.yaml'));\nconsole.log(read.sync('foo.json'));\n\n// async\nread('foo.yml', function(err, data) {\n  if (err) return console.log(err);\n  console.log(data);\n});\nread('foo.yaml', function(err, data) {\n  if (err) return console.log(err);\n  console.log(data);\n});\nread('foo.json', function(err, data) {\n  if (err) return console.log(err);\n  console.log(data);\n});\n```\n\n## API\n\n### [read](index.js#L41)\n\nAsynchronously read a JSON or YAML file, automatically determining the reader based on extension.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `options` **{Object|String}**: to pass to [js-yaml](https://github.com/nodeca/js-yaml)\n* `cb` **{Function}**: callback function\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar read = require('read-data');\n\nread('foo.json', function(err, data) {\n  if (err) throw err;\n  console.log(data);\n});\n\nread('foo.yml', function(err, data) {\n  if (err) throw err;\n  console.log(data);\n});\n```\n\n### [.sync](index.js#L70)\n\nSynchronously read a `.json` or `.(yaml|yml)` file, automatically determining the reader based on extension.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `options` **{Object|String}**: to pass to [js-yaml](https://github.com/nodeca/js-yaml)\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar data = require('read-data').data;\n\nvar yaml = data.sync('foo.yml');\nvar json = data.sync('foo.json');\n```\n\n### [.yaml](index.js#L96)\n\nAsynchronously read a YAML file.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `options` **{Object|String}**: to pass to [js-yaml](https://github.com/nodeca/js-yaml)\n* `cb` **{Function}**: callback function\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar yaml = require('read-data').yaml;\n\nyaml('foo.yml', function(err, data) {\n  if (err) throw err;\n  console.log(data);\n});\n```\n\n### [.yaml.sync](index.js#L113)\n\nSynchronously read a YAML file.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `options` **{Object|String}**: to pass to [js-yaml](https://github.com/nodeca/js-yaml)\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar yaml = require('read-data').yaml;\nvar data = yaml.sync('foo.yml');\n```\n\n### [.json](index.js#L134)\n\nAsynchronously read a JSON file.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `callback` **{Function}**: callback function\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar json = require('read-data');\n\njson('foo.json', function(err, data) {\n  if (err) throw err;\n  console.log(data);\n});\n```\n\n### [.json.sync](index.js#L166)\n\nSynchronously read a JSON file.\n\n**Params**\n\n* `filepath` **{String}**: path of the file to read.\n* `returns` **{Object}**: JSON\n\n**Example**\n\n```js\nvar json = require('read-data').json;\nvar data = json.sync('foo.json');\n```\n\n## History\n\n### 1.0.0\n\n**Breaking changes**\n\n* The main export is now a function\n* Use `read()` instead of `read.data()`\n* Use `read.sync()` instead of `read.data.sync()`\n\nEverything else is the same.\n\n## About\n\n### Related projects\n\n* [copy](https://www.npmjs.com/package/copy): Copy files or directories using globs. | [homepage](https://github.com/jonschlinkert/copy \"Copy files or directories using globs.\")\n* [read-yaml](https://www.npmjs.com/package/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files. | [homepage](https://github.com/jonschlinkert/read-yaml \"Very thin wrapper around js-yaml for directly reading in YAML files.\")\n* [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write \"Write files to disk, creating intermediate directories if they don't exist.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 14 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 1 | [tunnckoCore](https://github.com/tunnckoCore) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](http://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on April 02, 2017._","publish_time":1427799290714,"_cnpm_publish_time":1427799290714,"dist-tags":{"latest":"1.1.0"}}