You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Cristian Badila (JIRA)" <ji...@apache.org> on 2014/06/04 15:08:01 UTC

[jira] [Created] (CB-6870) Trying to write large binary files throws a stack space exceeded exception on Windows8

Cristian Badila created CB-6870:
-----------------------------------

             Summary: Trying to write large binary files throws a stack space exceeded exception on Windows8
                 Key: CB-6870
                 URL: https://issues.apache.org/jira/browse/CB-6870
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File
    Affects Versions: 3.5.0
            Reporter: Cristian Badila


When trying to write to disk large files using binary mode (tested with files with sizes greater than 100KB) an exception would occur on Windows 8/8.1 - stack space exceeded. This is due to a change introduced in commit #ef636d93cba502a0881bd22abe744d0b9540424c - can be seen easier here: https://github.com/apache/cordova-plugin-file/commit/ef636d93cba502a0881bd22abe744d0b9540424c.

To be more exact the line where the exception would be raised is this one:
bq. data = Array.apply(null, new Uint8Array(data));
Replacing the above line with the following code fixes the issue:
{quote}
        var uint8ArrayView = new Uint8Array(data);
        var plainArray = new Array();
        for (var byteIndex = 0; byteIndex < uint8ArrayView.length; byteIndex++) \{
            plainArray.push(uint8ArrayView\[byteIndex\]);
        \}
        data = plainArray;
{quote}





--
This message was sent by Atlassian JIRA
(v6.2#6252)