title: Sharing binary buffer between Node.js server and Browser
body: <p>There is an issue of how to share buffers between node.js and the browser containing binary data. I'm pretty happy with <a href="http://socket.io" rel="nofollow noreferrer">Socket.io</a> as a transport layer but the issue is that there is no porting of the <a href="http://nodejs.org/api/buffer.html" rel="nofollow noreferrer">Buffer class</a> for the browser. Not something I can find anyways</p>
  
  <p>I've also came across <a href="http://binaryjs.com/" rel="nofollow noreferrer">binary.js</a> and I was wondering if there is a good way to combine them having the socket.io as the transport layer and the Binary.js as the data medium. I also saw this <a href="https://stackoverflow.com/questions/8880571/convert-nodejs-buffer-to-browsers-javascript">question</a>, which is kind of on topic but doesn't really resolve the issue. </p>
  
  <p>I know socket.io added binary support but I haven't found any documentation on the topic. </p>
  
  <p><strong>Update:</strong></p>
  
  <p>It seems that binary.js will not be the solution. The basic requirement that I want is to share the same capabilities that Buffer has in node with the browser. </p>
  
  <p>My needs consist of two things: </p>
  
  <ol>
  <li><p>Handle the buffer in the same manner in both Server and Browser. </p></li>
  <li><p>support Binary data. </p></li>
  </ol>
  
  <p>I will probably use Array Buffer.</p>
  
  <p>Edit: 
  Since node.js run over V8 you can use ArrayBuffer. It seems as if the issue is solved. Yet, from what I know, node people decided that it's a good idea to create a buffer module and manage it in the C bindings they created (from a talk given by Ryan Dahl). I think this has to do with how buffering is done over the network. This means ArrayBuffer is still not a good data medium to share between server  and browser. </p>