title: Getting pdf file from api response
body: <p>I am calling an api and getting pdf in return.</p>
  <pre><code>fetch(`api` + guid, {
     method: &quot;GET&quot;,
     headers: {
      &quot;Accept&quot;: &quot;application/octet-stream&quot;,
      &quot;Authorization&quot;: &quot;Bearer &quot; + token,
     },
     responseType: 'arraybuffer',
  })
  .then((res) =&gt; res.text())
  .then((data) =&gt; {
      fs.writeFileSync('file.pdf', data);
  });
  </code></pre>
  <p>I get the pdf file but the issue is the pdf file is always empty. But when I accept response as json, it works fine.</p>
  <p>I found similar problems like this but none of the solution worked for me yet.</p>
  <p>It would be great if someone can point out the issue.</p>