title: How can I store an integer in a nodejs Buffer?
body: <p>The nodejs <a href="http://nodejs.org/docs/v0.4.12/api/buffers.html"><code>Buffer</code></a> is pretty swell. However, it seems to be geared towards storing strings. The constructors either take a string, an array of bytes, or a size of bytes to allocate.</p>
  
  <p>I am using version 0.4.12 of Node.js, and I want to store an integer in a buffer. Not <code>integer.toString()</code>, but the actual bytes of the integer. Is there an easy way to do this without looping over the integer and doing some bit-twiddling? I could do that, but I feel like this is a problem someone else must have faced at some time.</p>