limit-spawn
Description
Kills a child process created with spawn after X bytes are sent and emits an event.
Installation
npm install limit-spawn
Note
This is a soft limit, meaning that after more than MAX data is received the process is closed and the 'max-limit-exceeded' is emitted. So this implies that you can receive more data than the limit (depending on the last chunk).
Examples
var spawn = spawn limit = assert = child ps bytesReceived MAX_LIMIT; MAX_LIMIT = 100 * 1024; // 100 Kb child = ; ; bytesReceived = 0; childstdout; childstderr; child; // shortly after the 'max-limit-exceeded' event is emitted the child dieschild;
Tests
npm test
License
MIT