title: How can I create file from application/octet-stream data?
body: <p>I have a REST API that returns application/octet-stream as MediaType and now I need to create a file and download it in client side!</p>
  
  <pre class="lang-js prettyprint-override"><code>$("#export-space-excel-button").click(function(e) {
      e.preventDefault();
      $("#export-excel-space-dialog").hide();
      $("#export-excel-space-progress-dialog").css("display","");
      $("#export-excel-space-progress-dialog").show();
      $.ajax({
          url :  AJS.contextPath() + "/export/excel/space/"+spaceKey,
          type : "GET",
          data : {data1:data1},
          responseType: 'application/octet-stream',
          contentType: 'application/json',
          success: function(data) {
              const url = window.URL.createObjectURL(new Blob([data]));
              const link = document.createElement('a');
              link.href = url;
              link.setAttribute('download', 'test.xlsx');
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
              $("#export-excel-space-progress-dialog").hide();
          }
      });    
  });
  </code></pre>