{"_id":"spawn-to-readstream","_rev":"324016","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","dist-tags":{"latest":"0.1.3"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"time":{"modified":"2021-06-04T01:50:30.000Z","created":"2013-07-09T14:16:50.827Z","0.1.3":"2014-05-21T14:39:37.887Z","0.1.2":"2014-05-21T14:09:38.675Z","0.1.1":"2014-05-21T14:02:29.399Z","0.1.0":"2013-08-02T15:41:24.934Z","0.0.1":"2013-07-09T14:16:50.827Z"},"users":{},"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"versions":{"0.1.3":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","version":"0.1.3","repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["buffer-spawn-error","error","spawn","limit","spawn-error"],"dependencies":{"limit-spawn":"0.0.3","through2":"~0.4.1"},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"homepage":"https://github.com/alessioalex/spawn-to-readstream","_id":"spawn-to-readstream@0.1.3","dist":{"shasum":"96768b72739ac64ffa77c8ce2cbf98c2d21d8dbf","size":3158,"noattachment":false,"key":"/spawn-to-readstream/-/spawn-to-readstream-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/spawn-to-readstream/download/spawn-to-readstream-0.1.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":1400683177887,"_cnpm_publish_time":1400683177887,"_hasShrinkwrap":false},"0.1.2":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","version":"0.1.2","repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["buffer-spawn-error","error","spawn","limit","spawn-error"],"dependencies":{"limit-spawn":"0.0.3","through2":"~0.4.1"},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"homepage":"https://github.com/alessioalex/spawn-to-readstream","_id":"spawn-to-readstream@0.1.2","dist":{"shasum":"61117d4d8368cafe8e6344bdd52f78e0a2314f81","size":2986,"noattachment":false,"key":"/spawn-to-readstream/-/spawn-to-readstream-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/spawn-to-readstream/download/spawn-to-readstream-0.1.2.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":1400681378675,"_cnpm_publish_time":1400681378675,"_hasShrinkwrap":false},"0.1.1":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","version":"0.1.1","repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["buffer-spawn-error","error","spawn","limit","spawn-error"],"dependencies":{"limit-spawn":"0.0.x","through2":"~0.4.1"},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"homepage":"https://github.com/alessioalex/spawn-to-readstream","_id":"spawn-to-readstream@0.1.1","dist":{"shasum":"15ce161d267f3be41a7f608832263bce68404834","size":2988,"noattachment":false,"key":"/spawn-to-readstream/-/spawn-to-readstream-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spawn-to-readstream/download/spawn-to-readstream-0.1.1.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":1400680949399,"_cnpm_publish_time":1400680949399,"_hasShrinkwrap":false},"0.1.0":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","version":"0.1.0","repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["buffer-spawn-error","error","spawn","limit","spawn-error"],"dependencies":{"through":"2.3.x","limit-spawn":"0.0.x"},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"_id":"spawn-to-readstream@0.1.0","dist":{"shasum":"5e0d16acf6cc82450d0a65d56ed172172ea8cce4","size":2787,"noattachment":false,"key":"/spawn-to-readstream/-/spawn-to-readstream-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spawn-to-readstream/download/spawn-to-readstream-0.1.0.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":1375458084934,"_cnpm_publish_time":1375458084934,"_hasShrinkwrap":false},"0.0.1":{"author":{"name":"Alexandru Vladutu","email":"alexandru.vladutu@gmail.com"},"license":"MIT","name":"spawn-to-readstream","description":"Converts spawn to a ReadStream, buffers the error and emits it","version":"0.0.1","repository":{"type":"git","url":"git://github.com/alessioalex/spawn-to-readstream.git"},"main":"index.js","engines":{"node":">= 0.4.0"},"keywords":["buffer-spawn-error","error","spawn","spawn-error"],"dependencies":{"through":"2.3.x"},"devDependencies":{"tap":"0.4.x"},"scripts":{"test":"node test/index.js"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"_id":"spawn-to-readstream@0.0.1","dist":{"shasum":"31633e2d407e367b1a79506f031efeeb3096b43c","size":2290,"noattachment":false,"key":"/spawn-to-readstream/-/spawn-to-readstream-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spawn-to-readstream/download/spawn-to-readstream-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":1373379410827,"_cnpm_publish_time":1373379410827,"_hasShrinkwrap":false}},"readme":"# spawn-to-readstream\r\n\r\n### Description\r\n\r\nMake child process spawn behave like a read stream (buffer the error, don't emit end if error emitted).\r\n\r\n### Installation\r\n\r\n```bash\r\nnpm install spawn-to-readstream\r\n```\r\n\r\n### Examples\r\n\r\n```js\r\nvar toReadStream = require('spawn-to-readstream'),\r\n    spawn        = require('child_process').spawn;\r\n\r\ntoReadStream(spawn('ls', ['-lah'])).on('error', function(err) {\r\n  throw err;\r\n}).on('end', function() {\r\n  console.log('~~~ DONE ~~~');\r\n}).on('data', function(data) {\r\n  console.log('ls data :::', data.toString());\r\n});\r\n```\r\n\r\nLimiting the output of the steam\r\n\r\n```js\r\nvar toReadStream = require('../index'),\r\n    spawn        = require('child_process').spawn,\r\n    limit, buf;\r\n\r\nbuf   = 0;\r\nlimit = 100 * 1024; // 100 Kb\r\n\r\n// Note that it's a 'soft' limit, meaning the data you\r\n// receive might be > 100 Kb, because the child process\r\n// was stopped after receiving more than <LIMIT> bytes\r\ntoReadStream(spawn('cat', ['/dev/urandom']), limit)\r\n  .on('error', function(err) {\r\n    throw err;\r\n  }).on('end', function(isLimited) {\r\n    console.log('done, ' + buf + ' bytes received');\r\n    if (isLimited) {\r\n      console.log('child process was cut');\r\n    }\r\n  }).on('data', function(data) {\r\n    buf += data.length;\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/spawn-to-readstream","bugs":{"url":"https://github.com/alessioalex/spawn-to-readstream/issues"},"license":"MIT"}