{"name":"json-updater","version":"1.0.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"],"author":{"name":"Nickie Archua"},"license":"MIT","bugs":{"url":"https://github.com/archuanickie/json-updater/issues"},"homepage":"https://github.com/archuanickie/json-updater#readme","gitHead":"df944fadb78ec4f0ebe6a72b1dcdd5bc43073b64","_id":"json-updater@1.0.0","_shasum":"7ab7b49c4153e22ddd424d89ee6ef1d336cd63d1","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"archuanickie","email":"archuanickie@gmail.com"},"dist":{"shasum":"7ab7b49c4153e22ddd424d89ee6ef1d336cd63d1","tarball":"http://registry-npm.ywwl.com/json-updater/download/json-updater-1.0.0.tgz","integrity":"sha512-RSkE4gmyR0DoRCsLbKsGOUid0UcLThUHncHhttYD27CR58026ltCRSv1s3K9aaO9K7wOr1kp8IT8CKXXmPA4HQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIENJ+es7L9sPnV/R8RQeU6kL++/MDWxKB37b+hObSCLNAiEA0iiNXu/k+MPe9obl7QkhT71XzOgn5RriuCuAuPuDZMU="}],"size":2979,"noattachment":false,"key":"/json-updater/-/json-updater-1.0.0.tgz"},"maintainers":[{"name":"archuanickie","email":"archuanickie@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/json-updater-1.0.0.tgz_1463300831037_0.9959352165460587"},"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":1463300834427,"_cnpm_publish_time":1463300834427,"dist-tags":{"latest":"1.2.0"}}