{"_id":"write-json","_rev":"14-2792b8b1dc32e58fb51d7c8169391cb0","name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","dist-tags":{"latest":"3.0.1"},"versions":{"0.1.0":{"name":"write-json","description":"Write a JSON to file disk, also creates directories in the dest path if they don't already exist.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/write-json/blob/master/LICENSE-MIT"},"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"_id":"write-json@0.1.0","_shasum":"0699314eff9d71ee3bc523b553ad432e1263bcfc","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"0699314eff9d71ee3bc523b553ad432e1263bcfc","tarball":"https://registry.npmjs.org/write-json/-/write-json-0.1.0.tgz","integrity":"sha512-6brR/6Ww0mMsluBc18W1iwBd1oIvet+I+5VEihEWURCcAMRp9l7agk94E/vWD3ZKlLAzFOcR4kng3NO5cQMQGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFfchfYg6etCF8/p2a88O42EafD7YbVNW/MuKi0CUDWxAiEAuRS+8dn8bwoZE2GfByN84RbGeDdcJ1X5xsvKar1jLuE="}]}},"0.2.0":{"name":"write-json","description":"Write a JSON to file disk, also creates directories in the dest path if they don't already exist.","version":"0.2.0","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/write-json/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"write":"^0.2.0"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"devDependencies":{"delete":"^0.1.5","mocha":"^2.2.1","should":"^5.2.0"},"gitHead":"6108a60c6ea29d34c29361795d66186d6a8524d8","_id":"write-json@0.2.0","_shasum":"b2d49b4ae38b39cd1216ebc64401134e28798a85","_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":"b2d49b4ae38b39cd1216ebc64401134e28798a85","tarball":"https://registry.npmjs.org/write-json/-/write-json-0.2.0.tgz","integrity":"sha512-nXInu5iazYELc9ZvXBnyYxKvvQHn520d/ZB9EIdaazjsXB4K40R7L1YSbbjW4LCT9wyGdqVV+Scw0ks4YGY1Pw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB2laqnHOdNxNo4JFADKl+imkx/2fMV5zVK5bIs0uDOjAiEAztWIlYMPwndOvPDXHVRd716/xCOTnoVsfRsR95G8370="}]}},"0.2.1":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"write":"^0.2.1"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"devDependencies":{"delete":"^0.1.5","mocha":"^2.2.1"},"verb":{"related":{"description":"","list":[]}},"gitHead":"78db1af986afe924814d2cf3984af4d39f111662","_id":"write-json@0.2.1","_shasum":"fd2aed0b274abc9aaf2d8be5497562b52899b489","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"fd2aed0b274abc9aaf2d8be5497562b52899b489","tarball":"https://registry.npmjs.org/write-json/-/write-json-0.2.1.tgz","integrity":"sha512-nkUMpj8sG1c7pUZwXfYNA9NnDoeHSrs+sxH/D262uTRBkbPoK7muqi79K9OJd2nIV3iI4g8O9Sj6Ub94EHLLMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDN/0vZsEqLdS/INVr/0IeEnks8I4XOJZU+RK4cdYdWgQIgS7fxokPOqzi8nh63Y90o/jWqG1MF40CGnN1tNhEzSpY="}]}},"0.2.2":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"0.2.2","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"write":"^0.2.1"},"devDependencies":{"delete":"^0.2.1","mocha":"*"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"verb":{"related":{"list":["delete","write","write-yaml","read-yaml","read-json","read-data"],"description":""}},"gitHead":"3d92ef3cce44e87d3dee9bcf3aab58a164252871","_id":"write-json@0.2.2","_shasum":"fa4e1529e9e763a4f92f07d9841317e3d248daf3","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"fa4e1529e9e763a4f92f07d9841317e3d248daf3","tarball":"https://registry.npmjs.org/write-json/-/write-json-0.2.2.tgz","integrity":"sha512-3HOXDnA8CgyaObzkxKPTHBw0feFlYMn9Mi8ZIrnoNJTTMABn+XOhmTsVlX/P/WeZuXEV9ApvQvR1fpZOOQ5FOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGfwIonf13j7fUXUygl6H4lBGZ8TICayAUPcd4ZnDkZ0AiEAjfqO9A3NKh8vBOLq8bzO22ky/avFGWvQRHrz4IfVIJU="}]}},"1.0.0":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"write":"^0.3.3"},"devDependencies":{"delete":"^0.3.2","gulp-format-md":"^0.1.12","mocha":"^3.2.0"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"verb":{"related":{"list":["delete","read-data","read-json","read-yaml","write","write-yaml"]},"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true}},"gitHead":"d6ff618864e25dfbc8a213366f09acf528859aad","_id":"write-json@1.0.0","_shasum":"9586dbd1d1a76128ddaf6564a2fabe7d7becee30","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"9586dbd1d1a76128ddaf6564a2fabe7d7becee30","tarball":"https://registry.npmjs.org/write-json/-/write-json-1.0.0.tgz","integrity":"sha512-Ws7L0f4FAgAMRu6QpPVdLN/V0yTakQ2bDpKQI33HKIByF1lESyMKIwy0jX41wa7kpqJT9s6Ib/wdA7olb3YlZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCm0Rpr4YFCy4/f0cyl5x8nyPausvLXj03ouWvyImcDVAIhAPTsWM42hNXXlu34OJZH50qZWT8axSS70zyb5nSSd1DJ"}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/write-json-1.0.0.tgz_1492052826564_0.8391058838460594"}},"1.0.1":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"1.0.1","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"write":"^0.3.3"},"devDependencies":{"delete":"^0.3.2","gulp-format-md":"^0.1.12","mocha":"^3.2.0"},"keywords":["file","fs","json","object","package","path","pkg","stringify","write"],"verb":{"related":{"list":["delete","read-data","read-json","read-yaml","write","write-yaml"]},"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true}},"gitHead":"b92b84711c44fff9de289b06bd317c73d2b94223","_id":"write-json@1.0.1","_shasum":"fca6856c9bf2f4f869fae9e2b55574dbdd048627","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"fca6856c9bf2f4f869fae9e2b55574dbdd048627","tarball":"https://registry.npmjs.org/write-json/-/write-json-1.0.1.tgz","integrity":"sha512-giXT5ue6Iiy2iM6ZNUBT1JM9vIPDi3j/u2iS4UOMgplwtk4kli7iR0ZczfYjsLLd8WT+JlY3pdS2yP4qB3WvVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG7IFzKK6OW7L1hxPV2xKzNacw8GYDeLz+WlI7EYAIUTAiEAzRZr2nIsFD87YQ7lgkSgPiBCVaVBNm0mtWcRK6ZIYp0="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/write-json-1.0.1.tgz_1492053366964_0.626362876733765"}},"2.0.0":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"2.0.0","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.1","write":"^1.0.3"},"devDependencies":{"delete":"^1.1.0","gulp-format-md":"^1.0.0","mocha":"^3.4.2"},"keywords":["async","buffer","data","file","file-system","filepath","files","filesystem","folder","format","fs","fs.createWriteStream","fs.writeFile","fs.writeFileSync","json","make-dir","make-dirp","mkdir","mkdirp","object","path","promise","read","stringify","sync","Uint8Array","write"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["delete","read-data","read-yaml","write","write-data","write-yaml"]},"lint":{"reflinks":true}},"gitHead":"c362303b69f127a1cba8dd26ffa38c23be89fe84","_id":"write-json@2.0.0","_npmVersion":"5.2.0","_nodeVersion":"7.7.3","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"integrity":"sha512-NCe2F1HYbBa3DXxA2fpogMz6eKFpYL8dNaukMTzROtynI4Az7mTMYN0cjT00/OMp2NKiOm55eag7qbR9p63r9w==","shasum":"3dde8c39b27b840e87ef8b775aa94c15d4db2091","tarball":"https://registry.npmjs.org/write-json/-/write-json-2.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC85uyUBT86Z3yXCgMF3S/W/3nhq74wj5YkyVes6KuabAiBiZxePa4qP2nqRl0l8TwcMHpXhtAJ0KV9TXcTHkQwbsQ=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/write-json-2.0.0.tgz_1499749566027_0.7340888802427799"}},"3.0.0":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"3.0.0","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.1","write":"^1.0.3"},"devDependencies":{"delete":"^1.1.0","gulp-format-md":"^1.0.0","mocha":"^3.5.3"},"keywords":["async","buffer","data","file","file-system","filepath","files","filesystem","folder","format","fs","fs.createWriteStream","fs.writeFile","fs.writeFileSync","json","make-dir","make-dirp","mkdir","mkdirp","object","path","promise","read","stringify","sync","Uint8Array","write"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["delete","read-data","read-yaml","write","write-data","write-yaml"]},"lint":{"reflinks":true}},"gitHead":"c0a1b08519fcbf68dfc51c281799a6117c6b359f","_id":"write-json@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.1.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"integrity":"sha512-yRZ339OZ14fkeFzAev2lky+ih8bvE9oufM9NLR/TBBtIHSjlD0rg0S1PvoLbQRkgElqoLWEVgWw13mRfZQnybw==","shasum":"3dd9912e68a5409148a710e4bb269dacd84791ef","tarball":"https://registry.npmjs.org/write-json/-/write-json-3.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxVnK98aW/n/okwwdkabRWBKeKd3Hh6YGAHjf58E/xiAiEAuWeLd5ZwIzMSBi/TUfqexkk0MfZl8bdChPZ9LXMUx5M="}]},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/write-json-3.0.0.tgz_1517003529382_0.23875563056208193"}},"3.0.1":{"name":"write-json","description":"Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.","version":"3.0.1","homepage":"https://github.com/jonschlinkert/write-json","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.1","write":"^1.0.3"},"devDependencies":{"delete":"^1.1.0","gulp-format-md":"^1.0.0","mocha":"^3.5.3"},"keywords":["async","buffer","data","file","file-system","filepath","files","filesystem","folder","format","fs","fs.createWriteStream","fs.writeFile","fs.writeFileSync","json","make-dir","make-dirp","mkdir","mkdirp","object","path","promise","read","stringify","sync","Uint8Array","write"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["delete","read-data","read-yaml","write","write-data","write-yaml"]},"lint":{"reflinks":true}},"gitHead":"f7e856b8d1ea3acbea0afff26cb8db7782798936","_id":"write-json@3.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.1.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"integrity":"sha512-PWscN8FOlnT0oSuN3vuq9FW2Wjwh3fqSRFgd75NHiHApIdi55bnbLI5nyFQwaiqEn73+w8B9NVC36SWHCKwHhw==","shasum":"6a5477dd01874e3c6af7e163414609a72d93bf56","tarball":"https://registry.npmjs.org/write-json/-/write-json-3.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFlNbV234uvotpy+81wLD62lhFPSCm8MGwJEhSJ+HrZXAiEAkUZxu/tR0vNwlKCS0Bkn01l1t7upkssEyF2nTWLH+1o="}]},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/write-json-3.0.1.tgz_1517003780331_0.10371464840136468"}}},"readme":"# write-json [![NPM version](https://img.shields.io/npm/v/write-json.svg?style=flat)](https://www.npmjs.com/package/write-json) [![NPM monthly downloads](https://img.shields.io/npm/dm/write-json.svg?style=flat)](https://npmjs.org/package/write-json) [![NPM total downloads](https://img.shields.io/npm/dt/write-json.svg?style=flat)](https://npmjs.org/package/write-json) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/write-json.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/write-json)\n\n> Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save write-json\n```\n\n## Usage\n\n```js\nvar writeJson = require('write-json'); \n\n// async\nwriteJson('foo.json', {abc: 'xyz'}, function(err) {\n  // do stuff with err\n});\n\n// sync\nwriteJson.sync('foo.json', {abc: 'xyz'});\n```\n\n<details>\n<summary><strong>JSON.stringify</strong></summary>\n\n### arguments\n\nAll methods support the same arguments as [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) (note that if you want to pass a [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) function to `writeJson` - the main export, you must pass the replacer on an [options](#options) object)\n\n```js\n// async\nwriteJson('foo.json', {abc: 'xyz'}, null, 2, function(err) {\n  if (err) console.log(err);\n});\n\n// sync\nwriteJson.sync('foo.json', {abc: 'xyz'}, null, 2);\n```\n\n### options\n\nOr as an options object:\n\n```js\nvar options = {\n  replacer: function(key, value) {\n    // filter out properties\n    if (typeof value === 'string') {\n      return undefined;\n    }\n    return value;\n  },\n  indent: 2\n};\n\n// async\nwriteJson('foo.json', {abc: 'xyz'}, options, function(err) {\n  if (err) console.log(err);\n});\n\n// sync\nwriteJson.sync('actual/test.json', expected, options);\n```\n\n</details>\n\n## API\n\n### [writeJson](index.js#L58)\n\nCalls `JSON.stringify` on the given `value` then asynchronously writes the result to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Returns a promise if a callback function is not passed.\n\n**Params**\n\n* `filepath` **{string}**: Destination file path\n* `value` **{object}**: Value to stringify.\n* `options` **{object}**: Options to pass to [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n* `callback` **{Function}**: (optional) If no callback is provided, a promise is returned.\n* `returns` **{undefined}**\n\n**Example**\n\n```js\nvar writeJson = require('write');\nvar pkg = {name: 'write-json'};\n\nwriteJson('foo.json', pkg, function(err) {\n  if (err) console.log(err);\n});\n\n// pass options to JSON.stringify explicitly\nwriteJson('foo.json', pkg, null, 2, function(err) {\n  if (err) console.log(err);\n});\n\n// pass options to JSON.stringify as an object\n// (since this method returns a promise if no callback is passed,\n// if you want to pass a replacer function to JSON.stringify, it\n// must be passed on an options object)\nwriteJson('foo.json', pkg, {\n  indent: 2,\n  replacer: function(value) {\n    // filter out properties\n    if (typeof value === 'string') {\n      return undefined;\n    }\n    return value;\n  }\n}, function(err) {\n  if (err) console.log(err);\n});\n```\n\n### [.promise](index.js#L84)\n\nThe promise version of [writeFile](#writefile). Returns a promise.\n\n**Params**\n\n* `filepath` **{String}**: Destination file path\n* `value` **{any}**: The value to stringify\n* `options` **{object}**: Options to pass to [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n* `returns` **{Promise}**\n\n**Example**\n\n```js\nvar writeJson = require('write');\nwriteJson.promise('package.json', {name: 'write-json'})\n  .then(function() {\n    // do stuff\n  });\n```\n\n### [.sync](index.js#L104)\n\nThe synchronous version of [writeFile](#writefile). Returns undefined.\n\n**Params**\n\n* `filepath` **{String}**: Destination file path\n* `value` **{any}**: The value to stringify\n* `options` **{object}**: Options to pass to [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n* `returns` **{undefined}**\n\n**Example**\n\n```js\nvar writeJson = require('write');\nwriteJson.sync('package.json', {name: 'write-json'});\n```\n\n### [.stream](index.js#L129)\n\nThe stream version of [writeFile](#writefile). Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object.\n\n**Params**\n\n* `filepath` **{string|Buffer|integer}**: filepath or file descriptor.\n* `options` **{object}**: Options to pass to [mkdirp](https://github.com/substack/node-mkdirp) and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options}\n* `returns` **{Stream}**: Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)).\n\n**Example**\n\n```js\nvar fs = require('fs');\nvar writeJson = require('write');\nfs.createReadStream('defaults.json')\n  .pipe(writeJson.stream('package.json'))\n  .on('close', function() {\n    // do stuff\n  });\n```\n\n## Release history\n\n### v2.0.0 - 2017-07-10\n\n**Changed**\n\n* The main function now returns a promise if no callback is passed\n\n**Added**\n\n* adds [promise support](#promise)\n* adds [stream support](#stream)\n\n### v1.0.0 - 2017-04-12\n\n**Fixed**\n\n* Make sure `JSON.stringify` receives all intended arguments\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\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</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\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</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [delete](https://www.npmjs.com/package/delete): Delete files and folders and any intermediate directories if they exist (sync and async). | [homepage](https://github.com/jonschlinkert/delete \"Delete files and folders and any intermediate directories if they exist (sync and async).\")\n* [read-data](https://www.npmjs.com/package/read-data): Read JSON or YAML files. | [homepage](https://github.com/jonschlinkert/read-data \"Read JSON or YAML files.\")\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-data](https://www.npmjs.com/package/write-data): Write a YAML or JSON file to disk. Automatically detects the format to write based… [more](https://github.com/jonschlinkert/write-data) | [homepage](https://github.com/jonschlinkert/write-data \"Write a YAML or JSON file to disk. Automatically detects the format to write based on extension. Or pass `ext` on the options.\")\n* [write-yaml](https://www.npmjs.com/package/write-yaml): Write YAML. Converts JSON to YAML writes it to the specified file. | [homepage](https://github.com/jonschlinkert/write-yaml \"Write YAML. Converts JSON to YAML writes it to the specified file.\")\n* [write](https://www.npmjs.com/package/write): Write data to a file, replacing the file if it already exists and creating any… [more](https://github.com/jonschlinkert/write) | [homepage](https://github.com/jonschlinkert/write \"Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://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.6.0, on January 26, 2018._","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2022-06-29T03:49:46.094Z","created":"2014-12-17T04:59:35.781Z","0.1.0":"2014-12-17T04:59:35.781Z","0.2.0":"2015-04-07T10:17:55.841Z","0.2.1":"2015-10-20T20:44:17.473Z","0.2.2":"2015-11-17T12:25:22.562Z","1.0.0":"2017-04-13T03:07:08.600Z","1.0.1":"2017-04-13T03:16:07.639Z","2.0.0":"2017-07-11T05:06:06.941Z","3.0.0":"2018-01-26T21:52:10.348Z","3.0.1":"2018-01-26T21:56:21.354Z"},"homepage":"https://github.com/jonschlinkert/write-json","keywords":["async","buffer","data","file","file-system","filepath","files","filesystem","folder","format","fs","fs.createWriteStream","fs.writeFile","fs.writeFileSync","json","make-dir","make-dirp","mkdir","mkdirp","object","path","promise","read","stringify","sync","Uint8Array","write"],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/write-json.git"},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"bugs":{"url":"https://github.com/jonschlinkert/write-json/issues"},"license":"MIT","readmeFilename":"README.md","users":{"rshaw":true}}