title: Node Express sending image files as API response
body: <p>I Googled this but couldn't find an answer but it must be a common problem. This is the same question as <a href="https://stackoverflow.com/questions/17004990/node-request-read-image-stream-pipe-back-to-response">Node request (read image stream - pipe back to response)</a>, which is unanswered.</p>
  
  <p>How do I send an image file as an Express .send() response? I need to map RESTful urls to images - but how do I send the binary file with the right headers? E.g.,</p>
  
  <pre><code>&lt;img src='/report/378334e22/e33423222' /&gt;
  </code></pre>
  
  <p>Calls...</p>
  
  <pre><code>app.get('/report/:chart_id/:user_id', function (req, res) {
       //authenticate user_id, get chart_id obfuscated url
       //send image binary with correct headers
  });
  </code></pre>