{"_id":"stream-wrapper","_rev":"13-0a47d48b0bcb3f0539d9c0c17242a185","name":"stream-wrapper","description":"Wrap read/write/transform functions into streams","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"stream-wrapper","version":"0.1.0","repository":{"type":"git","url":"git://github.com/mafintosh/stream-wrapper.git"},"license":"MIT","description":"Create streams from read/write functions","keywords":["streams2","stream","wrap","functional"],"author":{"name":"Mathias Buus Madsen","email":"mathiasbuus@gmail.com"},"readme":"# stream-wrapper\n\nDrop-in replacement for the core [stream](http://nodejs.org/api/stream.html)\nthat allows you to create streams from `read`/`write` functions.\n\n\tnpm install stream-wrapper\n\nAll streams create are stream2 streams\n\n## Readable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar rs = stream.readable(function read(size) {\n\tthis.push(new Buffer('hello world'));\n});\n```\n\nIf you don't have a `read` function just omit it\n\n``` js\nvar rs = stream.readable();\nrs.push(new Buffer('hello world'));\n```\n\nThe Readable prototype is exposed through `stream.Readable`.\n\n## Writable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ws = stream.writable(function writable(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Writable prototype is exposed through `stream.Writable`.\n\n## Duplex Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ds = stream.duplex(function read() {\n\tthis.push(new Buffer('hello world'));\n}, function write(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Duplex prototype is exposed through `stream.Duplex`\n\n## Transform Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ts = stream.transform(function transform(chunk, enc, callback) {\n\tthis.push(chunk);\n\tcallback();\n});\n```\n\nIf you want to add a flush function pass it as the second parameter\n\n``` js\nvar ts = stream.transform(function transform() {\n\t...\n}, function flush(callback) {\n\tconsole.log('now flushing...');\n\tcallback();\n});\n```\n\nThe Transform prototype is exposed through `stream.Transform`\n\n## Stream options\n\nIf you want to pass stream options (like `objectMode`) pass them as the first\nparameter to `readable`, `writable`, `duplex` or `transform`\n\n``` js\nvar rs = stream.readable({objectMode:true}, function read() {\n\tthis.push({message:'i am an object'});\n});\n```\n\n## Stream defaults\n\nYou can change the default options for the stream by calling `defaults`\n\n``` js\n// all streams created have objectMode enabled\nstream = stream.defaults({objectMode:true});\n```\n\n## Stream.destroy\n\nAll streams have a `.destroy` method implemented per default that when called\nemits `close` and sets `stream.destroyed = true`.\n\n``` js\nvar rs = stream.readable();\n\nrs.on('close', function() {\n\t// rs.destroyed === true\n\tconsole.log('someone called destroy');\n});\n\nrs.destroy();\n```\n\n# License\n\nMIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/mafintosh/stream-wrapper/issues"},"_id":"stream-wrapper@0.1.0","dist":{"shasum":"287dbed22600f199474e407ec979df4c3ab473cb","tarball":"https://registry.npmjs.org/stream-wrapper/-/stream-wrapper-0.1.0.tgz","integrity":"sha512-BFMHov55JJSaa+92MKVKLUtJSw/zTjcEgD4d9E7ttGsy/uLWULkraThthAVqzABlj5Ck2S5e/Q91UkqAn+czGw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5nejCpRXyeUfS2AXuA+qAT3A6tVJvvmvqDe3pfB/8CQIgD6FhlQKD1VhntHYXtLdnxQxLDjDbhRtUjA22JyC43Bk="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{}},"0.1.1":{"name":"stream-wrapper","version":"0.1.1","repository":{"type":"git","url":"git://github.com/mafintosh/stream-wrapper.git"},"license":"MIT","description":"Wrap read/write/transform functions into streams","keywords":["streams2","stream","wrap","functional"],"author":{"name":"Mathias Buus Madsen","email":"mathiasbuus@gmail.com"},"dependencies":{"readable-stream":"~1.0.15","xtend":"~2.0.6"},"readme":"# stream-wrapper\n\nDrop-in replacement for the core [stream](http://nodejs.org/api/stream.html) module\nthat allows you to wrap `read`/`write`/`transform` functions into streams.\n\n\tnpm install stream-wrapper\n\nAll streams create are stream2 streams\n\n## Readable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar rs = stream.readable(function(size) {\n\tthis.push(new Buffer('hello world'));\n});\n```\n\nIf you don't have a `read` function just omit it\n\n``` js\nvar rs = stream.readable();\nrs.push(new Buffer('hello world'));\n```\n\nThe Readable prototype is exposed through `stream.Readable`.\n\n## Writable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ws = stream.writable(function(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Writable prototype is exposed through `stream.Writable`.\n\n## Duplex Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ds = stream.duplex(function() {\n\t// read function\n\tthis.push(new Buffer('hello world'));\n}, function write(chunk, enc, callback) {\n\t// write function\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Duplex prototype is exposed through `stream.Duplex`\n\n## Transform Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ts = stream.transform(function(chunk, enc, callback) {\n\tthis.push(chunk);\n\tcallback();\n});\n```\n\nIf you want to add a flush function pass it as the second parameter\n\n``` js\nvar ts = stream.transform(function(chunk, enc, callback) {\n\t// transform function\n\tthis.push(chunk);\n\tcallback();\n}, function(callback) {\n\t// flush function\n\tconsole.log('now flushing...');\n\tcallback();\n});\n```\n\nThe Transform prototype is exposed through `stream.Transform`\n\n## Stream options\n\nIf you want to pass stream options (like `objectMode`) pass them as the first\nparameter to `readable`, `writable`, `duplex` or `transform`\n\n``` js\nvar rs = stream.readable({objectMode:true}, function() {\n\tthis.push({message:'i am an object'});\n});\n```\n\n## Stream defaults\n\nYou can change the default options for the stream by calling `defaults`\n\n``` js\n// all streams created have objectMode enabled\nstream = stream.defaults({objectMode:true});\n```\n\n## Stream.destroy\n\nAll streams have a `.destroy` method implemented per default that when called\nemits `close` and sets `stream.destroyed = true`.\n\n``` js\nvar rs = stream.readable();\n\nrs.on('close', function() {\n\t// rs.destroyed === true\n\tconsole.log('someone called destroy');\n});\n\nrs.destroy();\n```\n\n# License\n\nMIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/mafintosh/stream-wrapper/issues"},"_id":"stream-wrapper@0.1.1","dist":{"shasum":"bfce1ae7016b2903b7e49425d8a3ffdf0d4c21e7","tarball":"https://registry.npmjs.org/stream-wrapper/-/stream-wrapper-0.1.1.tgz","integrity":"sha512-goLeVTWbn6GORefey5q79L5jBuljNPhLZpI6qT0uZr39xUwLpk0ygdJ1+GcfVkljAZnhLm5y1GJ2npkZo9CZIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEaPaqIJpVKekB3RrsPxZoqjT1gc2Vi8lnonRvyFl/K1AiACKO/uL/I31R/J1VXwVaEUGJLQZZmyIsUCSFc1I9hK4Q=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}]},"0.1.2":{"name":"stream-wrapper","version":"0.1.2","repository":{"type":"git","url":"git://github.com/mafintosh/stream-wrapper.git"},"license":"MIT","description":"Wrap read/write/transform functions into streams","keywords":["streams2","stream","wrap","functional"],"author":{"name":"Mathias Buus Madsen","email":"mathiasbuus@gmail.com"},"dependencies":{"readable-stream":"~1.0.15","xtend":"~2.0.6"},"readme":"# stream-wrapper\n\nDrop-in replacement for the core [stream](http://nodejs.org/api/stream.html) module\nthat allows you to wrap `read`/`write`/`transform` functions into streams.\n\n\tnpm install stream-wrapper\n\nAll streams create are stream2 streams\n\n## Readable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar rs = stream.readable(function(size) {\n\tthis.push(new Buffer('hello world'));\n});\n```\n\nIf you don't have a `read` function just omit it\n\n``` js\nvar rs = stream.readable();\nrs.push(new Buffer('hello world'));\n```\n\nThe Readable prototype is exposed through `stream.Readable`.\n\n## Writable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ws = stream.writable(function(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Writable prototype is exposed through `stream.Writable`.\n\n## Duplex Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ds = stream.duplex(function() {\n\t// read function\n\tthis.push(new Buffer('hello world'));\n}, function write(chunk, enc, callback) {\n\t// write function\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Duplex prototype is exposed through `stream.Duplex`\n\n## Transform Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ts = stream.transform(function(chunk, enc, callback) {\n\tthis.push(chunk);\n\tcallback();\n});\n```\n\nIf you want to add a flush function pass it as the second parameter\n\n``` js\nvar ts = stream.transform(function(chunk, enc, callback) {\n\t// transform function\n\tthis.push(chunk);\n\tcallback();\n}, function(callback) {\n\t// flush function\n\tconsole.log('now flushing...');\n\tcallback();\n});\n```\n\nThe Transform prototype is exposed through `stream.Transform`\n\n## Stream options\n\nIf you want to pass stream options (like `objectMode`) pass them as the first\nparameter to `readable`, `writable`, `duplex` or `transform`\n\n``` js\nvar rs = stream.readable({objectMode:true}, function() {\n\tthis.push({message:'i am an object'});\n});\n```\n\n## Stream defaults\n\nYou can change the default options for the stream by calling `defaults`\n\n``` js\n// all streams created have objectMode enabled\nstream = stream.defaults({objectMode:true});\n```\n\n## Stream.destroy\n\nAll streams have a `.destroy` method implemented per default that when called\nemits `close` and sets `stream.destroyed = true`.\n\n``` js\nvar rs = stream.readable();\n\nrs.on('close', function() {\n\t// rs.destroyed === true\n\tconsole.log('someone called destroy');\n});\n\nrs.destroy();\n```\n\n# License\n\nMIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/mafintosh/stream-wrapper/issues"},"_id":"stream-wrapper@0.1.2","dist":{"shasum":"468a9432c1012a1373c203085bbcb914869c31f6","tarball":"https://registry.npmjs.org/stream-wrapper/-/stream-wrapper-0.1.2.tgz","integrity":"sha512-HWJtwMXK6b7OTtR+kr20er0J5TNXpAezaTqobuHxPZJc24jIIbzgt339ztajJ6wHGEeV7oeTDZZLmwDzzSPLqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHoKBRw/c+ONOH/wzRpg2pmiTO128jO+nHLB8svtFkh1AiBYHabzAWlAmrWediUU0cdTAr1IX9y/jPeTiXwXuZfCXQ=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}]}},"readme":"# stream-wrapper\n\nDrop-in replacement for the core [stream](http://nodejs.org/api/stream.html)\nthat allows you to create streams from `read`/`write` functions.\n\n\tnpm install stream-wrapper\n\nAll streams create are stream2 streams\n\n## Readable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar rs = stream.readable(function read(size) {\n\tthis.push(new Buffer('hello world'));\n});\n```\n\nIf you don't have a `read` function just omit it\n\n``` js\nvar rs = stream.readable();\nrs.push(new Buffer('hello world'));\n```\n\nThe Readable prototype is exposed through `stream.Readable`.\n\n## Writable Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ws = stream.writable(function writable(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Writable prototype is exposed through `stream.Writable`.\n\n## Duplex Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ds = stream.duplex(function read() {\n\tthis.push(new Buffer('hello world'));\n}, function write(chunk, enc, callback) {\n\tconsole.log('writing', chunk);\n\tcallback();\n});\n```\n\nThe Duplex prototype is exposed through `stream.Duplex`\n\n## Transform Stream\n\n``` js\nvar stream = require('stream-wrapper');\n\nvar ts = stream.transform(function transform(chunk, enc, callback) {\n\tthis.push(chunk);\n\tcallback();\n});\n```\n\nIf you want to add a flush function pass it as the second parameter\n\n``` js\nvar ts = stream.transform(function transform() {\n\t...\n}, function flush(callback) {\n\tconsole.log('now flushing...');\n\tcallback();\n});\n```\n\nThe Transform prototype is exposed through `stream.Transform`\n\n## Stream options\n\nIf you want to pass stream options (like `objectMode`) pass them as the first\nparameter to `readable`, `writable`, `duplex` or `transform`\n\n``` js\nvar rs = stream.readable({objectMode:true}, function read() {\n\tthis.push({message:'i am an object'});\n});\n```\n\n## Stream defaults\n\nYou can change the default options for the stream by calling `defaults`\n\n``` js\n// all streams created have objectMode enabled\nstream = stream.defaults({objectMode:true});\n```\n\n## Stream.destroy\n\nAll streams have a `.destroy` method implemented per default that when called\nemits `close` and sets `stream.destroyed = true`.\n\n``` js\nvar rs = stream.readable();\n\nrs.on('close', function() {\n\t// rs.destroyed === true\n\tconsole.log('someone called destroy');\n});\n\nrs.destroy();\n```\n\n# License\n\nMIT","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"time":{"modified":"2022-06-27T00:51:37.999Z","created":"2013-08-24T13:54:14.809Z","0.1.0":"2013-08-24T13:54:17.641Z","0.1.1":"2013-08-24T15:05:46.983Z","0.1.2":"2013-08-24T15:06:04.711Z"},"author":{"name":"Mathias Buus Madsen","email":"mathiasbuus@gmail.com"},"repository":{"type":"git","url":"git://github.com/mafintosh/stream-wrapper.git"}}