{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/node-armor-x/pulls/comments/69191783","id":69191783,"diff_hunk":"@@ -0,0 +1,56 @@\n+stream = require('stream')\n+enc = require('./encoding')\n+\n+desired_high_water_mark = 4096\n+calculate_high_water_mark = (input_length) ->\n+  input_length*Math.floor(desired_high_water_mark/input_length)\n+\n+exports.StreamEncoder = class StreamEncoder extends stream.Transform\n+\n+  constructor : (@encoder) ->\n+    @extra = null\n+    @block_size = @encoder.in_block_len\n+    super({highWaterMark : calculate_high_water_mark(@block_size)})\n+\n+  _transform : (chunk, encoding, cb) ->\n+    if @extra\n+      chunk = Buffer.concat([@extra, chunk])\n+      @extra = null\n+\n+    remainder = chunk.length % @block_size\n+    if remainder isnt 0\n+      @extra = chunk.slice(chunk.length-remainder)\n+      chunk = chunk.slice(0, chunk.length-remainder)\n+\n+    @push(@encoder.encode(chunk))\n+    cb()\n+\n+  _flush : (cb) ->\n+    if @extra then @push(@encoder.encode(@extra))\n+    @push(new Buffer(''))","path":"src/stream.iced","position":30,"original_position":30,"commit_id":"b82a647bcb37a6c72a088b969edb499ab008ee30","original_commit_id":"b82a647bcb37a6c72a088b969edb499ab008ee30","user":{"login":"maxtaco","id":866815,"avatar_url":"https://avatars.githubusercontent.com/u/866815?v=3","gravatar_id":"","url":"https://api.github.com/users/maxtaco","html_url":"https://github.com/maxtaco","followers_url":"https://api.github.com/users/maxtaco/followers","following_url":"https://api.github.com/users/maxtaco/following{/other_user}","gists_url":"https://api.github.com/users/maxtaco/gists{/gist_id}","starred_url":"https://api.github.com/users/maxtaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxtaco/subscriptions","organizations_url":"https://api.github.com/users/maxtaco/orgs","repos_url":"https://api.github.com/users/maxtaco/repos","events_url":"https://api.github.com/users/maxtaco/events{/privacy}","received_events_url":"https://api.github.com/users/maxtaco/received_events","type":"User","site_admin":false},"body":"why is this needed? Also, I think it's slightly preferable to do `(new Buffer [])`","created_at":"2016-06-30T19:06:26Z","updated_at":"2016-06-30T19:06:26Z","html_url":"https://github.com/keybase/node-armor-x/pull/2#discussion_r69191783","pull_request_url":"https://api.github.com/repos/keybase/node-armor-x/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/comments/69191783"},"html":{"href":"https://github.com/keybase/node-armor-x/pull/2#discussion_r69191783"},"pull_request":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/node-armor-x/pulls/2","id":75548357,"html_url":"https://github.com/keybase/node-armor-x/pull/2","diff_url":"https://github.com/keybase/node-armor-x/pull/2.diff","patch_url":"https://github.com/keybase/node-armor-x/pull/2.patch","issue_url":"https://api.github.com/repos/keybase/node-armor-x/issues/2","number":2,"state":"open","locked":false,"title":"StreamEncoder/StreamDecoder","user":{"login":"mpcsh","id":2894019,"avatar_url":"https://avatars.githubusercontent.com/u/2894019?v=3","gravatar_id":"","url":"https://api.github.com/users/mpcsh","html_url":"https://github.com/mpcsh","followers_url":"https://api.github.com/users/mpcsh/followers","following_url":"https://api.github.com/users/mpcsh/following{/other_user}","gists_url":"https://api.github.com/users/mpcsh/gists{/gist_id}","starred_url":"https://api.github.com/users/mpcsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpcsh/subscriptions","organizations_url":"https://api.github.com/users/mpcsh/orgs","repos_url":"https://api.github.com/users/mpcsh/repos","events_url":"https://api.github.com/users/mpcsh/events{/privacy}","received_events_url":"https://api.github.com/users/mpcsh/received_events","type":"User","site_admin":false},"body":"Upgraded from proof-of-concept to workable API status. Tests run for files between 1 and 1000 characters long of random numbers. ","created_at":"2016-06-28T20:52:37Z","updated_at":"2016-06-30T19:06:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a90cf9e85442701e4fe1b5befd63fb4726a7d459","assignee":{"login":"mpcsh","id":2894019,"avatar_url":"https://avatars.githubusercontent.com/u/2894019?v=3","gravatar_id":"","url":"https://api.github.com/users/mpcsh","html_url":"https://github.com/mpcsh","followers_url":"https://api.github.com/users/mpcsh/followers","following_url":"https://api.github.com/users/mpcsh/following{/other_user}","gists_url":"https://api.github.com/users/mpcsh/gists{/gist_id}","starred_url":"https://api.github.com/users/mpcsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpcsh/subscriptions","organizations_url":"https://api.github.com/users/mpcsh/orgs","repos_url":"https://api.github.com/users/mpcsh/repos","events_url":"https://api.github.com/users/mpcsh/events{/privacy}","received_events_url":"https://api.github.com/users/mpcsh/received_events","type":"User","site_admin":false},"assignees":[{"login":"mpcsh","id":2894019,"avatar_url":"https://avatars.githubusercontent.com/u/2894019?v=3","gravatar_id":"","url":"https://api.github.com/users/mpcsh","html_url":"https://github.com/mpcsh","followers_url":"https://api.github.com/users/mpcsh/followers","following_url":"https://api.github.com/users/mpcsh/following{/other_user}","gists_url":"https://api.github.com/users/mpcsh/gists{/gist_id}","starred_url":"https://api.github.com/users/mpcsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpcsh/subscriptions","organizations_url":"https://api.github.com/users/mpcsh/orgs","repos_url":"https://api.github.com/users/mpcsh/repos","events_url":"https://api.github.com/users/mpcsh/events{/privacy}","received_events_url":"https://api.github.com/users/mpcsh/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/node-armor-x/pulls/2/commits","review_comments_url":"https://api.github.com/repos/keybase/node-armor-x/pulls/2/comments","review_comment_url":"https://api.github.com/repos/keybase/node-armor-x/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/node-armor-x/issues/2/comments","statuses_url":"https://api.github.com/repos/keybase/node-armor-x/statuses/b82a647bcb37a6c72a088b969edb499ab008ee30","head":{"label":"keybase:streams","ref":"streams","sha":"b82a647bcb37a6c72a088b969edb499ab008ee30","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":44890506,"name":"node-armor-x","full_name":"keybase/node-armor-x","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/node-armor-x","description":"A base-X-encoding library suitable for stream processing","fork":false,"url":"https://api.github.com/repos/keybase/node-armor-x","forks_url":"https://api.github.com/repos/keybase/node-armor-x/forks","keys_url":"https://api.github.com/repos/keybase/node-armor-x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/node-armor-x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/node-armor-x/teams","hooks_url":"https://api.github.com/repos/keybase/node-armor-x/hooks","issue_events_url":"https://api.github.com/repos/keybase/node-armor-x/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/node-armor-x/events","assignees_url":"https://api.github.com/repos/keybase/node-armor-x/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/node-armor-x/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/node-armor-x/tags","blobs_url":"https://api.github.com/repos/keybase/node-armor-x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/node-armor-x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/node-armor-x/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/node-armor-x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/node-armor-x/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/node-armor-x/languages","stargazers_url":"https://api.github.com/repos/keybase/node-armor-x/stargazers","contributors_url":"https://api.github.com/repos/keybase/node-armor-x/contributors","subscribers_url":"https://api.github.com/repos/keybase/node-armor-x/subscribers","subscription_url":"https://api.github.com/repos/keybase/node-armor-x/subscription","commits_url":"https://api.github.com/repos/keybase/node-armor-x/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/node-armor-x/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/node-armor-x/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/node-armor-x/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/node-armor-x/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/node-armor-x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/node-armor-x/merges","archive_url":"https://api.github.com/repos/keybase/node-armor-x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/node-armor-x/downloads","issues_url":"https://api.github.com/repos/keybase/node-armor-x/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/node-armor-x/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/node-armor-x/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/node-armor-x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/node-armor-x/labels{/name}","releases_url":"https://api.github.com/repos/keybase/node-armor-x/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/node-armor-x/deployments","created_at":"2015-10-25T00:29:42Z","updated_at":"2016-06-27T18:41:37Z","pushed_at":"2016-06-30T15:45:05Z","git_url":"git://github.com/keybase/node-armor-x.git","ssh_url":"git@github.com:keybase/node-armor-x.git","clone_url":"https://github.com/keybase/node-armor-x.git","svn_url":"https://github.com/keybase/node-armor-x","homepage":"","size":62,"stargazers_count":2,"watchers_count":2,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"a39071052cf8c0db22aefb6d1de1fac0bfdc46c6","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":44890506,"name":"node-armor-x","full_name":"keybase/node-armor-x","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/node-armor-x","description":"A base-X-encoding library suitable for stream processing","fork":false,"url":"https://api.github.com/repos/keybase/node-armor-x","forks_url":"https://api.github.com/repos/keybase/node-armor-x/forks","keys_url":"https://api.github.com/repos/keybase/node-armor-x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/node-armor-x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/node-armor-x/teams","hooks_url":"https://api.github.com/repos/keybase/node-armor-x/hooks","issue_events_url":"https://api.github.com/repos/keybase/node-armor-x/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/node-armor-x/events","assignees_url":"https://api.github.com/repos/keybase/node-armor-x/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/node-armor-x/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/node-armor-x/tags","blobs_url":"https://api.github.com/repos/keybase/node-armor-x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/node-armor-x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/node-armor-x/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/node-armor-x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/node-armor-x/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/node-armor-x/languages","stargazers_url":"https://api.github.com/repos/keybase/node-armor-x/stargazers","contributors_url":"https://api.github.com/repos/keybase/node-armor-x/contributors","subscribers_url":"https://api.github.com/repos/keybase/node-armor-x/subscribers","subscription_url":"https://api.github.com/repos/keybase/node-armor-x/subscription","commits_url":"https://api.github.com/repos/keybase/node-armor-x/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/node-armor-x/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/node-armor-x/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/node-armor-x/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/node-armor-x/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/node-armor-x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/node-armor-x/merges","archive_url":"https://api.github.com/repos/keybase/node-armor-x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/node-armor-x/downloads","issues_url":"https://api.github.com/repos/keybase/node-armor-x/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/node-armor-x/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/node-armor-x/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/node-armor-x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/node-armor-x/labels{/name}","releases_url":"https://api.github.com/repos/keybase/node-armor-x/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/node-armor-x/deployments","created_at":"2015-10-25T00:29:42Z","updated_at":"2016-06-27T18:41:37Z","pushed_at":"2016-06-30T15:45:05Z","git_url":"git://github.com/keybase/node-armor-x.git","ssh_url":"git@github.com:keybase/node-armor-x.git","clone_url":"https://github.com/keybase/node-armor-x.git","svn_url":"https://github.com/keybase/node-armor-x","homepage":"","size":62,"stargazers_count":2,"watchers_count":2,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/2"},"html":{"href":"https://github.com/keybase/node-armor-x/pull/2"},"issue":{"href":"https://api.github.com/repos/keybase/node-armor-x/issues/2"},"comments":{"href":"https://api.github.com/repos/keybase/node-armor-x/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/node-armor-x/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/node-armor-x/statuses/b82a647bcb37a6c72a088b969edb499ab008ee30"}}}}
{"actor":{"display_login":"maxtaco"}}