title: How to download a file object to the user?
body: <p>Within a route:</p>
  <pre><code>app.get('some-route', async (req, res) =&gt; {
      // ...
  }
  </code></pre>
  <p>I have a file object (<code>file</code>) which looks like:</p>
  <p><a href="https://i.stack.imgur.com/ByPYR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ByPYR.png" alt="enter image description here" /></a></p>
  <p>Now I want to download this.</p>
  <p>Currently I am doing:</p>
  <pre class="lang-js prettyprint-override"><code>app.get('some-route', async (req, res) =&gt; {
      const file = //...
      res.write(file.data.buffer,&quot;binary&quot;);
      res.end();
  }
  
  </code></pre>
  <p>This works, but gives a file without an extension named <code>download</code> (by adding the extension manually I can check it works).</p>
  <p>How can I set the name and extension of the file? (or is there an entirely different better way to download a file like this?)</p>