1

I try to download data which is more than 5M. while downloading it is showing network error but for the small set of data it is working fine(in CSV and JSON formats) Code:

var downloadElement       = document.createElement("a");
downloadElement.className = "heatmap-download";
downloadElement.target    = "_blank";
downloadElement.download  = fname;

var results = [];
// Rows and columns are lists
rows.forEach(function(item, index) {
    var tcolxToken = item,
        mean    = meanData[index],
        std     = stdData[index];

    columns.forEach(function(innerItem, innerIndex) {

        var Association = heatmapMatrix[index][innerIndex];
        var newRow = {
            token         : tcolxToken,
            entity_type   : innerItem,
            distance      : Association,
            mean          : mean,
            standard      : std
       };

       results.push(newRow);
   });
});

var jsonData = {"result": results};
downloadElement.href = contentType +
               encodeURIComponent(JSON.stringify(jsonData));
downloadElement.click();

enter image description here

himabindu
  • 336
  • 3
  • 15
  • 3
    Hi, can you post the error? – Stefan Mar 07 '18 at 11:14
  • Basically it depends. We need a lot more information here. what does the HTTP look like? – Liam Mar 07 '18 at 11:20
  • That's a network error, nothing to do with Javascript at all. something on the network, whether that's your proxy or the host server of whatever you calling, etc. has error'd and/or blocked this. If you hit the url directly I'd imagine you'd get the same problem? – Liam Mar 07 '18 at 11:20
  • What exactly is that a screen shot of? Why does it say download? – Liam Mar 07 '18 at 11:23
  • Hi, I see you posted the error. If you open your development options in your brwoser (usually by hitting F12), you'll see a tab: `Network`. I should provide more information about the error. Can you give us those details? – Stefan Mar 07 '18 at 11:36

1 Answers1

1

There's no data size limitation in javascript itself. The limits are set by your server configuration.

But since you're performing a GET request with dynamically created URL, take a look at this HTTP Protocol specification.

Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

Also, take a look at this SO question

Most webservers have a limit of 8192 bytes (8KB), which is usually configureable somewhere in the server configuration

htshame
  • 6,599
  • 5
  • 36
  • 56