{"action":"created","comment":{"url":"https://api.github.com/repos/opal/opal/pulls/comments/59992346","id":59992346,"diff_hunk":"@@ -3,6 +3,25 @@ class IO\n   SEEK_CUR = 1\n   SEEK_END = 2\n \n+  attr_reader :eof\n+  attr_reader :lineno\n+\n+  def initialize\n+    @eof = false\n+    @lineno = 0\n+  end\n+\n+  def read\n+    if @eof\n+      ''\n+    else\n+      res = File.read(@path)","path":"opal/corelib/io.rb","position":16,"original_position":16,"commit_id":"841af9d1a1f43eb3f0817dfa5ff14169ca5a0d3d","original_commit_id":"841af9d1a1f43eb3f0817dfa5ff14169ca5a0d3d","user":{"login":"elia","id":1051,"avatar_url":"https://avatars.githubusercontent.com/u/1051?v=3","gravatar_id":"","url":"https://api.github.com/users/elia","html_url":"https://github.com/elia","followers_url":"https://api.github.com/users/elia/followers","following_url":"https://api.github.com/users/elia/following{/other_user}","gists_url":"https://api.github.com/users/elia/gists{/gist_id}","starred_url":"https://api.github.com/users/elia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elia/subscriptions","organizations_url":"https://api.github.com/users/elia/orgs","repos_url":"https://api.github.com/users/elia/repos","events_url":"https://api.github.com/users/elia/events{/privacy}","received_events_url":"https://api.github.com/users/elia/received_events","type":"User","site_admin":false},"body":"Yes, that was the idea, but on second though I think `File#read` should be implemented directly in the node specific stdlib additions, i.e. in [this file](https://github.com/opal/opal/blob/master/stdlib/nodejs/file.rb) where `File.read` is already implemented. That's because I realized that reading files isn't very popular in browsers (which is Opal's main target) and the implementation would be node-specific anyway. \r\n\r\nAlso should be pretty straightforward using `fs.readFileSync` which supports all kinds of offset/length parameters: https://nodejs.org/dist/latest-v4.x/docs/api/fs.html#fs_fs_readsync_fd_buffer_offset_length_position\r\n","created_at":"2016-04-17T20:47:39Z","updated_at":"2016-04-17T20:47:39Z","html_url":"https://github.com/opal/opal/pull/1346#discussion_r59992346","pull_request_url":"https://api.github.com/repos/opal/opal/pulls/1346","_links":{"self":{"href":"https://api.github.com/repos/opal/opal/pulls/comments/59992346"},"html":{"href":"https://github.com/opal/opal/pull/1346#discussion_r59992346"},"pull_request":{"href":"https://api.github.com/repos/opal/opal/pulls/1346"}}},"pull_request":{"url":"https://api.github.com/repos/opal/opal/pulls/1346","id":59292089,"html_url":"https://github.com/opal/opal/pull/1346","diff_url":"https://github.com/opal/opal/pull/1346.diff","patch_url":"https://github.com/opal/opal/pull/1346.patch","issue_url":"https://api.github.com/repos/opal/opal/issues/1346","number":1346,"state":"open","locked":false,"title":"Resolves #1332, Implement IO.read method","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"body":"Resolves #1332","created_at":"2016-02-14T10:17:06Z","updated_at":"2016-04-17T20:47:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70396f10d00630b2d873ff6538b581a33cc6a499","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opal/opal/pulls/1346/commits","review_comments_url":"https://api.github.com/repos/opal/opal/pulls/1346/comments","review_comment_url":"https://api.github.com/repos/opal/opal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opal/opal/issues/1346/comments","statuses_url":"https://api.github.com/repos/opal/opal/statuses/841af9d1a1f43eb3f0817dfa5ff14169ca5a0d3d","head":{"label":"Mogztter:issue-1332","ref":"issue-1332","sha":"841af9d1a1f43eb3f0817dfa5ff14169ca5a0d3d","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"repo":{"id":46345257,"name":"opal","full_name":"Mogztter/opal","owner":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mogztter/opal","description":"Ruby to JavaScript compiler","fork":true,"url":"https://api.github.com/repos/Mogztter/opal","forks_url":"https://api.github.com/repos/Mogztter/opal/forks","keys_url":"https://api.github.com/repos/Mogztter/opal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mogztter/opal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mogztter/opal/teams","hooks_url":"https://api.github.com/repos/Mogztter/opal/hooks","issue_events_url":"https://api.github.com/repos/Mogztter/opal/issues/events{/number}","events_url":"https://api.github.com/repos/Mogztter/opal/events","assignees_url":"https://api.github.com/repos/Mogztter/opal/assignees{/user}","branches_url":"https://api.github.com/repos/Mogztter/opal/branches{/branch}","tags_url":"https://api.github.com/repos/Mogztter/opal/tags","blobs_url":"https://api.github.com/repos/Mogztter/opal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mogztter/opal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mogztter/opal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mogztter/opal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mogztter/opal/statuses/{sha}","languages_url":"https://api.github.com/repos/Mogztter/opal/languages","stargazers_url":"https://api.github.com/repos/Mogztter/opal/stargazers","contributors_url":"https://api.github.com/repos/Mogztter/opal/contributors","subscribers_url":"https://api.github.com/repos/Mogztter/opal/subscribers","subscription_url":"https://api.github.com/repos/Mogztter/opal/subscription","commits_url":"https://api.github.com/repos/Mogztter/opal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mogztter/opal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mogztter/opal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mogztter/opal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mogztter/opal/contents/{+path}","compare_url":"https://api.github.com/repos/Mogztter/opal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mogztter/opal/merges","archive_url":"https://api.github.com/repos/Mogztter/opal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mogztter/opal/downloads","issues_url":"https://api.github.com/repos/Mogztter/opal/issues{/number}","pulls_url":"https://api.github.com/repos/Mogztter/opal/pulls{/number}","milestones_url":"https://api.github.com/repos/Mogztter/opal/milestones{/number}","notifications_url":"https://api.github.com/repos/Mogztter/opal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mogztter/opal/labels{/name}","releases_url":"https://api.github.com/repos/Mogztter/opal/releases{/id}","deployments_url":"https://api.github.com/repos/Mogztter/opal/deployments","created_at":"2015-11-17T12:20:08Z","updated_at":"2016-01-23T09:07:14Z","pushed_at":"2016-04-17T13:22:23Z","git_url":"git://github.com/Mogztter/opal.git","ssh_url":"git@github.com:Mogztter/opal.git","clone_url":"https://github.com/Mogztter/opal.git","svn_url":"https://github.com/Mogztter/opal","homepage":"http://opalrb.org","size":11918,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opal:master","ref":"master","sha":"496405320ef81d4c6cad178afef0d902c4a18218","user":{"login":"opal","id":842643,"avatar_url":"https://avatars.githubusercontent.com/u/842643?v=3","gravatar_id":"","url":"https://api.github.com/users/opal","html_url":"https://github.com/opal","followers_url":"https://api.github.com/users/opal/followers","following_url":"https://api.github.com/users/opal/following{/other_user}","gists_url":"https://api.github.com/users/opal/gists{/gist_id}","starred_url":"https://api.github.com/users/opal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opal/subscriptions","organizations_url":"https://api.github.com/users/opal/orgs","repos_url":"https://api.github.com/users/opal/repos","events_url":"https://api.github.com/users/opal/events{/privacy}","received_events_url":"https://api.github.com/users/opal/received_events","type":"Organization","site_admin":false},"repo":{"id":184366,"name":"opal","full_name":"opal/opal","owner":{"login":"opal","id":842643,"avatar_url":"https://avatars.githubusercontent.com/u/842643?v=3","gravatar_id":"","url":"https://api.github.com/users/opal","html_url":"https://github.com/opal","followers_url":"https://api.github.com/users/opal/followers","following_url":"https://api.github.com/users/opal/following{/other_user}","gists_url":"https://api.github.com/users/opal/gists{/gist_id}","starred_url":"https://api.github.com/users/opal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opal/subscriptions","organizations_url":"https://api.github.com/users/opal/orgs","repos_url":"https://api.github.com/users/opal/repos","events_url":"https://api.github.com/users/opal/events{/privacy}","received_events_url":"https://api.github.com/users/opal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opal/opal","description":"Ruby to JavaScript compiler","fork":false,"url":"https://api.github.com/repos/opal/opal","forks_url":"https://api.github.com/repos/opal/opal/forks","keys_url":"https://api.github.com/repos/opal/opal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opal/opal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opal/opal/teams","hooks_url":"https://api.github.com/repos/opal/opal/hooks","issue_events_url":"https://api.github.com/repos/opal/opal/issues/events{/number}","events_url":"https://api.github.com/repos/opal/opal/events","assignees_url":"https://api.github.com/repos/opal/opal/assignees{/user}","branches_url":"https://api.github.com/repos/opal/opal/branches{/branch}","tags_url":"https://api.github.com/repos/opal/opal/tags","blobs_url":"https://api.github.com/repos/opal/opal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opal/opal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opal/opal/git/refs{/sha}","trees_url":"https://api.github.com/repos/opal/opal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opal/opal/statuses/{sha}","languages_url":"https://api.github.com/repos/opal/opal/languages","stargazers_url":"https://api.github.com/repos/opal/opal/stargazers","contributors_url":"https://api.github.com/repos/opal/opal/contributors","subscribers_url":"https://api.github.com/repos/opal/opal/subscribers","subscription_url":"https://api.github.com/repos/opal/opal/subscription","commits_url":"https://api.github.com/repos/opal/opal/commits{/sha}","git_commits_url":"https://api.github.com/repos/opal/opal/git/commits{/sha}","comments_url":"https://api.github.com/repos/opal/opal/comments{/number}","issue_comment_url":"https://api.github.com/repos/opal/opal/issues/comments{/number}","contents_url":"https://api.github.com/repos/opal/opal/contents/{+path}","compare_url":"https://api.github.com/repos/opal/opal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opal/opal/merges","archive_url":"https://api.github.com/repos/opal/opal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opal/opal/downloads","issues_url":"https://api.github.com/repos/opal/opal/issues{/number}","pulls_url":"https://api.github.com/repos/opal/opal/pulls{/number}","milestones_url":"https://api.github.com/repos/opal/opal/milestones{/number}","notifications_url":"https://api.github.com/repos/opal/opal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opal/opal/labels{/name}","releases_url":"https://api.github.com/repos/opal/opal/releases{/id}","deployments_url":"https://api.github.com/repos/opal/opal/deployments","created_at":"2009-04-24T08:53:34Z","updated_at":"2016-04-17T16:08:44Z","pushed_at":"2016-04-17T13:14:15Z","git_url":"git://github.com/opal/opal.git","ssh_url":"git@github.com:opal/opal.git","clone_url":"https://github.com/opal/opal.git","svn_url":"https://github.com/opal/opal","homepage":"https://opal.github.io","size":15117,"stargazers_count":3206,"watchers_count":3206,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":223,"mirror_url":null,"open_issues_count":130,"forks":223,"open_issues":130,"watchers":3206,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opal/opal/pulls/1346"},"html":{"href":"https://github.com/opal/opal/pull/1346"},"issue":{"href":"https://api.github.com/repos/opal/opal/issues/1346"},"comments":{"href":"https://api.github.com/repos/opal/opal/issues/1346/comments"},"review_comments":{"href":"https://api.github.com/repos/opal/opal/pulls/1346/comments"},"review_comment":{"href":"https://api.github.com/repos/opal/opal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opal/opal/pulls/1346/commits"},"statuses":{"href":"https://api.github.com/repos/opal/opal/statuses/841af9d1a1f43eb3f0817dfa5ff14169ca5a0d3d"}}}}