title: How can I provide an input stream to node.js/express' send, or get its raw output stream?
body: <p>I'm providing a route in my express app that provides the contents of a cloud file as a download.  I have access to the cloud file's input stream, and I'd like to pipe that directly into the response's output stream.  However, I'm using express, which doesn't seem to support an input stream.</p>
  
  <p>I was hoping I could do this:</p>
  
  <pre><code>res.send (cloudInputStream);
  </code></pre>
  
  <p>but this doesn't work.  Express' send takes a body or a buffer, but apparently not an input stream.</p>
  
  <p>Since that's the case, what I'd like to do is set the headers using res.setHeader(), then get access to the raw output stream, and then:</p>
  
  <p><code>cloudInputStream.pipe (responseOutputStream);</code></p>
  
  <p>Is this possible?</p>
  
  <p>Alternatively, I could turn read the input stream into a buffer, and provide that buffer to send.  However, this reads the entire cloud file's contents into memory at one time, which I'd like to avoid.</p>
  
  <p>Any thoughts?</p>