title: Angular File Saver in spring rest service
body: <p>I'm trying to implement  FileSaver.js  like this example  <a href="https://github.com/alferov/angular-file-saver" rel="nofollow">https://github.com/alferov/angular-file-saver</a> to download generated file by spring boot application ,I have rest service that return the file as byte array data.</p>
  
  <pre><code>@RequestMapping(value = "/generateReport/{reportId}/{parameters}",
          method = RequestMethod.GET,
          produces = MediaType.APPLICATION_JSON_VALUE)
      @Timed
      public  byte[] generateReport(@PathVariable("reportId") String reportId,
                                  @PathVariable("parameters") String parameters
                                  ) {
  
          byte[] bFile;
          //some code
  
          return bFile;
       }
  </code></pre>
  
  <p>Angular service  </p>
  
  <pre><code>'generateReport': {
              method: 'GET',
              responseType: 'arraybuffer' ,
              url: 'adap_report/api/generateReport/:reportId/:parameters',
              transformResponse: function (data) {
                  if (data) {
                      data = angular.fromJson(data);
                  }
                  return data;
                  }
          },
  </code></pre>
  
  <p>Angularjs controller</p>
  
  <pre><code> vm.generateReport = function() {
          Report.generateReport({reportId:entity.id,parameters:angular.toJson(vm.parameterList)}, function(result) {
          var data = new Blob([result], { type: 'application/octet-stream' });
          FileSaver.saveAs(data, 'text.txt');
          });
      };
  </code></pre>
  
  <p>File saver works and file downloaded but The content is wrong ,I just get file with this content </p>
  
  <pre><code>[object Object]  
  </code></pre>
  
  <p>Can anyone please help me to save generated file with angular FileSaver.js library?</p>