title: Decode a base64 document in ExpressJS response
body: <p>I would like to store some documents in a database as base64 strings. Then when those docs are requested using HTTP, I would like ExpressJS to decode the base64 docs and return them. So something like this:</p>
  
  <pre><code>app.get('/base64', function (req, res) {
      //pdf is my base64 encoded string that represents a document
      var buffer = new Buffer(pdf, 'base64');
      res.send(buffer);
  });
  </code></pre>
  
  <p>The code is simply to give an idea of what I'm trying to accomplish. Do I need to use a stream for this? If so, how would I do that? Or should I be writing these docs to a temp directory and then serving up the file? Would be nice to skip that step if possible. Thanks!</p>
  
  <p>UPDATE: Just to be clear I would like this to work with a typical HTTP request. So the user will click a link in his browser that will take him to a URL that returns a file from the database. Seems like it must be possible, Microsoft SharePoint stores serialized files in a SQL database and returns those files over http requests, and I don't believe it writes all those files to a temp location first. I'm feeling like a nodejs stream may be the answer, but I'm not very familiar with streaming.</p>