title: is the nodejs Buffer asynchronous or synchronous?
body: <p>I dont see a callback in the Buffer documentation at <a href="http://nodejs.org/api/buffer.html#buffer_buffer" rel="nofollow">http://nodejs.org/api/buffer.html#buffer_buffer</a>.  Am I safe to assume that Buffer is synchronous?  I'm trying to convert a binary file to a base64 encoded string.</p>
  
  <p>What I'm ultimately trying to do is take a PNG file and store its base64 encoded string in MongoDB.  I read somewhere that I should take the PNG file, use Buffer to convert to base64, then pass this base64 output to Mongo.</p>
  
  <p>My code looks something like this:</p>
  
  <pre><code>fs.readFile(filepath, function(err, data) {
    var fileBuffer = new Buffer(data).toString('base64');
    // do Mongo save here with the fileBuffer ...
  });
  </code></pre>
  
  <p>I'm a bit fearful that Buffer is synchronous, and thus would be blocking other requests while this base64 encoding takes place.  If so, is there a better way of converting a binary file to a base64 encoded one for storage in Mongo? </p>