{"action":"closed","number":168,"pull_request":{"url":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168","id":62140177,"html_url":"https://github.com/apache/cordova-plugin-file/pull/168","diff_url":"https://github.com/apache/cordova-plugin-file/pull/168.diff","patch_url":"https://github.com/apache/cordova-plugin-file/pull/168.patch","issue_url":"https://api.github.com/repos/apache/cordova-plugin-file/issues/168","number":168,"state":"closed","locked":false,"title":"CB-7862: FileReader reads large files in chunks with progress","user":{"login":"jasongin","id":13093042,"avatar_url":"https://avatars.githubusercontent.com/u/13093042?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongin","html_url":"https://github.com/jasongin","followers_url":"https://api.github.com/users/jasongin/followers","following_url":"https://api.github.com/users/jasongin/following{/other_user}","gists_url":"https://api.github.com/users/jasongin/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongin/subscriptions","organizations_url":"https://api.github.com/users/jasongin/orgs","repos_url":"https://api.github.com/users/jasongin/repos","events_url":"https://api.github.com/users/jasongin/events{/privacy}","received_events_url":"https://api.github.com/users/jasongin/received_events","type":"User","site_admin":false},"body":"I added support in FileReader for reading large files in chunks and reporting progress for each chunk. Previously, the Cordova FileReader would always read files as a single chunk (resulting in OOM exceptions for files > 10 MB or so), and would NEVER invoke the onprogress callback. With this change, it's possible to read files with sizes up to the actual available application memory: I have verified with files over 500 MB. \r\n\r\nThe default chunk size of 256 KB is based on some non-scientific timing tests I did: it yields only minor overhead from multiple exec() calls while still providing frequent-enough progress reports for large files. Much smaller chunk sizes could cause large file reads to take significantly longer due to the numerous exec() calls (and progress callbacks).\r\n\r\nThe FileReader.READ_CHUNK_SIZE value is exposed and may be adjusted by app code, though I don't expect that is something that would need to be changed normally so I didn't add it to the plugin documentation. The added test case however does use that capability so that it can verify chunking and progress behavior without having to generate a very large file.\r\n","created_at":"2016-03-08T21:35:04Z","updated_at":"2016-03-10T18:53:55Z","closed_at":"2016-03-10T18:53:55Z","merged_at":null,"merge_commit_sha":"6f543dbbfc8ef7f9ae9f3447c9f57d8384af1ba5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168/commits","review_comments_url":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168/comments","review_comment_url":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/cordova-plugin-file/issues/168/comments","statuses_url":"https://api.github.com/repos/apache/cordova-plugin-file/statuses/30f4a8810586dd048e17311f991a9b29315e7fde","head":{"label":"jasongin:CB-7862","ref":"CB-7862","sha":"30f4a8810586dd048e17311f991a9b29315e7fde","user":{"login":"jasongin","id":13093042,"avatar_url":"https://avatars.githubusercontent.com/u/13093042?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongin","html_url":"https://github.com/jasongin","followers_url":"https://api.github.com/users/jasongin/followers","following_url":"https://api.github.com/users/jasongin/following{/other_user}","gists_url":"https://api.github.com/users/jasongin/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongin/subscriptions","organizations_url":"https://api.github.com/users/jasongin/orgs","repos_url":"https://api.github.com/users/jasongin/repos","events_url":"https://api.github.com/users/jasongin/events{/privacy}","received_events_url":"https://api.github.com/users/jasongin/received_events","type":"User","site_admin":false},"repo":{"id":45263467,"name":"cordova-plugin-file","full_name":"jasongin/cordova-plugin-file","owner":{"login":"jasongin","id":13093042,"avatar_url":"https://avatars.githubusercontent.com/u/13093042?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongin","html_url":"https://github.com/jasongin","followers_url":"https://api.github.com/users/jasongin/followers","following_url":"https://api.github.com/users/jasongin/following{/other_user}","gists_url":"https://api.github.com/users/jasongin/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongin/subscriptions","organizations_url":"https://api.github.com/users/jasongin/orgs","repos_url":"https://api.github.com/users/jasongin/repos","events_url":"https://api.github.com/users/jasongin/events{/privacy}","received_events_url":"https://api.github.com/users/jasongin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasongin/cordova-plugin-file","description":"Mirror of Apache Cordova Plugin file","fork":true,"url":"https://api.github.com/repos/jasongin/cordova-plugin-file","forks_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/forks","keys_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/teams","hooks_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/hooks","issue_events_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/issues/events{/number}","events_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/events","assignees_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/assignees{/user}","branches_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/branches{/branch}","tags_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/tags","blobs_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/statuses/{sha}","languages_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/languages","stargazers_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/stargazers","contributors_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/contributors","subscribers_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/subscribers","subscription_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/subscription","commits_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/contents/{+path}","compare_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/merges","archive_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/downloads","issues_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/issues{/number}","pulls_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/pulls{/number}","milestones_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/milestones{/number}","notifications_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/labels{/name}","releases_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/releases{/id}","deployments_url":"https://api.github.com/repos/jasongin/cordova-plugin-file/deployments","created_at":"2015-10-30T16:37:17Z","updated_at":"2015-10-30T16:37:18Z","pushed_at":"2016-03-09T18:00:45Z","git_url":"git://github.com/jasongin/cordova-plugin-file.git","ssh_url":"git@github.com:jasongin/cordova-plugin-file.git","clone_url":"https://github.com/jasongin/cordova-plugin-file.git","svn_url":"https://github.com/jasongin/cordova-plugin-file","homepage":null,"size":1887,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"apache:master","ref":"master","sha":"68e40437f48aa648e15653d74e007f5dbf5741ec","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":10860599,"name":"cordova-plugin-file","full_name":"apache/cordova-plugin-file","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cordova-plugin-file","description":"Mirror of Apache Cordova Plugin file","fork":false,"url":"https://api.github.com/repos/apache/cordova-plugin-file","forks_url":"https://api.github.com/repos/apache/cordova-plugin-file/forks","keys_url":"https://api.github.com/repos/apache/cordova-plugin-file/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cordova-plugin-file/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cordova-plugin-file/teams","hooks_url":"https://api.github.com/repos/apache/cordova-plugin-file/hooks","issue_events_url":"https://api.github.com/repos/apache/cordova-plugin-file/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cordova-plugin-file/events","assignees_url":"https://api.github.com/repos/apache/cordova-plugin-file/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cordova-plugin-file/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cordova-plugin-file/tags","blobs_url":"https://api.github.com/repos/apache/cordova-plugin-file/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cordova-plugin-file/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cordova-plugin-file/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cordova-plugin-file/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cordova-plugin-file/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cordova-plugin-file/languages","stargazers_url":"https://api.github.com/repos/apache/cordova-plugin-file/stargazers","contributors_url":"https://api.github.com/repos/apache/cordova-plugin-file/contributors","subscribers_url":"https://api.github.com/repos/apache/cordova-plugin-file/subscribers","subscription_url":"https://api.github.com/repos/apache/cordova-plugin-file/subscription","commits_url":"https://api.github.com/repos/apache/cordova-plugin-file/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cordova-plugin-file/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cordova-plugin-file/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cordova-plugin-file/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cordova-plugin-file/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cordova-plugin-file/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cordova-plugin-file/merges","archive_url":"https://api.github.com/repos/apache/cordova-plugin-file/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cordova-plugin-file/downloads","issues_url":"https://api.github.com/repos/apache/cordova-plugin-file/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cordova-plugin-file/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cordova-plugin-file/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cordova-plugin-file/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cordova-plugin-file/labels{/name}","releases_url":"https://api.github.com/repos/apache/cordova-plugin-file/releases{/id}","deployments_url":"https://api.github.com/repos/apache/cordova-plugin-file/deployments","created_at":"2013-06-22T07:00:16Z","updated_at":"2016-03-09T15:14:26Z","pushed_at":"2016-03-10T18:53:50Z","git_url":"git://github.com/apache/cordova-plugin-file.git","ssh_url":"git@github.com:apache/cordova-plugin-file.git","clone_url":"https://github.com/apache/cordova-plugin-file.git","svn_url":"https://github.com/apache/cordova-plugin-file","homepage":null,"size":2399,"stargazers_count":259,"watchers_count":259,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":297,"mirror_url":"git://git.apache.org/cordova-plugin-file.git","open_issues_count":18,"forks":297,"open_issues":18,"watchers":259,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168"},"html":{"href":"https://github.com/apache/cordova-plugin-file/pull/168"},"issue":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/issues/168"},"comments":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/issues/168/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/pulls/168/commits"},"statuses":{"href":"https://api.github.com/repos/apache/cordova-plugin-file/statuses/30f4a8810586dd048e17311f991a9b29315e7fde"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":2,"review_comments":7,"commits":1,"additions":169,"deletions":229,"changed_files":2}}