title: Unable to convert response data of octet-stream to Zip file and download it
body: <p>I am trying to download Zip file containing JSON files from AJAX GET Request.</p>
  <p>Response Headers format:</p>
  <pre><code>Connection: keep-alive
  content-disposition: attachment;filename=exportedFiles_ 1.6.0_20200731160652.zip
  Content-Length: 4496
  Content-Type: application/octet-stream
  Date: Fri, 31 Jul 2020 10:36:52 GMT
  </code></pre>
  <p>Data Preview  in Network Tab:</p>
  <p><a href="https://i.stack.imgur.com/yHlNk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yHlNk.png" alt="enter image description here" /></a></p>
  <p>AJAX call and success function :</p>
  <pre><code>$.ajax({
        type: &quot;GET&quot;,
        url: &quot;/download/&quot; ,
        async: false,
        success: function (data,status, xhr) {          
        var filename = xhr.getResponseHeader('content-disposition').split(&quot;filename=&quot;)[1];;
        var blob = new Blob([data], {type: &quot;octet/stream&quot;})
         saveAs(blob, filename); 
        }
      });
  </code></pre>
  <p>Its saving the Zip file but when I try to open the Zip file it says &quot;<strong>Windows cannot open the folder, The compressed Zip is invalid</strong>&quot;.</p>
  <p><a href="https://i.stack.imgur.com/XjhJ9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjhJ9.png" alt="enter image description here" /></a></p>