cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasongin <>
Subject [GitHub] cordova-plugin-file pull request: CB-7862: FileReader reads large ...
Date Tue, 08 Mar 2016 21:35:08 GMT
GitHub user jasongin opened a pull request:

    CB-7862: FileReader reads large files in chunks with progress

    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. 
    The 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).
    The 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.

You can merge this pull request into a Git repository by running:

    $ git pull CB-7862

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #168
commit 30f4a8810586dd048e17311f991a9b29315e7fde
Author: Jason Ginchereau <>
Date:   2016-03-08T21:11:21Z

    CB-7862: FileReader reads large files in chunks with progress


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message