{"dist":{"shasum":"c31cfde553dc96121169a3f4e14054e351959d43","tarball":"https://registry.npmjs.org/duplex/-/duplex-0.2.2.tgz","integrity":"sha512-PdqGzGFp7JoBNn31cVmhB8EBx916OnmhQSEx2rQSt8v6KAQtoahJG2Se6UQJELdTh14R5BuCUb3gK/CDISjmeQ==","signatures":[{"sig":"MEQCIBlUqR1y6jnvEvSWcDgntJNd+yHZFvpp0eU5Qt6W6/4FAiBOs4srkac3GnbO+j56yO8AMmyMqBSIDhLA6rxEvARoqQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"name":"duplex","author":{"url":"http://dominictarr.com","name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"readme":"# duplex\n\n<img src=https://secure.travis-ci.org/dominictarr/duplex.png?branch=master>\n\n\nSimple base class for [duplex](https://github.com/dominictarr/stream-spec#duplex) streams, that automatically handles pausing and buffering.\n\n``` js\n\nvar duplex = require('duplex')\n\nvar d = duplex()\n  .on('_data', function (data) {\n    d.sendData(data)\n  })\n  .on('_end', function () {\n    d.sendEnd()\n  })\n```\n\n## API\n\n### on('_data', function (data))\n\nEmitted when `write(data)` is called.\n\n### on('_end', function ())\n\nEmitted when `end()` is called\n\n### _data(data)\n\nAdd `data` to the output buffer. \n`'data'` will be emitted if the stream is not paused.\n\n### _end()\n\nCap the output buffer. no more data events may be added.\n`'end'` will be emitted after the buffer drains, \nor immediately, if the stream is unpaused.\n\n### pause()\n\nPause the readable side of the stream.  \nThis will prevent it from emitting 'data' or or 'end'\nuntil resume is called.\n\n### resume()\nUnpause the readable side of the stream.  \nThis will allow it to emit `'data'` and `'end'` events.  \nIf there there is any data in the output buffer,  \nIt will start draining immediately.  \n\n## _pause(), emit('pause')\n\nPause the writable side of the stream. this will cause write() to return false,\nso any streams piping into this stream will pause after thier next write.\n\n## emit('drain')\n\nUnpause the writable side of the stream. This will cause `Stream#pipe` to call `resume()`\non any streams piping to this stream.\n\n## Automatic Behaviours\n\n`destroy()` is called automatically after both sides of the stream have ended.\n`write()==false` after the stream emits `'pause'`,  \nand `write()==true` after the stream emits `'drain'`.\nThe user is responsible for emitting `'pause'` and `'drain'`.\n\n`resume()` will be called on `nextTick`, unless `pause()` was called manually.\nIf `resume()` is manually called before the `nextTick`, the stream will start emitting data\nimmediately.\n\n## License\n\nMIT / APACHE 2\n","scripts":{"test":"node test/index.js"},"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"homepage":"https://github.com/dominictarr/duplex","repository":{"url":"git://github.com/dominictarr/duplex.git","type":"git"},"_npmVersion":"1.1.59","description":"base class for a duplex stream","directories":{},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_id":"duplex@0.2.2","version":"0.2.2"}