{"action":"created","comment":{"url":"https://api.github.com/repos/yeoman/generator/pulls/comments/23131493","id":23131493,"diff_hunk":"@@ -0,0 +1,44 @@\n+'use strict';\n+\n+var fs = require('fs');\n+var readChunk = require('read-chunk');\n+var istextorbinary = require('istextorbinary');\n+var dateFormat = require('dateformat');\n+var prettyBytes = require('pretty-bytes');\n+var Table = require('cli-table');\n+\n+module.exports = {\n+  isBinary: function (existingFilePath, newFileContents) {\n+    var existingHeader = readChunk.sync(existingFilePath, 0, 512);\n+    return istextorbinary.isBinarySync(undefined, existingHeader) || istextorbinary.isBinarySync(undefined, newFileContents);\n+  },\n+\n+  diff: function (existingFilePath, newFileContents) {\n+    var existingStat = fs.statSync(existingFilePath);\n+\n+    var table = new Table({\n+      head: ['', 'Existing', 'Replacement', 'Diff']\n+    });\n+\n+    var sizeDiff;\n+    if (existingStat.size > newFileContents.length) {\n+      sizeDiff = '-';\n+    } else {\n+      sizeDiff = '+';\n+    }\n+    sizeDiff += prettyBytes(Math.abs(existingStat.size - newFileContents.length));\n+\n+    table.push(\n+      ['Size',\n+        prettyBytes(existingStat.size),\n+        prettyBytes(newFileContents.length),\n+        sizeDiff],\n+      ['Last modified',\n+        dateFormat(existingStat.mtime),\n+        'N/A',","path":"lib/util/binary-diff.js","position":38,"original_position":38,"commit_id":"f71de02cca1f53ee2e98b661e45c8a2c790fbcf5","original_commit_id":"f71de02cca1f53ee2e98b661e45c8a2c790fbcf5","user":{"login":"Toilal","id":1165758,"avatar_url":"https://avatars.githubusercontent.com/u/1165758?v=3","gravatar_id":"","url":"https://api.github.com/users/Toilal","html_url":"https://github.com/Toilal","followers_url":"https://api.github.com/users/Toilal/followers","following_url":"https://api.github.com/users/Toilal/following{/other_user}","gists_url":"https://api.github.com/users/Toilal/gists{/gist_id}","starred_url":"https://api.github.com/users/Toilal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toilal/subscriptions","organizations_url":"https://api.github.com/users/Toilal/orgs","repos_url":"https://api.github.com/users/Toilal/repos","events_url":"https://api.github.com/users/Toilal/events{/privacy}","received_events_url":"https://api.github.com/users/Toilal/received_events","type":"User","site_admin":false},"body":"The new file is still not created","created_at":"2015-01-18T07:37:19Z","updated_at":"2015-01-18T07:37:19Z","html_url":"https://github.com/yeoman/generator/pull/737#discussion_r23131493","pull_request_url":"https://api.github.com/repos/yeoman/generator/pulls/737","_links":{"self":{"href":"https://api.github.com/repos/yeoman/generator/pulls/comments/23131493"},"html":{"href":"https://github.com/yeoman/generator/pull/737#discussion_r23131493"},"pull_request":{"href":"https://api.github.com/repos/yeoman/generator/pulls/737"}}},"pull_request":{"url":"https://api.github.com/repos/yeoman/generator/pulls/737","id":27554516,"html_url":"https://github.com/yeoman/generator/pull/737","diff_url":"https://github.com/yeoman/generator/pull/737.diff","patch_url":"https://github.com/yeoman/generator/pull/737.patch","issue_url":"https://api.github.com/repos/yeoman/generator/issues/737","number":737,"state":"open","locked":false,"title":"Use a custom diff view for binary files","user":{"login":"Toilal","id":1165758,"avatar_url":"https://avatars.githubusercontent.com/u/1165758?v=3","gravatar_id":"","url":"https://api.github.com/users/Toilal","html_url":"https://github.com/Toilal","followers_url":"https://api.github.com/users/Toilal/followers","following_url":"https://api.github.com/users/Toilal/following{/other_user}","gists_url":"https://api.github.com/users/Toilal/gists{/gist_id}","starred_url":"https://api.github.com/users/Toilal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toilal/subscriptions","organizations_url":"https://api.github.com/users/Toilal/orgs","repos_url":"https://api.github.com/users/Toilal/repos","events_url":"https://api.github.com/users/Toilal/events{/privacy}","received_events_url":"https://api.github.com/users/Toilal/received_events","type":"User","site_admin":false},"body":"Here the binary diff discussed in #736 \r\n\r\nHere's the overview.\r\n\r\n```\r\n conflict gradle-wrapper.jar\r\n? Overwrite gradle-wrapper.jar? show the differences between the old and the new\r\n┌───────────────┬──────────────────────────┬─────────────┬──────┐\r\n│               │ Existing                 │ Replacement │ Diff │\r\n├───────────────┼──────────────────────────┼─────────────┼──────┤\r\n│ Size          │ 51.01 kB                 │ 51.01 kB    │ -2 B │\r\n├───────────────┼──────────────────────────┼─────────────┼──────┤\r\n│ Last modified │ Sat Jan 17 2015 10:03:33 │ N/A         │ N/A  │\r\n└───────────────┴──────────────────────────┴─────────────┴──────┘\r\n? Overwrite gradle-wrapper.jar? (Ynaxdh)\r\n```","created_at":"2015-01-17T09:14:51Z","updated_at":"2015-01-18T07:37:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7b3b11921741b5519104ea82e2f93ad2a3c43f0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yeoman/generator/pulls/737/commits","review_comments_url":"https://api.github.com/repos/yeoman/generator/pulls/737/comments","review_comment_url":"https://api.github.com/repos/yeoman/generator/pulls/comments/{number}","comments_url":"https://api.github.com/repos/yeoman/generator/issues/737/comments","statuses_url":"https://api.github.com/repos/yeoman/generator/statuses/f71de02cca1f53ee2e98b661e45c8a2c790fbcf5","head":{"label":"Toilal:feat/binary-diff","ref":"feat/binary-diff","sha":"f71de02cca1f53ee2e98b661e45c8a2c790fbcf5","user":{"login":"Toilal","id":1165758,"avatar_url":"https://avatars.githubusercontent.com/u/1165758?v=3","gravatar_id":"","url":"https://api.github.com/users/Toilal","html_url":"https://github.com/Toilal","followers_url":"https://api.github.com/users/Toilal/followers","following_url":"https://api.github.com/users/Toilal/following{/other_user}","gists_url":"https://api.github.com/users/Toilal/gists{/gist_id}","starred_url":"https://api.github.com/users/Toilal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toilal/subscriptions","organizations_url":"https://api.github.com/users/Toilal/orgs","repos_url":"https://api.github.com/users/Toilal/repos","events_url":"https://api.github.com/users/Toilal/events{/privacy}","received_events_url":"https://api.github.com/users/Toilal/received_events","type":"User","site_admin":false},"repo":{"id":29338346,"name":"generator","full_name":"Toilal/generator","owner":{"login":"Toilal","id":1165758,"avatar_url":"https://avatars.githubusercontent.com/u/1165758?v=3","gravatar_id":"","url":"https://api.github.com/users/Toilal","html_url":"https://github.com/Toilal","followers_url":"https://api.github.com/users/Toilal/followers","following_url":"https://api.github.com/users/Toilal/following{/other_user}","gists_url":"https://api.github.com/users/Toilal/gists{/gist_id}","starred_url":"https://api.github.com/users/Toilal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toilal/subscriptions","organizations_url":"https://api.github.com/users/Toilal/orgs","repos_url":"https://api.github.com/users/Toilal/repos","events_url":"https://api.github.com/users/Toilal/events{/privacy}","received_events_url":"https://api.github.com/users/Toilal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Toilal/generator","description":"Rails-inspired generator system that provides scaffolding for your apps","fork":true,"url":"https://api.github.com/repos/Toilal/generator","forks_url":"https://api.github.com/repos/Toilal/generator/forks","keys_url":"https://api.github.com/repos/Toilal/generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Toilal/generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Toilal/generator/teams","hooks_url":"https://api.github.com/repos/Toilal/generator/hooks","issue_events_url":"https://api.github.com/repos/Toilal/generator/issues/events{/number}","events_url":"https://api.github.com/repos/Toilal/generator/events","assignees_url":"https://api.github.com/repos/Toilal/generator/assignees{/user}","branches_url":"https://api.github.com/repos/Toilal/generator/branches{/branch}","tags_url":"https://api.github.com/repos/Toilal/generator/tags","blobs_url":"https://api.github.com/repos/Toilal/generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Toilal/generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Toilal/generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/Toilal/generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Toilal/generator/statuses/{sha}","languages_url":"https://api.github.com/repos/Toilal/generator/languages","stargazers_url":"https://api.github.com/repos/Toilal/generator/stargazers","contributors_url":"https://api.github.com/repos/Toilal/generator/contributors","subscribers_url":"https://api.github.com/repos/Toilal/generator/subscribers","subscription_url":"https://api.github.com/repos/Toilal/generator/subscription","commits_url":"https://api.github.com/repos/Toilal/generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/Toilal/generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/Toilal/generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/Toilal/generator/issues/comments/{number}","contents_url":"https://api.github.com/repos/Toilal/generator/contents/{+path}","compare_url":"https://api.github.com/repos/Toilal/generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Toilal/generator/merges","archive_url":"https://api.github.com/repos/Toilal/generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Toilal/generator/downloads","issues_url":"https://api.github.com/repos/Toilal/generator/issues{/number}","pulls_url":"https://api.github.com/repos/Toilal/generator/pulls{/number}","milestones_url":"https://api.github.com/repos/Toilal/generator/milestones{/number}","notifications_url":"https://api.github.com/repos/Toilal/generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Toilal/generator/labels{/name}","releases_url":"https://api.github.com/repos/Toilal/generator/releases{/id}","created_at":"2015-01-16T07:52:05Z","updated_at":"2015-01-16T07:52:05Z","pushed_at":"2015-01-18T07:28:06Z","git_url":"git://github.com/Toilal/generator.git","ssh_url":"git@github.com:Toilal/generator.git","clone_url":"https://github.com/Toilal/generator.git","svn_url":"https://github.com/Toilal/generator","homepage":"http://yeoman.io","size":5454,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yeoman:master","ref":"master","sha":"697ecb242c5594041a5bfbce3e8c800eb0177abb","user":{"login":"yeoman","id":1714870,"avatar_url":"https://avatars.githubusercontent.com/u/1714870?v=3","gravatar_id":"","url":"https://api.github.com/users/yeoman","html_url":"https://github.com/yeoman","followers_url":"https://api.github.com/users/yeoman/followers","following_url":"https://api.github.com/users/yeoman/following{/other_user}","gists_url":"https://api.github.com/users/yeoman/gists{/gist_id}","starred_url":"https://api.github.com/users/yeoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeoman/subscriptions","organizations_url":"https://api.github.com/users/yeoman/orgs","repos_url":"https://api.github.com/users/yeoman/repos","events_url":"https://api.github.com/users/yeoman/events{/privacy}","received_events_url":"https://api.github.com/users/yeoman/received_events","type":"Organization","site_admin":false},"repo":{"id":5151909,"name":"generator","full_name":"yeoman/generator","owner":{"login":"yeoman","id":1714870,"avatar_url":"https://avatars.githubusercontent.com/u/1714870?v=3","gravatar_id":"","url":"https://api.github.com/users/yeoman","html_url":"https://github.com/yeoman","followers_url":"https://api.github.com/users/yeoman/followers","following_url":"https://api.github.com/users/yeoman/following{/other_user}","gists_url":"https://api.github.com/users/yeoman/gists{/gist_id}","starred_url":"https://api.github.com/users/yeoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeoman/subscriptions","organizations_url":"https://api.github.com/users/yeoman/orgs","repos_url":"https://api.github.com/users/yeoman/repos","events_url":"https://api.github.com/users/yeoman/events{/privacy}","received_events_url":"https://api.github.com/users/yeoman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yeoman/generator","description":"Rails-inspired generator system that provides scaffolding for your apps","fork":false,"url":"https://api.github.com/repos/yeoman/generator","forks_url":"https://api.github.com/repos/yeoman/generator/forks","keys_url":"https://api.github.com/repos/yeoman/generator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yeoman/generator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yeoman/generator/teams","hooks_url":"https://api.github.com/repos/yeoman/generator/hooks","issue_events_url":"https://api.github.com/repos/yeoman/generator/issues/events{/number}","events_url":"https://api.github.com/repos/yeoman/generator/events","assignees_url":"https://api.github.com/repos/yeoman/generator/assignees{/user}","branches_url":"https://api.github.com/repos/yeoman/generator/branches{/branch}","tags_url":"https://api.github.com/repos/yeoman/generator/tags","blobs_url":"https://api.github.com/repos/yeoman/generator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yeoman/generator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yeoman/generator/git/refs{/sha}","trees_url":"https://api.github.com/repos/yeoman/generator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yeoman/generator/statuses/{sha}","languages_url":"https://api.github.com/repos/yeoman/generator/languages","stargazers_url":"https://api.github.com/repos/yeoman/generator/stargazers","contributors_url":"https://api.github.com/repos/yeoman/generator/contributors","subscribers_url":"https://api.github.com/repos/yeoman/generator/subscribers","subscription_url":"https://api.github.com/repos/yeoman/generator/subscription","commits_url":"https://api.github.com/repos/yeoman/generator/commits{/sha}","git_commits_url":"https://api.github.com/repos/yeoman/generator/git/commits{/sha}","comments_url":"https://api.github.com/repos/yeoman/generator/comments{/number}","issue_comment_url":"https://api.github.com/repos/yeoman/generator/issues/comments/{number}","contents_url":"https://api.github.com/repos/yeoman/generator/contents/{+path}","compare_url":"https://api.github.com/repos/yeoman/generator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yeoman/generator/merges","archive_url":"https://api.github.com/repos/yeoman/generator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yeoman/generator/downloads","issues_url":"https://api.github.com/repos/yeoman/generator/issues{/number}","pulls_url":"https://api.github.com/repos/yeoman/generator/pulls{/number}","milestones_url":"https://api.github.com/repos/yeoman/generator/milestones{/number}","notifications_url":"https://api.github.com/repos/yeoman/generator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yeoman/generator/labels{/name}","releases_url":"https://api.github.com/repos/yeoman/generator/releases{/id}","created_at":"2012-07-23T13:07:31Z","updated_at":"2015-01-18T07:22:13Z","pushed_at":"2015-01-18T07:22:13Z","git_url":"git://github.com/yeoman/generator.git","ssh_url":"git@github.com:yeoman/generator.git","clone_url":"https://github.com/yeoman/generator.git","svn_url":"https://github.com/yeoman/generator","homepage":"http://yeoman.io","size":5454,"stargazers_count":484,"watchers_count":484,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":180,"mirror_url":null,"open_issues_count":31,"forks":180,"open_issues":31,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yeoman/generator/pulls/737"},"html":{"href":"https://github.com/yeoman/generator/pull/737"},"issue":{"href":"https://api.github.com/repos/yeoman/generator/issues/737"},"comments":{"href":"https://api.github.com/repos/yeoman/generator/issues/737/comments"},"review_comments":{"href":"https://api.github.com/repos/yeoman/generator/pulls/737/comments"},"review_comment":{"href":"https://api.github.com/repos/yeoman/generator/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/yeoman/generator/pulls/737/commits"},"statuses":{"href":"https://api.github.com/repos/yeoman/generator/statuses/f71de02cca1f53ee2e98b661e45c8a2c790fbcf5"}}}}