title: Node JS fs.createReadStream running browser out of memory
body: <p>I have a simple bandwidth test using node js, socket.io and fs for stream file streaming.
  My goal is to reach Gigabit speed which I've done however my problem is I'm streaming data so quickly, I'm crashing my browser on the client side. (FF and Chrome)
  I'm not sure if I'm missing something or if I'm just writing inefficient code.</p>
  
  <p>I'm not concerned with the data on the client side so I suspect if there's a javascript equivalent to  sending the data directly to  /dev/null   that would fix my problem but I'm not aware of anything like that.</p>
  
  <p>Does anyone have any suggestions or ran into something similar?</p>
  
  <p>Server side:</p>
  
  <pre><code>var io = require('socket.io').listen(81), fs = require('fs');
  var connectedsocketlist = []; 
  
  io.sockets.on('connection', function (socket) {
      connectedsocketlist.push(socket);
      var readStream = fs.createReadStream("2Gig.txt", {
              'encoding': 'base64', 
              mode: 0666, 
              autoClose: true,
              bufferSize: 1024});
  
      console.log(io.sockets.manager.rooms);
      io.set('log level', 2, 'transports', ['websocket']); // reduce logging
  
      readStream.on('data', function(data) {
              socket.volatile.send(data);
      }); 
  });
  </code></pre>
  
  <p>Client Side:</p>
  
  <pre><code>&lt;html&gt;
  &lt;script type="text/javascript" src="js/socket.io.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery-2.0.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var SPEED = {};
      var startTime;
      SPEED.bCount = 0;
  
      var socket = io.connect('http://10.0.1.22:81',{resource:'socket.io', 'force new     connection':false});
  
      socket.on('message', function (data) {
              SPEED.bCount = SPEED.bCount + data.length;
              SPEED.bitsPerSecon = Math.floor( (SPEED.bCount * 8)  / Math.floor(($.now() -  SPEED.startTime) / 1000)*100/100); 
              $("#speed").text(Math.floor (SPEED.bitsPerSecon /1000 /1000 ) * 100 /100 );
      });
  &lt;/script&gt;
  &lt;body&gt;
  &lt;div style="solid #ccc" id="speed"&gt;&amp;nbsp;&lt;/div&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p><a href="http://www.flickr.com/photos/cubicalmonkey/9522132887/" rel="nofollow noreferrer" title="Screen Shot 2013-08-16 at 10.58.20 AM by cubicalmonkey, on Flickr"><img src="https://farm4.staticflickr.com/3761/9522132887_e1d49db098.jpg" width="500" height="377" alt="Screen Shot 2013-08-16 at 10.58.20 AM"></a></p>