{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/comments/77074296","id":77074296,"diff_hunk":"@@ -20,28 +28,42 @@ exports.ChunkStream = class ChunkStream extends stream.Transform\n     # if we don't have a full block, dump everything into extra and skip this round\n     if chunk.length < @block_size\n       @extra = chunk\n-    else\n-      # if we have to, call the transform function multiple times until we have less than a block size remaining\n-      if @exact_chunking\n-        while chunk.length >= @block_size\n-          @push(@transform_func(chunk[...@block_size]))\n-          chunk = chunk[@block_size...]\n-        @extra = chunk\n-      # if the transform function can accept chunks of length block_size*n for n \\in N, just make one transform function call\n-      else\n-        remainder = chunk.length % @block_size\n-        # chop off extra\n-        if remainder isnt 0\n-          @extra = chunk[chunk.length-remainder...]\n-          chunk = chunk[...chunk.length-remainder]\n-        @push(@transform_func(chunk))\n-\n-    cb()\n+      return cb(null, new Buffer(''))\n+\n+    # next, mangle the chunk so that it is an even multiple of the block size\n+    remainder = chunk.length % @block_size\n+    if remainder isnt 0\n+      @extra = chunk[chunk.length-remainder...]\n+      chunk = chunk[...chunk.length-remainder]\n+\n+    # finally, process the chunk (guaranteed to be the correct length)\n+    esc = make_esc(cb, \"Failed to transform the chunk\")\n+    await @_transform_chunk(chunk, esc(defer(out)))\n+    cb(null, out)\n+\n+\n+  # this is to be overridden by subclasses who want to output something else after the chunking is over\n+  _flush_append : (cb) ->","path":"src/chunk-stream.iced","position":69,"original_position":69,"commit_id":"02ae1dd378bcd521bcdccf491aab795f8d4d1ba2","original_commit_id":"02ae1dd378bcd521bcdccf491aab795f8d4d1ba2","user":{"login":"oconnor663","id":860932,"avatar_url":"https://avatars.githubusercontent.com/u/860932?v=3","gravatar_id":"","url":"https://api.github.com/users/oconnor663","html_url":"https://github.com/oconnor663","followers_url":"https://api.github.com/users/oconnor663/followers","following_url":"https://api.github.com/users/oconnor663/following{/other_user}","gists_url":"https://api.github.com/users/oconnor663/gists{/gist_id}","starred_url":"https://api.github.com/users/oconnor663/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oconnor663/subscriptions","organizations_url":"https://api.github.com/users/oconnor663/orgs","repos_url":"https://api.github.com/users/oconnor663/repos","events_url":"https://api.github.com/users/oconnor663/events{/privacy}","received_events_url":"https://api.github.com/users/oconnor663/received_events","type":"User","site_admin":false},"body":"Should we have a similar contract for `prepend`? Symmetry here might make sense.","created_at":"2016-08-31T21:11:14Z","updated_at":"2016-08-31T21:11:14Z","html_url":"https://github.com/keybase/node-chunk-stream/pull/2#discussion_r77074296","pull_request_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/comments/77074296"},"html":{"href":"https://github.com/keybase/node-chunk-stream/pull/2#discussion_r77074296"},"pull_request":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2","id":83155195,"html_url":"https://github.com/keybase/node-chunk-stream/pull/2","diff_url":"https://github.com/keybase/node-chunk-stream/pull/2.diff","patch_url":"https://github.com/keybase/node-chunk-stream/pull/2.patch","issue_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/2","number":2,"state":"open","locked":false,"title":"Improved error handling, simpler _transform function","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":"Using callbacks and the `iced-error` short-circuiter pattern, major refactor of `_transform`","created_at":"2016-08-29T19:41:52Z","updated_at":"2016-08-31T21:11:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7870887a87a122a0b5b151553d55290a4c6a8d59","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2/commits","review_comments_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2/comments","review_comment_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/2/comments","statuses_url":"https://api.github.com/repos/keybase/node-chunk-stream/statuses/02ae1dd378bcd521bcdccf491aab795f8d4d1ba2","head":{"label":"keybase:mark/CORE-3647","ref":"mark/CORE-3647","sha":"02ae1dd378bcd521bcdccf491aab795f8d4d1ba2","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":62661488,"name":"node-chunk-stream","full_name":"keybase/node-chunk-stream","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-chunk-stream","description":"base class for chunked node streams","fork":false,"url":"https://api.github.com/repos/keybase/node-chunk-stream","forks_url":"https://api.github.com/repos/keybase/node-chunk-stream/forks","keys_url":"https://api.github.com/repos/keybase/node-chunk-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/node-chunk-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/node-chunk-stream/teams","hooks_url":"https://api.github.com/repos/keybase/node-chunk-stream/hooks","issue_events_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/node-chunk-stream/events","assignees_url":"https://api.github.com/repos/keybase/node-chunk-stream/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/node-chunk-stream/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/node-chunk-stream/tags","blobs_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/node-chunk-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/node-chunk-stream/languages","stargazers_url":"https://api.github.com/repos/keybase/node-chunk-stream/stargazers","contributors_url":"https://api.github.com/repos/keybase/node-chunk-stream/contributors","subscribers_url":"https://api.github.com/repos/keybase/node-chunk-stream/subscribers","subscription_url":"https://api.github.com/repos/keybase/node-chunk-stream/subscription","commits_url":"https://api.github.com/repos/keybase/node-chunk-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/node-chunk-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/node-chunk-stream/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/node-chunk-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/node-chunk-stream/merges","archive_url":"https://api.github.com/repos/keybase/node-chunk-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/node-chunk-stream/downloads","issues_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/node-chunk-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/node-chunk-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/node-chunk-stream/labels{/name}","releases_url":"https://api.github.com/repos/keybase/node-chunk-stream/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/node-chunk-stream/deployments","created_at":"2016-07-05T18:52:53Z","updated_at":"2016-08-22T14:55:15Z","pushed_at":"2016-08-31T18:19:08Z","git_url":"git://github.com/keybase/node-chunk-stream.git","ssh_url":"git@github.com:keybase/node-chunk-stream.git","clone_url":"https://github.com/keybase/node-chunk-stream.git","svn_url":"https://github.com/keybase/node-chunk-stream","homepage":null,"size":235,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":0,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"0596b75ac2fdee6e8e9fb6e98167793662464c99","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":62661488,"name":"node-chunk-stream","full_name":"keybase/node-chunk-stream","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-chunk-stream","description":"base class for chunked node streams","fork":false,"url":"https://api.github.com/repos/keybase/node-chunk-stream","forks_url":"https://api.github.com/repos/keybase/node-chunk-stream/forks","keys_url":"https://api.github.com/repos/keybase/node-chunk-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/node-chunk-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/node-chunk-stream/teams","hooks_url":"https://api.github.com/repos/keybase/node-chunk-stream/hooks","issue_events_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/node-chunk-stream/events","assignees_url":"https://api.github.com/repos/keybase/node-chunk-stream/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/node-chunk-stream/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/node-chunk-stream/tags","blobs_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/node-chunk-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/node-chunk-stream/languages","stargazers_url":"https://api.github.com/repos/keybase/node-chunk-stream/stargazers","contributors_url":"https://api.github.com/repos/keybase/node-chunk-stream/contributors","subscribers_url":"https://api.github.com/repos/keybase/node-chunk-stream/subscribers","subscription_url":"https://api.github.com/repos/keybase/node-chunk-stream/subscription","commits_url":"https://api.github.com/repos/keybase/node-chunk-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/node-chunk-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/node-chunk-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/node-chunk-stream/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/node-chunk-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/node-chunk-stream/merges","archive_url":"https://api.github.com/repos/keybase/node-chunk-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/node-chunk-stream/downloads","issues_url":"https://api.github.com/repos/keybase/node-chunk-stream/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/node-chunk-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/node-chunk-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/node-chunk-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/node-chunk-stream/labels{/name}","releases_url":"https://api.github.com/repos/keybase/node-chunk-stream/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/node-chunk-stream/deployments","created_at":"2016-07-05T18:52:53Z","updated_at":"2016-08-22T14:55:15Z","pushed_at":"2016-08-31T18:19:08Z","git_url":"git://github.com/keybase/node-chunk-stream.git","ssh_url":"git@github.com:keybase/node-chunk-stream.git","clone_url":"https://github.com/keybase/node-chunk-stream.git","svn_url":"https://github.com/keybase/node-chunk-stream","homepage":null,"size":235,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2"},"html":{"href":"https://github.com/keybase/node-chunk-stream/pull/2"},"issue":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/issues/2"},"comments":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/node-chunk-stream/statuses/02ae1dd378bcd521bcdccf491aab795f8d4d1ba2"}}}}
{"actor":{"display_login":"oconnor663"}}