{"action":"created","comment":{"url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/comments/108827975","pull_request_review_id":29886513,"id":108827975,"diff_hunk":"@@ -56,8 +56,12 @@ module.exports = function (request, options) {\n \n     function onEnd(err) {\n       if(err) reject(err);\n-      cleanup();\n-      return resolve({fields, files});\n+      Promise.all(filePromises)","path":"index.js","position":22,"original_position":22,"commit_id":"1d3b74cbb6bcc30f468f17fb3607d4ae86c358f7","original_commit_id":"1d3b74cbb6bcc30f468f17fb3607d4ae86c358f7","user":{"login":"dominhhai","id":1484298,"avatar_url":"https://avatars0.githubusercontent.com/u/1484298?v=3","gravatar_id":"","url":"https://api.github.com/users/dominhhai","html_url":"https://github.com/dominhhai","followers_url":"https://api.github.com/users/dominhhai/followers","following_url":"https://api.github.com/users/dominhhai/following{/other_user}","gists_url":"https://api.github.com/users/dominhhai/gists{/gist_id}","starred_url":"https://api.github.com/users/dominhhai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominhhai/subscriptions","organizations_url":"https://api.github.com/users/dominhhai/orgs","repos_url":"https://api.github.com/users/dominhhai/repos","events_url":"https://api.github.com/users/dominhhai/events{/privacy}","received_events_url":"https://api.github.com/users/dominhhai/received_events","type":"User","site_admin":false},"body":"Using `Promise` with empty `filePromises` is slower than `resolve` immediately.\r\nSmt like:\r\n```\r\nif (filePromises.length > 0) {\r\n  return Promise.all(filePromises)\r\n                        .then(files => resolve({fields, files}))\r\n                        .catch(reject)\r\n } else {\r\n  return resolve({fields, files: []})\r\n}\r\n```\r\n","created_at":"2017-03-30T02:11:42Z","updated_at":"2017-03-30T02:11:42Z","html_url":"https://github.com/m4nuC/async-busboy/pull/16#discussion_r108827975","pull_request_url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/comments/108827975"},"html":{"href":"https://github.com/m4nuC/async-busboy/pull/16#discussion_r108827975"},"pull_request":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16","id":113044305,"html_url":"https://github.com/m4nuC/async-busboy/pull/16","diff_url":"https://github.com/m4nuC/async-busboy/pull/16.diff","patch_url":"https://github.com/m4nuC/async-busboy/pull/16.patch","issue_url":"https://api.github.com/repos/m4nuC/async-busboy/issues/16","number":16,"state":"closed","locked":false,"title":"Fix premature creation of file read streams","user":{"login":"christensson","id":3258298,"avatar_url":"https://avatars2.githubusercontent.com/u/3258298?v=3","gravatar_id":"","url":"https://api.github.com/users/christensson","html_url":"https://github.com/christensson","followers_url":"https://api.github.com/users/christensson/followers","following_url":"https://api.github.com/users/christensson/following{/other_user}","gists_url":"https://api.github.com/users/christensson/gists{/gist_id}","starred_url":"https://api.github.com/users/christensson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christensson/subscriptions","organizations_url":"https://api.github.com/users/christensson/orgs","repos_url":"https://api.github.com/users/christensson/repos","events_url":"https://api.github.com/users/christensson/events{/privacy}","received_events_url":"https://api.github.com/users/christensson/received_events","type":"User","site_admin":false},"body":"Read stream now created on the finish event for the\r\nwrite stream to the temp file. The finish event is\r\nemitted once the file is completely flushed.\r\n\r\nAlso, the promise returned from the exported function\r\nisn't resolved until all files have been downloaded.","created_at":"2017-03-28T19:08:09Z","updated_at":"2017-03-30T02:11:42Z","closed_at":"2017-03-29T04:01:12Z","merged_at":"2017-03-29T04:01:12Z","merge_commit_sha":"631b071545eeb49c2f467d2451b03c6b2cd61e76","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16/commits","review_comments_url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16/comments","review_comment_url":"https://api.github.com/repos/m4nuC/async-busboy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m4nuC/async-busboy/issues/16/comments","statuses_url":"https://api.github.com/repos/m4nuC/async-busboy/statuses/1d3b74cbb6bcc30f468f17fb3607d4ae86c358f7","head":{"label":"christensson:fix_premature_stream_create_1","ref":"fix_premature_stream_create_1","sha":"1d3b74cbb6bcc30f468f17fb3607d4ae86c358f7","user":{"login":"christensson","id":3258298,"avatar_url":"https://avatars2.githubusercontent.com/u/3258298?v=3","gravatar_id":"","url":"https://api.github.com/users/christensson","html_url":"https://github.com/christensson","followers_url":"https://api.github.com/users/christensson/followers","following_url":"https://api.github.com/users/christensson/following{/other_user}","gists_url":"https://api.github.com/users/christensson/gists{/gist_id}","starred_url":"https://api.github.com/users/christensson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christensson/subscriptions","organizations_url":"https://api.github.com/users/christensson/orgs","repos_url":"https://api.github.com/users/christensson/repos","events_url":"https://api.github.com/users/christensson/events{/privacy}","received_events_url":"https://api.github.com/users/christensson/received_events","type":"User","site_admin":false},"repo":{"id":86490236,"name":"async-busboy","full_name":"christensson/async-busboy","owner":{"login":"christensson","id":3258298,"avatar_url":"https://avatars2.githubusercontent.com/u/3258298?v=3","gravatar_id":"","url":"https://api.github.com/users/christensson","html_url":"https://github.com/christensson","followers_url":"https://api.github.com/users/christensson/followers","following_url":"https://api.github.com/users/christensson/following{/other_user}","gists_url":"https://api.github.com/users/christensson/gists{/gist_id}","starred_url":"https://api.github.com/users/christensson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christensson/subscriptions","organizations_url":"https://api.github.com/users/christensson/orgs","repos_url":"https://api.github.com/users/christensson/repos","events_url":"https://api.github.com/users/christensson/events{/privacy}","received_events_url":"https://api.github.com/users/christensson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christensson/async-busboy","description":"Promise based multipart form parser for KoaJS","fork":true,"url":"https://api.github.com/repos/christensson/async-busboy","forks_url":"https://api.github.com/repos/christensson/async-busboy/forks","keys_url":"https://api.github.com/repos/christensson/async-busboy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christensson/async-busboy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christensson/async-busboy/teams","hooks_url":"https://api.github.com/repos/christensson/async-busboy/hooks","issue_events_url":"https://api.github.com/repos/christensson/async-busboy/issues/events{/number}","events_url":"https://api.github.com/repos/christensson/async-busboy/events","assignees_url":"https://api.github.com/repos/christensson/async-busboy/assignees{/user}","branches_url":"https://api.github.com/repos/christensson/async-busboy/branches{/branch}","tags_url":"https://api.github.com/repos/christensson/async-busboy/tags","blobs_url":"https://api.github.com/repos/christensson/async-busboy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christensson/async-busboy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christensson/async-busboy/git/refs{/sha}","trees_url":"https://api.github.com/repos/christensson/async-busboy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christensson/async-busboy/statuses/{sha}","languages_url":"https://api.github.com/repos/christensson/async-busboy/languages","stargazers_url":"https://api.github.com/repos/christensson/async-busboy/stargazers","contributors_url":"https://api.github.com/repos/christensson/async-busboy/contributors","subscribers_url":"https://api.github.com/repos/christensson/async-busboy/subscribers","subscription_url":"https://api.github.com/repos/christensson/async-busboy/subscription","commits_url":"https://api.github.com/repos/christensson/async-busboy/commits{/sha}","git_commits_url":"https://api.github.com/repos/christensson/async-busboy/git/commits{/sha}","comments_url":"https://api.github.com/repos/christensson/async-busboy/comments{/number}","issue_comment_url":"https://api.github.com/repos/christensson/async-busboy/issues/comments{/number}","contents_url":"https://api.github.com/repos/christensson/async-busboy/contents/{+path}","compare_url":"https://api.github.com/repos/christensson/async-busboy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christensson/async-busboy/merges","archive_url":"https://api.github.com/repos/christensson/async-busboy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christensson/async-busboy/downloads","issues_url":"https://api.github.com/repos/christensson/async-busboy/issues{/number}","pulls_url":"https://api.github.com/repos/christensson/async-busboy/pulls{/number}","milestones_url":"https://api.github.com/repos/christensson/async-busboy/milestones{/number}","notifications_url":"https://api.github.com/repos/christensson/async-busboy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christensson/async-busboy/labels{/name}","releases_url":"https://api.github.com/repos/christensson/async-busboy/releases{/id}","deployments_url":"https://api.github.com/repos/christensson/async-busboy/deployments","created_at":"2017-03-28T17:51:30Z","updated_at":"2017-03-28T17:51:31Z","pushed_at":"2017-03-28T19:07:12Z","git_url":"git://github.com/christensson/async-busboy.git","ssh_url":"git@github.com:christensson/async-busboy.git","clone_url":"https://github.com/christensson/async-busboy.git","svn_url":"https://github.com/christensson/async-busboy","homepage":"","size":29,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"m4nuC:master","ref":"master","sha":"396f33316ce319e5c1b9bba47346b1e6554bb3a7","user":{"login":"m4nuC","id":1518868,"avatar_url":"https://avatars1.githubusercontent.com/u/1518868?v=3","gravatar_id":"","url":"https://api.github.com/users/m4nuC","html_url":"https://github.com/m4nuC","followers_url":"https://api.github.com/users/m4nuC/followers","following_url":"https://api.github.com/users/m4nuC/following{/other_user}","gists_url":"https://api.github.com/users/m4nuC/gists{/gist_id}","starred_url":"https://api.github.com/users/m4nuC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m4nuC/subscriptions","organizations_url":"https://api.github.com/users/m4nuC/orgs","repos_url":"https://api.github.com/users/m4nuC/repos","events_url":"https://api.github.com/users/m4nuC/events{/privacy}","received_events_url":"https://api.github.com/users/m4nuC/received_events","type":"User","site_admin":false},"repo":{"id":49399491,"name":"async-busboy","full_name":"m4nuC/async-busboy","owner":{"login":"m4nuC","id":1518868,"avatar_url":"https://avatars1.githubusercontent.com/u/1518868?v=3","gravatar_id":"","url":"https://api.github.com/users/m4nuC","html_url":"https://github.com/m4nuC","followers_url":"https://api.github.com/users/m4nuC/followers","following_url":"https://api.github.com/users/m4nuC/following{/other_user}","gists_url":"https://api.github.com/users/m4nuC/gists{/gist_id}","starred_url":"https://api.github.com/users/m4nuC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m4nuC/subscriptions","organizations_url":"https://api.github.com/users/m4nuC/orgs","repos_url":"https://api.github.com/users/m4nuC/repos","events_url":"https://api.github.com/users/m4nuC/events{/privacy}","received_events_url":"https://api.github.com/users/m4nuC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/m4nuC/async-busboy","description":"Promise based multipart form parser for KoaJS","fork":false,"url":"https://api.github.com/repos/m4nuC/async-busboy","forks_url":"https://api.github.com/repos/m4nuC/async-busboy/forks","keys_url":"https://api.github.com/repos/m4nuC/async-busboy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m4nuC/async-busboy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m4nuC/async-busboy/teams","hooks_url":"https://api.github.com/repos/m4nuC/async-busboy/hooks","issue_events_url":"https://api.github.com/repos/m4nuC/async-busboy/issues/events{/number}","events_url":"https://api.github.com/repos/m4nuC/async-busboy/events","assignees_url":"https://api.github.com/repos/m4nuC/async-busboy/assignees{/user}","branches_url":"https://api.github.com/repos/m4nuC/async-busboy/branches{/branch}","tags_url":"https://api.github.com/repos/m4nuC/async-busboy/tags","blobs_url":"https://api.github.com/repos/m4nuC/async-busboy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m4nuC/async-busboy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m4nuC/async-busboy/git/refs{/sha}","trees_url":"https://api.github.com/repos/m4nuC/async-busboy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m4nuC/async-busboy/statuses/{sha}","languages_url":"https://api.github.com/repos/m4nuC/async-busboy/languages","stargazers_url":"https://api.github.com/repos/m4nuC/async-busboy/stargazers","contributors_url":"https://api.github.com/repos/m4nuC/async-busboy/contributors","subscribers_url":"https://api.github.com/repos/m4nuC/async-busboy/subscribers","subscription_url":"https://api.github.com/repos/m4nuC/async-busboy/subscription","commits_url":"https://api.github.com/repos/m4nuC/async-busboy/commits{/sha}","git_commits_url":"https://api.github.com/repos/m4nuC/async-busboy/git/commits{/sha}","comments_url":"https://api.github.com/repos/m4nuC/async-busboy/comments{/number}","issue_comment_url":"https://api.github.com/repos/m4nuC/async-busboy/issues/comments{/number}","contents_url":"https://api.github.com/repos/m4nuC/async-busboy/contents/{+path}","compare_url":"https://api.github.com/repos/m4nuC/async-busboy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m4nuC/async-busboy/merges","archive_url":"https://api.github.com/repos/m4nuC/async-busboy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m4nuC/async-busboy/downloads","issues_url":"https://api.github.com/repos/m4nuC/async-busboy/issues{/number}","pulls_url":"https://api.github.com/repos/m4nuC/async-busboy/pulls{/number}","milestones_url":"https://api.github.com/repos/m4nuC/async-busboy/milestones{/number}","notifications_url":"https://api.github.com/repos/m4nuC/async-busboy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m4nuC/async-busboy/labels{/name}","releases_url":"https://api.github.com/repos/m4nuC/async-busboy/releases{/id}","deployments_url":"https://api.github.com/repos/m4nuC/async-busboy/deployments","created_at":"2016-01-11T03:23:07Z","updated_at":"2017-03-28T20:15:08Z","pushed_at":"2017-03-29T04:09:40Z","git_url":"git://github.com/m4nuC/async-busboy.git","ssh_url":"git@github.com:m4nuC/async-busboy.git","clone_url":"https://github.com/m4nuC/async-busboy.git","svn_url":"https://github.com/m4nuC/async-busboy","homepage":"","size":30,"stargazers_count":59,"watchers_count":59,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":1,"forks":14,"open_issues":1,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16"},"html":{"href":"https://github.com/m4nuC/async-busboy/pull/16"},"issue":{"href":"https://api.github.com/repos/m4nuC/async-busboy/issues/16"},"comments":{"href":"https://api.github.com/repos/m4nuC/async-busboy/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m4nuC/async-busboy/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/m4nuC/async-busboy/statuses/1d3b74cbb6bcc30f468f17fb3607d4ae86c358f7"}}}}
{"actor":{"display_login":"dominhhai"}}