{"_id":"limit-spawn","_rev":"324390","name":"limit-spawn","description":"Kills a child process created with spawn after X bytes are sent","dist-tags":{"latest":"0.0.3"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"time":{"modified":"2021-06-04T01:56:05.000Z","created":"2013-08-02T14:33:56.022Z","0.0.3":"2014-05-21T14:07:15.065Z","0.0.2":"2013-08-02T15:49:36.189Z","0.0.1":"2013-08-02T14:33:56.022Z"},"users":{},"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"repository":{"type":"git","url":"git://github.com/alessioalex/limit-spawn.git"},"versions":{"0.0.3":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"limit-spawn","description":"Kills a child process created with spawn after X bytes are sent","version":"0.0.3","repository":{"type":"git","url":"git://github.com/alessioalex/limit-spawn.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["spawn","limit"],"dependencies":{},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"bugs":{"url":"https://github.com/alessioalex/limit-spawn/issues"},"homepage":"https://github.com/alessioalex/limit-spawn","_id":"limit-spawn@0.0.3","dist":{"shasum":"cc09c24467a0f0a1ed10a5196dba597cad3f65dc","size":2506,"noattachment":false,"key":"/limit-spawn/-/limit-spawn-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/limit-spawn/download/limit-spawn-0.0.3.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"directories":{},"publish_time":1400681235065,"_cnpm_publish_time":1400681235065,"_hasShrinkwrap":false},"0.0.2":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"limit-spawn","description":"Kills a child process created with spawn after X bytes are sent","version":"0.0.2","repository":{"type":"git","url":"git://github.com/alessioalex/limit-spawn.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["spawn","limit"],"dependencies":{},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/alessioalex/limit-spawn/issues"},"_id":"limit-spawn@0.0.2","dist":{"shasum":"0c4c06697df1b75c6733e68febc07e4d41f4e5d9","size":2467,"noattachment":false,"key":"/limit-spawn/-/limit-spawn-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/limit-spawn/download/limit-spawn-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"directories":{},"publish_time":1375458576189,"_cnpm_publish_time":1375458576189,"_hasShrinkwrap":false},"0.0.1":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"limit-spawn","description":"Kills a child process created with spawn after X bytes are sent","version":"0.0.1","repository":{"type":"git","url":"git://github.com/alessioalex/limit-spawn.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["spawn","limit"],"dependencies":{},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/alessioalex/limit-spawn/issues"},"_id":"limit-spawn@0.0.1","dist":{"shasum":"e121b4d544402d7e81379a8a8be5d642bbdba0b8","size":2361,"noattachment":false,"key":"/limit-spawn/-/limit-spawn-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/limit-spawn/download/limit-spawn-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"directories":{},"publish_time":1375454036022,"_cnpm_publish_time":1375454036022,"_hasShrinkwrap":false}},"readme":"# limit-spawn\r\n\r\n### Description\r\n\r\nKills a child process created with spawn after X bytes are sent and emits an event.\r\n\r\n### Installation\r\n\r\n```bash\r\nnpm install limit-spawn\r\n```\r\n### Note\r\n\r\nThis is a soft limit, meaning that after more than MAX data is received the process is closed and the 'max-limit-exceeded' is emitted.\r\nSo this implies that you can receive more data than the limit (depending on the last chunk).\r\n\r\n### Examples\r\n\r\n```js\r\nvar spawn  = require('child_process').spawn,\r\n    limit  = require('../index'),\r\n    assert = require('assert'),\r\n    child, ps, bytesReceived, MAX_LIMIT;\r\n\r\nMAX_LIMIT = 100 * 1024; // 100 Kb\r\n\r\nchild = spawn('node', ['forever-output.js'], {\r\n  cwd: __dirname\r\n});\r\n\r\nlimit(child, MAX_LIMIT);\r\n\r\nbytesReceived = 0;\r\n\r\nchild.stdout.on('data', function(data) {\r\n  bytesReceived += data.length;\r\n});\r\n\r\nchild.stderr.pipe(process.stderr);\r\n\r\nchild.on('max-limit-exceeded', function(size) {\r\n  console.log('limit exceeded: ' + parseInt(size / 1024, 10) + ' Kb sent');\r\n});\r\n\r\n// shortly after the 'max-limit-exceeded' event is emitted the child dies\r\nchild.on('close', function(code) {\r\n  console.log('child process exited');\r\n});\r\n```\r\n\r\n### Tests\r\n\r\n```bash\r\nnpm test\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n","_attachments":{},"homepage":"https://github.com/alessioalex/limit-spawn","bugs":{"url":"https://github.com/alessioalex/limit-spawn/issues"},"license":"MIT"}