{"action":"closed","issue":{"url":"https://api.github.com/repos/rsdoiel/stn/issues/7","labels_url":"https://api.github.com/repos/rsdoiel/stn/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/rsdoiel/stn/issues/7/comments","events_url":"https://api.github.com/repos/rsdoiel/stn/issues/7/events","html_url":"https://github.com/rsdoiel/stn/issues/7","id":8097846,"number":7,"title":"parseFile and writeFile","user":{"login":"tttp","id":128426,"avatar_url":"https://avatars.githubusercontent.com/u/128426?v=3","gravatar_id":"","url":"https://api.github.com/users/tttp","html_url":"https://github.com/tttp","followers_url":"https://api.github.com/users/tttp/followers","following_url":"https://api.github.com/users/tttp/following{/other_user}","gists_url":"https://api.github.com/users/tttp/gists{/gist_id}","starred_url":"https://api.github.com/users/tttp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tttp/subscriptions","organizations_url":"https://api.github.com/users/tttp/orgs","repos_url":"https://api.github.com/users/tttp/repos","events_url":"https://api.github.com/users/tttp/events{/privacy}","received_events_url":"https://api.github.com/users/tttp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rsdoiel/stn/labels/Feature%20request","name":"Feature request","color":"e102d8"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rsdoiel/stn/milestones/4","html_url":"https://github.com/rsdoiel/stn/milestones/0.0.9%20(persistence.%20extension%20and%20easier%20of%20integration)","labels_url":"https://api.github.com/repos/rsdoiel/stn/milestones/4/labels","id":209817,"number":4,"title":"0.0.9 (persistence. extension and easier of integration)","description":"Persistence based in running environment.  In an ideal word stn would be smart enough to figure out what environment it was running in and add appropriate features for persisting timesheets (e.g. If you are in a browser use IndexDB or localStorage; if in Mongo store in a collection; if in Node persist to a file, as either simple timesheet notation or JSON blobs or event through a  database connection.).\r\n\r\n","creator":{"login":"rsdoiel","id":169021,"avatar_url":"https://avatars.githubusercontent.com/u/169021?v=3","gravatar_id":"","url":"https://api.github.com/users/rsdoiel","html_url":"https://github.com/rsdoiel","followers_url":"https://api.github.com/users/rsdoiel/followers","following_url":"https://api.github.com/users/rsdoiel/following{/other_user}","gists_url":"https://api.github.com/users/rsdoiel/gists{/gist_id}","starred_url":"https://api.github.com/users/rsdoiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsdoiel/subscriptions","organizations_url":"https://api.github.com/users/rsdoiel/orgs","repos_url":"https://api.github.com/users/rsdoiel/repos","events_url":"https://api.github.com/users/rsdoiel/events{/privacy}","received_events_url":"https://api.github.com/users/rsdoiel/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":3,"state":"open","created_at":"2012-11-08T21:12:53Z","updated_at":"2016-01-07T03:57:44Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2012-11-05T07:03:30Z","updated_at":"2016-01-07T03:57:44Z","closed_at":"2016-01-07T03:57:44Z","body":"Hi,\r\n\r\nPresumably, stn is used from a flat file (will be true in our case), so instead of this \r\n\r\n    text = fs.readFileSync('test-samples/timesheet-1.txt');\r\n    results = stn.parse(text, {normalize_date:true, hours: true, tags: true});\r\n\r\nHaving a (async reading)\r\n\r\n    results = stn.parseFile (fileName, {normalize_date:true, hours: true, tags: true});\r\n\r\nSame for updating the file, instead of\r\n\r\n    }).on(\"end\", function (err) {\r\n      fs.writeFile(\"timesheet.txt\", timesheet.toString(),\r\n\r\nhaving \r\n      timesheet.writeFile(fileName); //filename optional if opened with parseFile\r\n\r\nCan avoid some boilerplate and enforce good practice (eg. async instead of sync)\r\n\r\nWhat do you think?\r\n\r\n"}}