{"name":"duplexify","version":"4.1.0","description":"Turn a writable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input","main":"index.js","dependencies":{"end-of-stream":"^1.4.1","inherits":"^2.0.3","readable-stream":"^3.1.1","stream-shift":"^1.0.0"},"devDependencies":{"concat-stream":"^1.5.2","tape":"^4.0.0","through2":"^2.0.0"},"scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"git://github.com/mafintosh/duplexify.git"},"keywords":["duplex","streams2","streams","stream","writable","readable","async"],"author":{"name":"Mathias Buus"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/duplexify/issues"},"homepage":"https://github.com/mafintosh/duplexify","gitHead":"197f4b78ef90a78bcf7ec9799bb3f517811a952e","_id":"duplexify@4.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"integrity":"sha512-30gnPrBwCIjXLKHz8SyIIyv4JLEneQKFQcyfhPZxd/e2O3qi0kq/k9AEksUuTsrRmpGJTHwWO7o/sM92K7P4Rw==","shasum":"b26c51659c83cb03d78c3e70acef202dede7c031","tarball":"http://registry-npm.ywwl.com/duplexify/download/duplexify-4.1.0.tgz","fileCount":7,"unpackedSize":18154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc/49VCRA9TVsSAnZWagAAKFgP/1EO4Kny9+l9yF3JfJe7\n796HuV1BomEix1tH4HaywixbcE93pYUvq6/iX0TrMZ1iR1dcLnqOvND35z+9\nc+b0w7WgBhQt8FIrPVXtFKliz+KbQUeqZH4ZAO9QkJxf1hvv3h3pwdAkFJQL\n7KdmIRcaci0//bXctnXGxs9VYJcKGu4lzDDk29h0U40n47zybAmrN2944jY5\nUPTv1MruZ6QGyjm9jDfqPYyPGG1XzzPdLp/WS5m6KtGJ0rPqllwa/QDaPopu\nsaejN5OaB1Qur3QQT8gCR+SUqgVcKIHCb71wUddCGyPdS2it2wcvVfHCseFo\n72yTiF2pU8qGK8E/ndBL4PFDNzgSH+IzzPmQjussEymjq8pPHHf1bBT3pvCe\ncNGKfzhbeDI1iWFmn82ry9qRm5Gk25aXdQ3fOKn7QaVhC/VGgLYh7MBczsG7\nQtkLBGWGIzLptIRWf93nIaMwUaN1bsZLCabS+kbdAeO5++pTlnrYPBnMBLN4\nNhFz1W56p2+I62c1ckZMlQ5zKpJNA5eZ04zg+XTiQONVJyo/L9dRgil3KUQr\nnadtUW2iOOMkhXwotCKQCFVN5Khf1xprxDxQ14K6CIui7PqvwGclI1pxf2Hb\nXXXufrk5l5huIzAdWLcKEJzxUw+wL93UgXo+9cNFaDoBU/FNqzyZAeYGlXuA\nINkE\r\n=vLGs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIErk5x/FH9TImn+95hSAagNTTxJihtIS35BuqEFAClV7AiEAmsTjW71y8bn0xln9fDCqYu5Nhqa9xP04PMMrbNwWsGQ="}],"size":5199,"noattachment":false,"key":"/duplexify/-/duplexify-4.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/duplexify_4.1.0_1560252244402_0.8046017340355003"},"_hasShrinkwrap":false,"readme":"# duplexify\n\nTurn a writeable and readable stream into a single streams2 duplex stream.\n\nSimilar to [duplexer2](https://github.com/deoxxa/duplexer2) except it supports both streams2 and streams1 as input\nand it allows you to set the readable and writable part asynchronously using `setReadable(stream)` and `setWritable(stream)`\n\n```\nnpm install duplexify\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/duplexify.svg?style=flat)](http://travis-ci.org/mafintosh/duplexify)\n\n## Usage\n\nUse `duplexify(writable, readable, streamOptions)` (or `duplexify.obj(writable, readable)` to create an object stream)\n\n``` js\nvar duplexify = require('duplexify')\n\n// turn writableStream and readableStream into a single duplex stream\nvar dup = duplexify(writableStream, readableStream)\n\ndup.write('hello world') // will write to writableStream\ndup.on('data', function(data) {\n  // will read from readableStream\n})\n```\n\nYou can also set the readable and writable parts asynchronously\n\n``` js\nvar dup = duplexify()\n\ndup.write('hello world') // write will buffer until the writable\n                         // part has been set\n\n// wait a bit ...\ndup.setReadable(readableStream)\n\n// maybe wait some more?\ndup.setWritable(writableStream)\n```\n\nIf you call `setReadable` or `setWritable` multiple times it will unregister the previous readable/writable stream.\nTo disable the readable or writable part call `setReadable` or `setWritable` with `null`.\n\nIf the readable or writable streams emits an error or close it will destroy both streams and bubble up the event.\nYou can also explicitly destroy the streams by calling `dup.destroy()`. The `destroy` method optionally takes an\nerror object as argument, in which case the error is emitted as part of the `error` event.\n\n``` js\ndup.on('error', function(err) {\n  console.log('readable or writable emitted an error - close will follow')\n})\n\ndup.on('close', function() {\n  console.log('the duplex stream is destroyed')\n})\n\ndup.destroy() // calls destroy on the readable and writable part (if present)\n```\n\n## HTTP request example\n\nTurn a node core http request into a duplex stream is as easy as\n\n``` js\nvar duplexify = require('duplexify')\nvar http = require('http')\n\nvar request = function(opts) {\n  var req = http.request(opts)\n  var dup = duplexify(req)\n  req.on('response', function(res) {\n    dup.setReadable(res)\n  })\n  return dup\n}\n\nvar req = request({\n  method: 'GET',\n  host: 'www.google.com',\n  port: 80\n})\n\nreq.end()\nreq.pipe(process.stdout)\n```\n\n## License\n\nMIT\n\n## Related\n\n`duplexify` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.\n","publish_time":1560252244564,"_cnpm_publish_time":1560252244564,"dist-tags":{"latest":"4.1.3"}}