{"name":"duplexer2","version":"0.1.0","description":"Like duplexer but using streams3","files":["index.js"],"scripts":{"test":"node --harmony_destructuring --throw-deprecation --trace-sync-io --track-heap-objects node_modules/mocha/bin/_mocha","coverage":"node --harmony_destructuring node_modules/.bin/istanbul cover _mocha"},"repository":{"type":"git","url":"git+https://github.com/deoxxa/duplexer2.git"},"keywords":["duplex","duplexer","stream","stream3","join","combine"],"author":{"name":"Conrad Pankoff","email":"deoxxa@fknsrs.biz","url":"http://www.fknsrs.biz/"},"license":"BSD-3-Clause","dependencies":{"readable-stream":"^2.0.2"},"devDependencies":{"istanbul":"^0.3.20","mocha":"^2.2.5"},"gitHead":"af38f7b1229d53e343bc65a13c1fc780ea5c9178","bugs":{"url":"https://github.com/deoxxa/duplexer2/issues"},"homepage":"https://github.com/deoxxa/duplexer2#readme","_id":"duplexer2@0.1.0","_shasum":"90c7ad5dbfba99fce92c2dd64aaaeae2a650d91f","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"shinnn","email":"snnskwtnb@gmail.com"},"maintainers":[{"name":"deoxxa","email":"deoxxa@fknsrs.biz"},{"name":"shinnn","email":"snnskwtnb@gmail.com"}],"dist":{"shasum":"90c7ad5dbfba99fce92c2dd64aaaeae2a650d91f","tarball":"http://registry-npm.ywwl.com/duplexer2/download/duplexer2-0.1.0.tgz","integrity":"sha512-wKKVpLk2XXyKYd3LiZcYmepnoMp1F+7AQgVEddWMuiCc59bPbVwjdxkrkSDdn4Bcjg/hz4celEB/irl8FUxcZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFSbRpc8talgHbr7O0HzDooLSDj9vu7FMjqtLWyQV+L3AiAR3lfj0WonJXaUJKEOpaVZgAu3+Yn5T5JvT3huguzEoA=="}],"size":3053,"noattachment":false,"key":"/duplexer2/-/duplexer2-0.1.0.tgz"},"directories":{},"readme":"# duplexer2 [![Build Status](https://travis-ci.org/deoxxa/duplexer2.svg?branch=master)](https://travis-ci.org/deoxxa/duplexer2) [![Coverage Status](https://coveralls.io/repos/deoxxa/duplexer2/badge.svg?branch=master&service=github)](https://coveralls.io/github/deoxxa/duplexer2?branch=master)\n\nLike [duplexer](https://github.com/Raynos/duplexer) but using Streams3\n\n```javascript\nvar stream = require(\"stream\");\n\nvar duplexer2 = require(\"duplexer2\");\n\nvar writable = new stream.Writable({objectMode: true}),\n    readable = new stream.Readable({objectMode: true});\n\nwritable._write = function _write(input, encoding, done) {\n  if (readable.push(input)) {\n    return done();\n  } else {\n    readable.once(\"drain\", done);\n  }\n};\n\nreadable._read = function _read(n) {\n  // no-op\n};\n\n// simulate the readable thing closing after a bit\nwritable.once(\"finish\", function() {\n  setTimeout(function() {\n    readable.push(null);\n  }, 500);\n});\n\nvar duplex = duplexer2(writable, readable);\n\nduplex.on(\"data\", function(e) {\n  console.log(\"got data\", JSON.stringify(e));\n});\n\nduplex.on(\"finish\", function() {\n  console.log(\"got finish event\");\n});\n\nduplex.on(\"end\", function() {\n  console.log(\"got end event\");\n});\n\nduplex.write(\"oh, hi there\", function() {\n  console.log(\"finished writing\");\n});\n\nduplex.end(function() {\n  console.log(\"finished ending\");\n});\n```\n\n```\ngot data \"oh, hi there\"\nfinished writing\ngot finish event\nfinished ending\ngot end event\n```\n\n## Overview\n\nThis is a reimplementation of [duplexer](https://www.npmjs.com/package/duplexer) using the\nStreams3 API which is standard in Node as of v4. Everything largely\nworks the same.\n\n\n\n## Installation\n\n[Available via `npm`](https://docs.npmjs.com/cli/install):\n\n```\n$ npm i duplexer2\n```\n\n## API\n\n### duplexer2\n\nCreates a new `DuplexWrapper` object, which is the actual class that implements\nmost of the fun stuff. All that fun stuff is hidden. DON'T LOOK.\n\n```javascript\nduplexer2([options], writable, readable)\n```\n\n```javascript\nconst duplex = duplexer2(new stream.Writable(), new stream.Readable());\n```\n\nArguments\n\n* __options__ - an object specifying the regular `stream.Duplex` options, as\n  well as the properties described below.\n* __writable__ - a writable stream\n* __readable__ - a readable stream\n\nOptions\n\n* __bubbleErrors__ - a boolean value that specifies whether to bubble errors\n  from the underlying readable/writable streams. Default is `true`.\n\n\n## License\n\n3-clause BSD. [A copy](./LICENSE) is included with the source.\n\n## Contact\n\n* GitHub ([deoxxa](http://github.com/deoxxa))\n* Twitter ([@deoxxa](http://twitter.com/deoxxa))\n* Email ([deoxxa@fknsrs.biz](mailto:deoxxa@fknsrs.biz))\n","publish_time":1443120532293,"_cnpm_publish_time":1443120532293,"dist-tags":{"latest":"0.1.4"}}