Awesome
stream-valve
Ensure that a stream disconnects if it goes over maxBytes
perSeconds
Sponsored by
<p align="center"> <strong>Stream-valve</strong> development was sponsored by <strong><a href="https://redsmin.com">Redsmin</a>, a fully loaded administration service for Redis</strong>.<br/><br/> <a href="https://redsmin.com"><img src="https://www.redsmin.com/im/logo/rect-large-color-transparent@256.png"></a> </p>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(){
// ...
});
<p align="center">
<a target="_blank" href="https://play.spotify.com/track/58iP9J86ksOPwbo0pWOafk"><img style="width:100%" src="https://cloud.githubusercontent.com/assets/138050/6766986/282bf3e4-d01d-11e4-9d2f-05cb55d3bdc1.gif"></a>
</p>
Changelog
Donate
I maintain this project in my free time, if it helped you please support my work via paypal or bitcoins, thanks a lot!