{"action":"created","issue":{"url":"https://api.github.com/repos/bchr02/filejson/issues/4","repository_url":"https://api.github.com/repos/bchr02/filejson","labels_url":"https://api.github.com/repos/bchr02/filejson/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/bchr02/filejson/issues/4/comments","events_url":"https://api.github.com/repos/bchr02/filejson/issues/4/events","html_url":"https://github.com/bchr02/filejson/issues/4","id":178622395,"number":4,"title":"Check me out","user":{"login":"bchr02","id":10158167,"avatar_url":"https://avatars.githubusercontent.com/u/10158167?v=3","gravatar_id":"","url":"https://api.github.com/users/bchr02","html_url":"https://github.com/bchr02","followers_url":"https://api.github.com/users/bchr02/followers","following_url":"https://api.github.com/users/bchr02/following{/other_user}","gists_url":"https://api.github.com/users/bchr02/gists{/gist_id}","starred_url":"https://api.github.com/users/bchr02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bchr02/subscriptions","organizations_url":"https://api.github.com/users/bchr02/orgs","repos_url":"https://api.github.com/users/bchr02/repos","events_url":"https://api.github.com/users/bchr02/events{/privacy}","received_events_url":"https://api.github.com/users/bchr02/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-22T14:16:15Z","updated_at":"2016-09-22T14:30:36Z","closed_at":null,"body":"Hello,\r\n\r\nSince I noticed you have posted in other similar modules I thought I would CC you on this announcement.\r\n\r\nfilejson is a new module that allows you to store a value simply by doing ```file.contents  = value``` and have that and any future changes automatically saved to a JSON file on your drive. This will allow the variable to persist across app restarts. The important difference between this module and others is that you don't have to call a function every time you want to alter your objects value.  So, instead of having to wrap every update in a function/callback and creating a pyramid (aka callback hell):\r\n```javascript\r\nvar jsonfile = require('jsonfile');\r\n\r\nvar file = '/tmp/data.json';\r\nvar obj = {};\r\n\r\njsonfile.writeFile(file, obj, function (err) {\r\n  if(err) {\r\n    console.error(err);\r\n    return;\r\n  }\r\n  obj.msg = \"Hello World!\";\r\n  jsonfile.writeFile(file, obj, function (err) {\r\n    if(err) {\r\n      console.error(err);\r\n      return;\r\n    }\r\n    obj.user = {\"name\": \"Bob\"};\r\n    jsonfile.writeFile(file, obj, function (err) {\r\n      if(err) {\r\n        console.error(err);\r\n        return;\r\n      }\r\n    });\r\n  });\r\n});\r\n```\r\n**With jsonfile you only need to wrap once and that's it:**\r\n```javascript\r\nvar Filejson = require(\"filejson\");\r\nvar f = new Filejson();\r\n\r\nf.load(\"file.json\", function(error, file) {\r\n  if(error) {\r\n    console.error(error);\r\n    return;\r\n  }\r\n  file.contents = {};\r\n  file.contents.msg = \"Hello World!\";\r\n  file.contents.user = {\"name\": \"Bill\"};\r\n});\r\n```\r\n\r\ncc: @pinn3, @tankerkiller125, @hobberwickey, @YounessBenmouloud, @Lazarus118, @sahas, @ajsingh007, @dudleyjosh, @SCBuergel, @kamikazechaser, @Pizylon, @Egoscio, @maxime1992, @bajtos, @piranna, @sampathsris\r\n"},"comment":{"url":"https://api.github.com/repos/bchr02/filejson/issues/comments/248920546","html_url":"https://github.com/bchr02/filejson/issues/4#issuecomment-248920546","issue_url":"https://api.github.com/repos/bchr02/filejson/issues/4","id":248920546,"user":{"login":"piranna","id":532414,"avatar_url":"https://avatars.githubusercontent.com/u/532414?v=3","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T14:30:36Z","updated_at":"2016-09-22T14:30:36Z","body":"The idea is not bad, but I have some questions/tasks for you:\r\n\r\n- How do you manage (or prevent) people inserting random objects with functions or a class?\r\n- What about references cycles?\r\n- How is the performance to access big objects?\r\n- Does it auto-reload when the file changed on the filesystem?\r\n- Why you use a setTimeout() delay instead of write the changes on setInmediate()?"}}
{"actor":{"display_login":"piranna"}}