title: Sending a file to the client from Node.js with Express
body: <p>I have a unique situation in terms of difficulty.</p>
  
  <p>I need to send HTML to the server, have the server convert the HTML to a PDF, send that PDF back to the client, and then download the PDF using <em>client-side code.</em></p>
  
  <p>I have to do it this way because I'm using client-side routing, so the only way I can access my endpoint that should perform this action is via a GET Request with Ajax or Fetch from client-side JavaScript. I am aware of <code>res.sendFile()</code>, but that attempts to render the file in the browser - I don't want that - rather, I want to be able to use client-side code to download the file.</p>
  
  <p>Is it possible, then, to send a PDF file from temporary storage on the server down to the client, allowing client-side code to do whatever it wants to the file thereafter - in my case, downloading it?</p>
  
  <p>I don't believe I have to provide any code because this is more of a theoretical question.</p>