title: Store images in Mongodb serve them with Nodejs
body: <p>I understand Mongodb can store images in two ways.</p>
  
  <ol>
  <li>in a regular document by storing the image as binary</li>
  <li>via Gridfs for managing larger images.</li>
  </ol>
  
  <p>For simplicity and because the images I plan to server are small, I will go for option 1.</p>
  
  <p>To serve the images to a browser I am using nodejs.</p>
  
  <p>My question is how difficult will this be? How do you turn binary data to an actual image a browser will understand? What type of encoding is involved?</p>
  
  <p>Could you point me to tutorials/examples elsewhere on the web?</p>
  
  <p>By the way I know this may not be good idea for performance reasons, I plan to cache the images once served. I just want to avoid the file-system all-together.</p>