{"_id":"fwd-stream","_rev":"346248","name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","dist-tags":{"latest":"1.0.4"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-06-20T02:40:43.000Z","created":"2014-04-12T14:32:39.923Z","1.0.4":"2014-04-12T15:42:35.449Z","1.0.3":"2014-04-12T15:27:05.321Z","1.0.2":"2014-04-12T14:39:23.137Z","1.0.1":"2014-04-12T14:36:56.763Z","1.0.0":"2014-04-12T14:32:39.923Z"},"users":{},"repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"versions":{"1.0.4":{"name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","version":"1.0.4","repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"dependencies":{"readable-stream":"~1.0.26-4"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test.js"},"bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"},"homepage":"https://github.com/mafintosh/fwd-stream","_id":"fwd-stream@1.0.4","dist":{"shasum":"ed281cabed46feecf921ee32dc4c50b372ac7cfa","size":2314,"noattachment":false,"key":"/fwd-stream/-/fwd-stream-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/fwd-stream/download/fwd-stream-1.0.4.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1397317355449,"_cnpm_publish_time":1397317355449,"_hasShrinkwrap":false},"1.0.3":{"name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","version":"1.0.3","repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"dependencies":{"readable-stream":"~1.0.26-4"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test.js"},"bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"},"homepage":"https://github.com/mafintosh/fwd-stream","_id":"fwd-stream@1.0.3","dist":{"shasum":"017d1e220f4c94ec7195bdbe7a59b43bf2df5e72","size":2301,"noattachment":false,"key":"/fwd-stream/-/fwd-stream-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/fwd-stream/download/fwd-stream-1.0.3.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1397316425321,"_cnpm_publish_time":1397316425321,"_hasShrinkwrap":false},"1.0.2":{"name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","version":"1.0.2","repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"dependencies":{"readable-stream":"~1.0.26-4"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test.js"},"bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"},"homepage":"https://github.com/mafintosh/fwd-stream","_id":"fwd-stream@1.0.2","dist":{"shasum":"0c04b35ae87b0c67a561c9f25dcf6377452b2640","size":2261,"noattachment":false,"key":"/fwd-stream/-/fwd-stream-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/fwd-stream/download/fwd-stream-1.0.2.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1397313563137,"_cnpm_publish_time":1397313563137,"_hasShrinkwrap":false},"1.0.1":{"name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","version":"1.0.1","repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"dependencies":{"readable-stream":"^1.0.26-4"},"devDependencies":{"tape":"^2.12.3"},"scripts":{"test":"tape test.js"},"bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"},"homepage":"https://github.com/mafintosh/fwd-stream","_id":"fwd-stream@1.0.1","dist":{"shasum":"9c092193dddc21ee0f02e8bfe394898042649852","size":2262,"noattachment":false,"key":"/fwd-stream/-/fwd-stream-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/fwd-stream/download/fwd-stream-1.0.1.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1397313416763,"_cnpm_publish_time":1397313416763,"_hasShrinkwrap":false},"1.0.0":{"name":"fwd-stream","description":"Forward a readable stream to another readable stream or a writable stream to another writable stream","version":"1.0.0","repository":{"type":"git","url":"git://github.com/mafintosh/fwd-stream"},"dependencies":{"readable-stream":"^1.0.26-4"},"devDependencies":{"tape":"^2.12.3"},"scripts":{"test":"tape test.js"},"bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"},"homepage":"https://github.com/mafintosh/fwd-stream","_id":"fwd-stream@1.0.0","dist":{"shasum":"a4a387938c2f52b97e1dd026a0c1ce1dd8226dc2","size":2134,"noattachment":false,"key":"/fwd-stream/-/fwd-stream-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/fwd-stream/download/fwd-stream-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"publish_time":1397313159923,"_cnpm_publish_time":1397313159923,"_hasShrinkwrap":false}},"readme":"# fwd-stream\n\nForward a readable stream to another readable stream or a writable stream to another writable stream.\nFeaturing streams2 support and async instantiating.\n\n\tnpm install fwd-stream\n\n[![build status](https://secure.travis-ci.org/mafintosh/fwd-stream.png)](http://travis-ci.org/mafintosh/fwd-stream)\n\n## When should I use this?\n\nThis module makes it easy to return a stream synchroniously that wraps another stream from an async context.\nSay for example you wanted to create a folder before writing a write you could do\n\n``` js\nvar fs = require('fs');\nvar fwd = require('fwd-stream');\n\nvar ws = fwd.writable(function(cb) {\n\tfs.mkdir('my-folder', function() {\n\t\tcb(null, fs.createWriteStream('my-folder/my-file.txt'));\n\t});\n});\n\nws.write('content of my-file.txt');\n```\n\n## Usage\n\nForward readable streams\n\n``` js\nvar fwd = require('fwd-stream');\n\n// rs will be a stream that forwards someReadableStream's data and events\n// backpressure etc will still be respected\n\nvar rs = fwd.readable(someReadableStream);\n\n// or using async instantiating\n\nvar rs = fwd.readable(function(cb) {\n\tsetTimeout(function() {\n\t\tcb(null, someReadableStream);\n\t}, 1000);\n});\n\n// or using objectMode\n\nvar rs = fwd.readable({objectMode:true}, someReadableObjectStream);\n```\n\nForward writable streams\n\n``` js\nvar ws = fwd.writable(someWritableStream);\n\n// or using async instantiating\n\nvar ws = fwd.writable(function(cb) {\n\tsetTimeout(function() {\n\t\tcb(null, ws);\n\t}, 1000);\n});\n\n// or using objectMode\n\nvar ws = fwd.writable({objectMode:true}, someWritableObjectStream);\n```\n\nForward duplex streams\n\n``` js\nvar dupl = fwd.duplex(someWritableStream, someReadableStream);\n\n// or using async instantiating\n\nvar dupl = fwd.duplex(\n\tfunction(cb) {\n\t\tsetTimeout(function() {\n\t\t\tcb(null, someWritableStream);\n\t\t}, 1000);\n\t},\n\tfunction(cb) {\n\t\tsetTimeout(function() {\n\t\t\tcb(null, someReadableStream);\n\t\t}, 1000);\n\t}\n);\n\n// or using objectMode\n\nvar dupl = fwd.duplex({objectMode:true}, someReadableObjStream, someWritableObjStream);\n```\n\n## License\n\nMIT","_attachments":{},"homepage":"https://github.com/mafintosh/fwd-stream","bugs":{"url":"https://github.com/mafintosh/fwd-stream/issues"}}