{
  "name": "jsonfile",
  "version": "2.4.0",
  "description": "Easily read/write JSON files.",
  "repository": {
    "type": "git",
    "url": "git@github.com:jprichardson/node-jsonfile.git"
  },
  "keywords": [
    "read",
    "write",
    "file",
    "json",
    "fs",
    "fs-extra"
  ],
  "author": {
    "name": "JP Richardson",
    "email": "jprichardson@gmail.com"
  },
  "license": "MIT",
  "dependencies": {
    "graceful-fs": "^4.1.6"
  },
  "optionalDependencies": {
    "graceful-fs": "^4.1.6"
  },
  "devDependencies": {
    "mocha": "2.x",
    "mock-fs": "^3.8.0",
    "rimraf": "^2.4.0",
    "standard": "^6.0.8"
  },
  "main": "index.js",
  "scripts": {
    "lint": "standard",
    "test": "npm run lint && npm run unit",
    "unit": "mocha"
  },
  "readme": "Node.js - jsonfile\n================\n\nEasily read/write JSON files.\n\n[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile)\n[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.svg)](http://travis-ci.org/jprichardson/node-jsonfile)\n[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master)\n\n<a href=\"https://github.com/feross/standard\"><img src=\"https://cdn.rawgit.com/feross/standard/master/sticker.svg\" alt=\"Standard JavaScript\" width=\"100\"></a>\n\nWhy?\n----\n\nWriting `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying.\n\n\n\nInstallation\n------------\n\n    npm install --save jsonfile\n\n\n\nAPI\n---\n\n### readFile(filename, [options], callback)\n\n`options` (`object`, default `undefined`): Pass in any `fs.readFile` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).\n  - `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback.\n  If `false`, returns `null` for the object.\n\n\n```js\nvar jsonfile = require('jsonfile')\nvar file = '/tmp/data.json'\njsonfile.readFile(file, function(err, obj) {\n  console.dir(obj)\n})\n```\n\n\n### readFileSync(filename, [options])\n\n`options` (`object`, default `undefined`): Pass in any `fs.readFileSync` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). \n- `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, throw the error.\nIf `false`, returns `null` for the object.\n\n```js\nvar jsonfile = require('jsonfile')\nvar file = '/tmp/data.json'\n\nconsole.dir(jsonfile.readFileSync(file))\n```\n\n\n### writeFile(filename, obj, [options], callback)\n\n`options`: Pass in any `fs.writeFile` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.\n\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFile(file, obj, function (err) {\n  console.error(err)\n})\n```\n\n**formatting with spaces:**\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFile(file, obj, {spaces: 2}, function(err) {\n  console.error(err)\n})\n```\n\n\n### writeFileSync(filename, obj, [options])\n\n`options`: Pass in any `fs.writeFileSync` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`.\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFileSync(file, obj)\n```\n\n**formatting with spaces:**\n\n```js\nvar jsonfile = require('jsonfile')\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\njsonfile.writeFileSync(file, obj, {spaces: 2})\n```\n\n\n\n### spaces\n\nGlobal configuration to set spaces to indent JSON files.\n\n**default:** `null`\n\n```js\nvar jsonfile = require('jsonfile')\n\njsonfile.spaces = 4\n\nvar file = '/tmp/data.json'\nvar obj = {name: 'JP'}\n\n// json file has four space indenting now\njsonfile.writeFile(file, obj, function (err) {\n  console.error(err)\n})\n```\n\nNote, it's bound to `this.spaces`. So, if you do this:\n\n```js\nvar myObj = {}\nmyObj.writeJsonSync = jsonfile.writeFileSync\n// => this.spaces = null\n```\n\nCould do the following:\n\n```js\nvar jsonfile = require('jsonfile')\njsonfile.spaces = 4\njsonfile.writeFileSync(file, obj) // will have 4 spaces indentation\n\nvar myCrazyObj = {spaces: 32}\nmyCrazyObj.writeJsonSync = jsonfile.writeFileSync\nmyCrazyObj.writeJsonSync(file, obj) // will have 32 space indentation\nmyCrazyObj.writeJsonSync(file, obj, {spaces: 2}) // will have only 2\n```\n\n\nLicense\n-------\n\n(MIT License)\n\nCopyright 2012-2016, JP Richardson  <jprichardson@gmail.com>\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jprichardson/node-jsonfile/issues"
  },
  "homepage": "https://github.com/jprichardson/node-jsonfile",
  "_id": "jsonfile@2.4.0",
  "_shasum": "3736a2b428b87bbda0cc83b53fa3d633a35c2ae8",
  "_from": "jsonfile@^2.1.0",
  "_resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz"
}
