1.0.4 • Published 9 years ago

stream-valve v1.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

stream-valve Deps Version Version

Ensure that a stream disconnects if it goes over maxBytes perSeconds

Setup

npm install stream-valve

Usage

var valve = require('stream-valve');

socket = net.connect(6379, '127.0.0.1');

socket.on('error', function(err){
    // if valve maximum is reached a ESOCKETOVERFLOW error
    // will be emitted and the socket will be destroyed.
});

// disconnect the socket if it receive more than 1MB per 2 seconds
valve(socket, 1024 * 1024, 2);

socket.on('data', function(){
    // ...
});
1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago