{"name":"json-updater","version":"1.1.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":"a70376685e364dcdd3c1f3f94232328b2269f6ca","_id":"json-updater@1.1.0","_shasum":"fe6f0cd51c6521e3ca711b31e999a7440106817a","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"archuanickie","email":"archuanickie@gmail.com"},"dist":{"shasum":"fe6f0cd51c6521e3ca711b31e999a7440106817a","tarball":"http://registry-npm.ywwl.com/json-updater/download/json-updater-1.1.0.tgz","integrity":"sha512-iICfPgTDC390G0BpjHz9IjVo2Nmhn3x7KcYU4DAHE1QyjxYyuFJoDlwdwOaimJ7v0JPX7TPl2V4IlYYwZtsuEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDoGyhdsKUIimr74mp2wJ6qkGusHksF++8Xd/NB9370BAIhAJu57sk3LPVg3B1H+7jhxGn6wqSXlNxiZht6IET4QqhH"}],"size":3006,"noattachment":false,"key":"/json-updater/-/json-updater-1.1.0.tgz"},"maintainers":[{"name":"archuanickie","email":"archuanickie@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/json-updater-1.1.0.tgz_1463302265244_0.8026570656802505"},"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":1463302265784,"_cnpm_publish_time":1463302265784,"dist-tags":{"latest":"1.2.0"}}