{"name":"json-updater","version":"1.2.0","description":"Nodejs insert to json file","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/archuanickie/json-updater.git"},"keywords":["nodejs","jsonfile","json","insert","read","append","object","file","without","rewrite","rewriting","overwrite","overwriting","async","write","createReadStream","createWriteStream","fs"],"author":{"name":"Nickie Archua"},"license":"MIT","bugs":{"url":"https://github.com/archuanickie/json-updater/issues"},"homepage":"https://github.com/archuanickie/json-updater#readme","gitHead":"cc9cada079417ec9e48dab2f8918dc7b976f9c8e","_id":"json-updater@1.2.0","_shasum":"6bde3db44dc0b966cbdce6a7653db95f20b91423","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"archuanickie","email":"archuanickie@gmail.com"},"dist":{"shasum":"6bde3db44dc0b966cbdce6a7653db95f20b91423","tarball":"http://registry-npm.ywwl.com/json-updater/download/json-updater-1.2.0.tgz","integrity":"sha512-W8rU+0G5Txuhza84q1qsu0iNRUF/n2BSgj/kGLWS/3lM6ITJCw0ABtGPCdUZ6b5i8uCebRaZ5o3FeOec04fP1g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFcsJ0j0g5J5iXvG+xX7pUEnHV2/B0DuAncw//enSWD0AiEA8+Bc4j2GAg7NdtlspOgoVOGUkWpTHCRsRVEaeCu8zMg="}],"size":3026,"noattachment":false,"key":"/json-updater/-/json-updater-1.2.0.tgz"},"maintainers":[{"name":"archuanickie","email":"archuanickie@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/json-updater-1.2.0.tgz_1463303222006_0.5692010961938649"},"directories":{},"readme":"# json-updater\n\n\nInserts new object to your json file without overwriting the content.\n\n__why use this?__\n\n`json-updater` __doesn't rewrite__ the whole file but appends the new object to your json file object, which makes it much faster.\n\n\n### installation\n`npm install --save json-updater`\n\n### API\n\n__insert(filename, obj[,space], callback)__\n\n`obj` object(s) to insert\n \n The optional `space` argument formats your `obj`. Default `0` spaces.\n \n _Using default space:_\n ```javascript\n var jsonUpdater = require('json-updater');\n var file = __dirname + '/users.json';\n \n var obj = {\n \t\"1\": {\n    \t\"first_name\": \"Will\",\n        \"last_name\": \"Smith\"\n    }\n };\n \n //you can also insert multiple objects\n var multiObj = {\n \t\"2\": {\n    \t\"first_name\": \"Google\",\n        \"last_name\": \"Chrome\"\n    },\n    \"3\": {\n    \t\"first_name\": \"Mozilla\",\n        \"last_name\": \"Firefox\"\n    },\n    \"arr\": [\n      \"foo\",\n      \"bar\"\n    ]\n }\n \n jsonUpdater.insert(file, obj, function (err) {\n \tif(err) return console.error(err);\n    //-- your code\n });\n```\n \n _With space or tab:_\n \n```javascript\njsonUpdater.insert(file, obj, 1, function (err){\n\tif(err) return console.error(err);\n\t//-- your code here...\n});\n\njsonUpdater.insert(file, obj, '\\t', function (err) {\n\tif(err) return console.error(err);\n    //-- your code here...\n});\n```\n\n__read(filename[,space], callback)__\n\nThe callback gets two arguments `(err, data)` where `data` is the content of the file\n\nThe optional `space` argument formats the `data` from callback.\n\n```javascript\njsonUpdater.read(file, '\\t', function (err, data) {\n\tif(err) return console.log(err);\n    console.log(data);\n});\n```\n","publish_time":1463303225222,"_cnpm_publish_time":1463303225222,"dist-tags":{"latest":"1.2.0"}}