Skip to content

Commit

Permalink
Reduce stream chunk size
Browse files Browse the repository at this point in the history
By default Node uses 40kb chunks, which will make the stream slow because it'll get caught up rendering 40kb of random data at a time. This will reduce it to 128 bytes.
  • Loading branch information
ericz committed Jul 27, 2012
1 parent 8e1c180 commit 3caad13
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app.js
@@ -1,4 +1,3 @@

/**
* Module dependencies.
*/
Expand Down Expand Up @@ -41,7 +40,7 @@ httpServer.listen(app.get('port'), function(){
server = binaryjs.BinaryServer({ server: httpServer })

server.on('connection', function (client) {
var stream = read(theFile);
var stream = read(theFile, {bufferSize: 128});

// Start sending /dev/random
client.send(stream);
Expand Down

0 comments on commit 3caad13

Please sign in to comment.