[
https://issues.apache.org/jira/browse/CB-13208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138797#comment-16138797
]
ASF GitHub Bot commented on CB-13208:
-------------------------------------
GitHub user salbahra opened a pull request:
https://github.com/apache/cordova-plugin-file/pull/216
CB-13208: (windows) Fix `readAsBinaryString` to only read the requested
range
### Platforms affected
Windows
### What does this PR do?
Change `readAsBinaryString` on `FileReader` for Windows to use a stream
which seeks to the start position and only reads until the requested end
instead of reading the entire file to a buffer then slicing the requested
fragment.
### What testing has been done on this change?
Plugin change has been tested on Windows as that's the only platform
affected.
### Checklist
- [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html)
in the JIRA database
- [X] Commit message follows the format: "CB-3232: (android) Fix bug with
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform
affected.
- [X] Added automated test coverage as appropriate for this change.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Mimeo/cordova-plugin-file master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-file/pull/216.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #216
----
commit 6da561fe7610fa8e4751d1d867a16af75c64019a
Author: Samer Albahra <[email protected]>
Date: 2017-08-23T18:03:01Z
Change `readAsBinaryString` on Windows to use a stream
----
> File plugin on Windows reads entire file into memory when only a small
> fragment is requested on `readAsBinaryString`
> --------------------------------------------------------------------------------------------------------------------
>
> Key: CB-13208
> URL: https://issues.apache.org/jira/browse/CB-13208
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-file
> Affects Versions: 6.5.0
> Environment: All Windows UAP applications
> Reporter: Samer Albahra
>
> `readAsBinaryString` for `FileReader` on Windows is reading the entire file
> to a buffer then slicing the requested fragment causing the app to crash due
> to out of memory errors. It should instead be using a stream which seeks to
> the requested start position and only reads the requested length.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]