Files
cdnjs/node_modules/fs-extra/node_modules/jsonfile/package.json
T

46 lines
3.1 KiB
JSON

{
"name": "jsonfile",
"version": "1.2.0",
"description": "Easily read/write JSON files.",
"repository": {
"type": "git",
"url": "git@github.com:jprichardson/node-jsonfile.git"
},
"keywords": [
"read",
"write",
"file",
"json"
],
"author": {
"name": "JP Richardson",
"email": "jprichardson@gmail.com"
},
"licenses": [
{
"type": "MIT",
"url": ""
}
],
"dependencies": {},
"devDependencies": {
"testutil": "~0.5.1",
"mocha": "*"
},
"main": "./lib/jsonfile.js",
"scripts": {
"test": "mocha test"
},
"readme": "[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.png)](http://travis-ci.org/jprichardson/node-jsonfile)\n\nNode.js - jsonfile\n================\n\nEasily read/write JSON files. \n\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 jsonfile --save\n\n\n\nAPI\n---\n\n### readFile(filename, [options], callback)\n\n```javascript\nvar jf = require('jsonfile');\nvar util = require('util');\n\nvar file = '/tmp/data.json';\njf.readFile(file, function(err, obj) {\n console.log(util.inspect(obj)); \n});\n```\n\n\n### readFileSync(filename, [options])\n\n```javascript\nvar jf = require('jsonfile');\nvar util = require('util');\n\nvar file = '/tmp/data.json';\n\nconsole.log(util.inspect(jf.readFileSync(file)));\n```\n\n\n### writeFile(filename, [options], callback)\n\n```javascript\nvar jf = require('jsonfile')\n\nvar file = '/tmp/data.json';\nvar obj = {name: 'JP'};\n\njf.writeFile(file, obj, function(err) {\n console.log(err);\n})\n```\n\n### writeFileSync(filename, [options])\n\n```javascript\nvar jf = require('jsonfile')\n\nvar file = '/tmp/data.json';\nvar obj = {name: 'JP'};\n\njf.writeFileSync(file, obj);\n```\n\n\n### spaces\n\nNumber of spaces to indent JSON files. \n\n**default:** 2\n\n```\nvar jf = require('jsonfile');\n\njf.spaces = 4;\n\nvar file = '/tmp/data.json';\nvar obj = {name: 'JP'};\n\njf.writeFile(file, obj, function(err) { //json file has four space indenting now\n console.log(err);\n});\n```\n\n\nContributions\n-------------\n\nIf you contribute to this library, please don't change the version numbers in your pull request.\n\n\n### Contributors\n\n(You can add your name, or I'll add it if you forget)\n\n- [*] [JP Richardson](https://github.com/jprichardson)\n- [2] [Sean O'Dell](https://github.com/seanodell)\n- [1] [Federico Fissore](https://github.com/ffissore)\n- [1] [Ivan McCarthy](https://github.com/imcrthy)\n- [1] [Pablo Vallejo](https://github.com/PabloVallejo)\n\n\nLicense\n-------\n\n(MIT License)\n\nCopyright 2012-2014, JP Richardson <jprichardson@gmail.com>\n\n\n\n\n\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/jprichardson/node-jsonfile/issues"
},
"_id": "jsonfile@1.2.0",
"dist": {
"shasum": "2912bf5eeefa5517209bb10e79ad2dbac6f2b5c0"
},
"_from": "jsonfile@^1.2.0",
"_resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-1.2.0.tgz"
}