title: Download a file from http response body
body: <p>I've been researching this for quite a while now, and can't find a clear answer / a way to solve my problem.</p>
  <p>The situation is this: I'm sending a post request to a server. The response contains the binary of a pcap file in it's body. How do I download it as a file.</p>
  <p>My simplified code:</p>
  <pre><code>...
  this.downloadPcap = function(timestamp){
    var start = timestamp-10;
    var end = timestamp+10;
    var requestData = {&quot;start&quot;: start, &quot;end&quot;: end};
    $http.post(serverUrl, requestData);
  }
  </code></pre>
  <p>This is triggered by a click, where I get the timestamp of some event, and the server creates a PCAP file from 10 seconds before and after the exact event.</p>
  <p>I receive a response with a long binary.
  Also:</p>
  <blockquote>
  <p>Content-Length: 134772</p>
  <p>Content-Type: application/pcap</p>
  </blockquote>
  <p>Now I was told that if the header will be like so, the browser will automatically start downloading the response as a file. It doesn't.</p>
  <p>So I've read very little about Blob, and FileSaver, but I feel like there must be an easier way to download files that are being created dynamically.</p>
  <p>Can someone please point me in some direction? Is there no simpler way than including more libraries?</p>
  <p>Thanks in advance</p>