{"_id":"json-updater","_rev":"1002698","name":"json-updater","description":"Nodejs insert to json file","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"archuanickie","email":"archuanickie@gmail.com"}],"time":{"modified":"2024-09-09T11:10:29.000Z","created":"2016-05-15T08:27:14.427Z","1.2.0":"2016-05-15T09:07:05.222Z","1.1.0":"2016-05-15T08:51:05.784Z","1.0.0":"2016-05-15T08:27:14.427Z"},"users":{},"author":{"name":"Nickie Archua"},"repository":{"type":"git","url":"git+https://github.com/archuanickie/json-updater.git"},"versions":{"1.2.0":{"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":{},"publish_time":1463303225222,"_cnpm_publish_time":1463303225222},"1.1.0":{"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":{},"publish_time":1463302265784,"_cnpm_publish_time":1463302265784},"1.0.0":{"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":{},"publish_time":1463300834427,"_cnpm_publish_time":1463300834427}},"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","_attachments":{},"homepage":"https://github.com/archuanickie/json-updater#readme","bugs":{"url":"https://github.com/archuanickie/json-updater/issues"},"license":"MIT"}