# stream-valve **Repository Path**: mirrors_FGRibreau/stream-valve ## Basic Information - **Project Name**: stream-valve - **Description**: :closed_lock_with_key: Ensure that a stream disconnects if it goes over `maxBytes` `perSeconds` - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-03-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # stream-valve [![Deps](https://img.shields.io/david/FGRibreau/stream-valve.svg)](https://david-dm.org/FGRibreau/stream-valve) [![Version](https://img.shields.io/npm/v/stream-valve.svg)](https://david-dm.org/FGRibreau/stream-valve) [![CI](https://img.shields.io/travis/FGRibreau/stream-valve/master.svg)](https://travis-ci.org/FGRibreau/stream-valve) [![Twitter Follow](https://img.shields.io/twitter/follow/fgribreau.svg?style=flat)](https://twitter.com/FGRibreau) [![available-for-advisory](https://img.shields.io/badge/available%20for%20consulting%20advisory-yes-ff69b4.svg?)](http://bit.ly/2c7uFJq) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/francois-guillaume-ribreau?utm_source=github&utm_medium=button&utm_term=francois-guillaume-ribreau&utm_campaign=github) Ensure that a stream disconnects if it goes over `maxBytes` `perSeconds` ### Sponsored by

Stream-valve development was sponsored by Redsmin, a fully loaded administration service for Redis.

# Setup ``` npm install stream-valve ``` # Usage ```javascript 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(){ // ... }); ```

# [Changelog](/CHANGELOG.md) # Donate I maintain this project in my free time, if it helped you please support my work via [paypal](https://paypal.me/fgribreau) or [bitcoins](https://www.coinbase.com/fgribreau), thanks a lot!