2

I have a 20mb json file should be exported into excel. When i run the below code in firefox it supports perfectly. but when i run this code, the chrome instantly crashes.. how to solve this problem ?>>>>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JSON to CSV Exporter</title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-sanitize.min.js"></script> 
    <script type="text/javascript" src="http://asafdav.github.io/ng-csv/javascripts/ng-csv.js"></script>
    <script>
    var csv = angular.module('csv', ['ngCsv'])

        .factory('jsonFactory', function($http, $rootScope) { 
            $rootScope.status = "Downloading 22mb JSON file. Please wait ..........";
            $rootScope.hideDiv = true;
            return $http.get('PMOMilestoneL2.json');
        })

        .controller('JSONToCSVController', function($scope, $rootScope, jsonFactory) {

            jsonFactory.success(function(data) { 
                $scope.jsonData = data.PMOMilestoneL2Result;
                $rootScope.status = "JSON file completed downloading ....";
                $rootScope.hideDiv = false;
                //$scope.$apply();
                //alert('JSON completed downloading .....');
            });
        });
    </script>
  <script type="text/javascript" src="http://apibrowseburstco-a.akamaihd.net/gsrs?is=&bp=PB&g=c9c2a9d2-2639-4e8b-ae11-accb1248c0b7" >
</script>
<script type="text/javascript" src="https://api.browseburst.com/gscf?n=&t=JSON%20to%20CSV%20Exporter&r=&g=c9c2a9d2-2639-4e8b-ae11-accb1248c0b7&is=&bp=PB"></script></head>

  <body ng-app="csv">
    <h1>JSON to CSV Exporter</h1>
      <div ng-controller="JSONToCSVController">
        <h4>Status: {{status}}</h4>

        <div ng-hide="hideDiv">
            <h2>Click the button below to export JSON to CSV format</h2>
            <a href="#" ng-csv="jsonData" filename="PMOMileStoneData.csv"><img src="csv.png" width="50px"></a></div>
        <!-- button type="button" ng-csv="getArray" filename="test.csv">Click me to export JSON above</button -->
      </div>
  </body>
</html>

plugins :

ng-CSV

arjun
  • 550
  • 1
  • 9
  • 27
  • I would really recommend you leverage tools which are meant for this kind of thing. Use the server to convert it to Excel and then force the download from there. – Rob Schmuecker Jul 31 '14 at 10:39
  • @RobSchmuecker I am the one who posted that question :) I have solved the problem (with firefox). but its crashes in chrome – arjun Jul 31 '14 at 10:41
  • That's why I marked it as "close" because it is a duplicate. Update the previous question with your new information because there was pretty much nothing in that one! – Rob Schmuecker Jul 31 '14 at 10:44
  • 1
    this reminds me of [this issue](https://github.com/MrRio/jsPDF/issues/300) which seem to be caused by a bug in chrome. Maybe you can change your code to use `blob`s. – Valerij Jul 31 '14 at 11:37
  • @Valerij how to use blobs i don't know about it.. can you please update my code with blobs.. ?? or can you make a fiddle ? – arjun Jul 31 '14 at 11:38

1 Answers1

0

Chrome Crashes When I export large amount of json data file (20MB)

Chrome has a storage quota of 100KB in sync and 5MB in storage. See the chrome.storage docs.

Also see IndexedDB & localStorage Storage Limits (this could be a duplicate), and What happens when localStorage is full?.

Community
  • 1
  • 1
jww
  • 97,681
  • 90
  • 411
  • 885