title: How to buffer an HTTP response using the request module?
body: <p>I would like to stream the contents of an HTTP response to a variable. My goal is to get an image via <code>request()</code>, and store it in in MongoDB - but the image is always corrupted.</p>
  
  <p>This is my code:</p>
  
  <pre><code>request('http://google.com/doodle.png', function (error, response, body) {
      image = new Buffer(body, 'binary');
      db.images.insert({ filename: 'google.png', imgData: image}, function (err) {
          // handle errors etc.
      });
  })
  </code></pre>
  
  <p>What is the best way to use Buffer/streams in this case?</p>