{"_id":"throughv","_rev":"8-32964ccd40571e7d6cf7925b1010ec28","name":"throughv","description":"Bulk through","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"throughv","version":"1.0.0","description":"Bulk through","main":"throughv.js","scripts":{"test":"standard && tape test.js | faucet"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"keywords":["bulk","through","writev"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/throughv/issues"},"homepage":"https://github.com/mcollina/throughv#readme","dependencies":{"fastparallel":"^2.2.1","readable-stream":"^2.0.4","inherits":"~2.0.1"},"devDependencies":{"callback-stream":"^1.1.0","faucet":"0.0.1","pre-commit":"^1.1.2","standard":"^5.4.1","tape":"^4.2.2"},"gitHead":"472adae3a4261c86a12fb572c8cfa79a5bac02d0","_id":"throughv@1.0.0","_shasum":"9d5e09a6d25e6a79baa60218ca1fd918b15fa81e","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9d5e09a6d25e6a79baa60218ca1fd918b15fa81e","tarball":"https://registry.npmjs.org/throughv/-/throughv-1.0.0.tgz","integrity":"sha512-IW1oYB2dMae8Y4vVkbK4pD5Qgl+E30rJ2ufX/dGYA/JK6UYOrsQiIWbWmsn4TSZWndkCey0eQxoyARm3rBUNCw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDn73CSncYtcL6r/3iAohZzW5dXV+RZ9qJWdrs7V1s9uAIhALj3k/UCr2GVhL9rxlXVrevM1/me9V581FFa8LAWfHH6"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{}},"1.0.1":{"name":"throughv","version":"1.0.1","description":"Bulk through","main":"throughv.js","scripts":{"test":"standard && tape test.js | faucet"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"keywords":["bulk","through","writev"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/throughv/issues"},"homepage":"https://github.com/mcollina/throughv#readme","dependencies":{"fastparallel":"^2.2.1","readable-stream":"^2.0.4","inherits":"~2.0.1"},"devDependencies":{"callback-stream":"^1.1.0","faucet":"0.0.1","pre-commit":"^1.1.2","standard":"^5.4.1","tape":"^4.2.2"},"gitHead":"138989857edce6141e1e9fd106e785fd9bbcd49f","_id":"throughv@1.0.1","_shasum":"39c77dc7f23cd53d46854decbf08226be55811aa","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"39c77dc7f23cd53d46854decbf08226be55811aa","tarball":"https://registry.npmjs.org/throughv/-/throughv-1.0.1.tgz","integrity":"sha512-klttzfbnJRcSFJkD8qALHpafw20GthP6TJN2zCIstC5HQDBVlh0cDzLng1hHU1PqKBmYF7qOhg3Fn03F7LM59Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2um2pPUS5ubWjy9benppYo6DLUia7x0UcX/UHxJH8rgIhAKnV+NxurUKmQGkoV9oBGEmXhAo4G6t7vOvdTlBvO63Q"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{}},"1.0.2":{"name":"throughv","version":"1.0.2","description":"Bulk through","main":"throughv.js","scripts":{"test":"standard && tape test.js | faucet"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"keywords":["bulk","through","writev"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/throughv/issues"},"homepage":"https://github.com/mcollina/throughv#readme","dependencies":{"fastparallel":"^2.2.1","readable-stream":"^2.0.4","inherits":"~2.0.1"},"devDependencies":{"callback-stream":"^1.1.0","faucet":"0.0.1","pre-commit":"^1.1.2","standard":"^5.4.1","tape":"^4.2.2"},"gitHead":"7b29318fddff72164c6fecc048263c9b14f526c0","_id":"throughv@1.0.2","_shasum":"9b1978b714c3eae3aef7e252c1fda356691eaf71","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9b1978b714c3eae3aef7e252c1fda356691eaf71","tarball":"https://registry.npmjs.org/throughv/-/throughv-1.0.2.tgz","integrity":"sha512-lWFNZvqCo0tHcTnUzhkRkUhim09IQ7hAQifGDhrbmnzhvhqLA7VReQcWUEhCkNXbyK2n10f5y5RGJfu6DL18wA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGpZ/lfxvSbU74h7NFU9M3RZc1h3KwQlgukEpzNw9zTEAiBdQRmN52JgpexWmDhb0Q17emr5uf8b9B7rxx4OhbVheQ=="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{}},"1.0.3":{"name":"throughv","version":"1.0.3","description":"Bulk through","main":"throughv.js","scripts":{"test":"standard && tape test.js | faucet"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"keywords":["bulk","through","writev"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/throughv/issues"},"homepage":"https://github.com/mcollina/throughv#readme","dependencies":{"fastparallel":"^2.2.1","readable-stream":"^2.0.4","inherits":"~2.0.1"},"devDependencies":{"callback-stream":"^1.1.0","faucet":"0.0.1","pre-commit":"^1.1.2","standard":"^5.4.1","tape":"^4.2.2"},"gitHead":"c58db531173e5b8523af054f11e649090168e114","_id":"throughv@1.0.3","_shasum":"5f0c8719dab18bd80fe3002a7a3a6c9543ce46b5","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"5f0c8719dab18bd80fe3002a7a3a6c9543ce46b5","tarball":"https://registry.npmjs.org/throughv/-/throughv-1.0.3.tgz","integrity":"sha512-Ch5yZNY1DqTWXpsuboKg24oSrAuPsMYYC9bNEGIhAnlT6EqOzBaWuJ/aaZxQRX/6FYRudrf27WDKp5GAJp57ZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJuMD3/AAIcXyAF3E2XnGDeh0oWBkRdz7KgeIFYvT6YgIhAOZfjb8LUxNZzy2YJAD5RJ2JX4uOpEK9H5fSb0jC4C8E"}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{}},"1.0.4":{"name":"throughv","version":"1.0.4","description":"Bulk through","main":"throughv.js","scripts":{"test":"standard && tape test.js | faucet"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"keywords":["bulk","through","writev"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/throughv/issues"},"homepage":"https://github.com/mcollina/throughv#readme","dependencies":{"fastparallel":"^2.3.0","inherits":"^2.0.3","readable-stream":"^2.3.6"},"devDependencies":{"callback-stream":"^1.1.0","safe-buffer":"^5.1.2","faucet":"0.0.1","pre-commit":"^1.2.2","standard":"^12.0.1","tape":"^4.9.1"},"gitHead":"07296026d726e9fc17cb974210288249a8cfbb3e","_id":"throughv@1.0.4","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"integrity":"sha512-sbtnSX5BC0IEbDNl4K4IRtea0ujic9uRlZPFzkQ8R9Z/F1NXM4mMWk9VwbI9tIltvxD7vnFJY5L4jDyb6xVsAA==","shasum":"9396470d66b49bcc40363a6d1755ce02599608f6","tarball":"https://registry.npmjs.org/throughv/-/throughv-1.0.4.tgz","fileCount":6,"unpackedSize":18045,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbw8YqCRA9TVsSAnZWagAAX7oP/1rPf9Z3apJgbxXItsrT\nBTOImhtWvj2U19HjlApnbJt3Fu9HuDW1ENiQ23SJHlBOvUFEWuJ/w1ptYy6U\n5663TejjkiQ2YNUystsglJ1iQH0ZXsvcTlHlMKuXzJtMkHxj5U7fN5YvwrQV\nAy/Lt4UTJEeILDib3hnrk7WODDUMnd/1LepiZGF2F1LOtSXLyfcKrQl8vPWN\nx+6GPjui+hOFMRiS5/+txQ3FNoWaY70IQx7JGi7Q5KGcyXZ9WalnEPlHh/7Z\n2EQc1K7y0xcAQqd4rb8zhkYw0qIeuam8Cldpev/amfCJ8CF5z9HguQjJ84qr\nOg0XkvYX2qxfmfZ9DSc4I20m1EAnmWhQROHaTwrf6L/tD6OoVEyzdbSNXtyg\nYtypggJQw/N+y99ez2SNhrCD8cTmetZgwxDlL5BKBAvgZOOlhm/mJNJ2565+\nCceYPrT0EV8T/JpayamNe/M07SH63v8US+zaBTNBLqcwnHZhlPNq7WiX64ql\neb3ur5lU4Dd8OdbkIBCSlr84131Gwr8m0xNUbP/M6kK0pljx88s4tkou0y+a\nKyDSnpa3HSNX8WzK92AbilEt8pyXEgmuOff2ZiQxOhyDwYYm6dc3kasEVPh3\nvxgVVlIXi0Oo/iVpzPol+jHe63kv/HQ5BxfNt4EyN2ou4uhWQbT05bdGi54B\nrZsQ\r\n=Hik7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDtuiZ/b4uDfQsVMhn62gqVXy61C/xoJvGjsR9wSdCmyAiEAq0N8jXIPCv/fErFc9ORAJvVGZtxMfdsAkxCjsTbr7SE="}]},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throughv_1.0.4_1539556905297_0.4638285374937139"},"_hasShrinkwrap":false}},"readme":"# throughv\n\n**stream.Transform with parallel chunk processing**\n\nSame as [Rod Vagg](https://github.com/rvagg)'s\n[through2](https://github.com/rvagg/through2)\nbut with parallel chunk processing. `throughv` is useful to\naugment/process data\ncoming from a stream in a fast parallel fashion, e.g. fetching some\nrelevant data from a database.\n\n```js\nfs.createReadStream('ex.txt')\n  .pipe(throughv(function (chunk, enc, callback) {\n    // this happen in parallel for all chunks\n    // in the stream's buffer, the parallelism\n    // is determined by highWaterMark\n\n    for (var i = 0; i < chunk.length; i++)\n      if (chunk[i] == 97)\n        chunk[i] = 122 // swap 'a' for 'z'\n\n    setImmediate(callback, null, chunk)\n   }))\n  .pipe(fs.createWriteStream('out.txt'))\n```\n\nOr object streams:\n\n```js\nvar all = []\n\nfs.createReadStream('data.csv')\n  .pipe(csv2())\n  .pipe(throughv.obj(function (chunk, enc, callback) {\n    // this happen in parallel for all chunks\n    // in the stream's buffer, the parallelism\n    // is determined by highWaterMark\n\n    var data = {\n        name    : chunk[0]\n      , address : chunk[3]\n      , phone   : chunk[10]\n    }\n\n    setImmediate(callback, null, data)\n  }))\n  .on('data', function (data) {\n    all.push(data)\n  })\n  .on('end', function () {\n    doSomethingSpecial(all)\n  })\n```\n\nNote that `throughv.obj(fn)` is a convenience wrapper around `throughv({\nobjectMode: true }, fn)`.\n\n## Install\n\n`npm i throughv --save`\n\n## API\n\n<b><code>throughv([ options, ] [ transformFunction ] [, flushFunction\n])</code></b>\n\nConsult the\n**[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)**\ndocumentation for the exact rules of the `transformFunction` (i.e.\n`this._transform`) and the optional `flushFunction` (i.e.\n`this._flush`).\n\n### options\n\nThe options argument is optional and is passed straight through to\n`stream.Transform`. So you can use `objectMode:true` if you are\nprocessing non-binary streams (or just use `throughv.obj()`).\n\nIn order to set the maximum parallelism at which the instance will\nprocess chunks, __set highWaterMark__. It is defaulted at 16KB for\nbinary streams, and at 16 for object streams.\n\nThe `options` argument is first, unlike standard convention, because if\nI'm passing in an anonymous function then I'd prefer for the options\nargument to not get lost at the end of the call:\n\n```js\nfs.createReadStream('/tmp/important.dat')\n  .pipe(throughv({ objectMode: true, allowHalfOpen: false },\n    function (chunk, enc, cb) {\n      cb(null, 'wut?')\n    }\n  )\n  .pipe(fs.createWriteStream('/tmp/wut.txt'))\n```\n\n### transformFunction\n\nThe `transformFunction` must have the following signature: `function\n(chunk, encoding, callback) {}`. A minimal implementation should call\nthe `callback` function to indicate that the transformation is done,\neven if that transformation means discarding the chunk.\n\nTo queue a new chunk, call `callback(err, data) `&mdash;this **must be called\nonly once for each chunk**.\n\nIf you **do not provide a `transformFunction`** then you will get a\nsimple pass-through stream.\n\n### flushFunction\n\nThe optional `flushFunction` is provided as the last argument (2nd or\n3rd, depending on whether you've supplied options) is called just prior\nto the stream ending. Can be used to finish up any processing that may\nbe in progress.\n\n```js\nfs.createReadStream('/tmp/important.dat')\n  .pipe(throughv(\n    function (chunk, enc, cb) { cb(null, chunk) }, // transform is a\nnoop\n    function (cb) { // flush function\n      this.push('tacking on an extra buffer to the end');\n      cb();\n    }\n  ))\n  .pipe(fs.createWriteStream('/tmp/wut.txt'));\n```\n\n<b><code>new Throughv(options)</code></b>\n\nThis has the same api of\n[Transform](https://nodejs.org/api/stream.html#stream_class_stream_transform),\nso you can subclass it if you want\n\n## Acknowledgements\n\nthroughv is sponsored by [nearForm](http://nearform.com).\n\nCode was taken and adapted from\n[node.js](http://nodejs.org), [readable-stream](http://npm.im/readable-stream), and [through2](http://npm.im/through2).\n\n## License\n\nMIT\n","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"time":{"modified":"2022-06-27T06:25:07.778Z","created":"2015-12-24T11:31:04.496Z","1.0.0":"2015-12-24T11:31:04.496Z","1.0.1":"2015-12-24T11:33:30.763Z","1.0.2":"2015-12-26T10:38:22.535Z","1.0.3":"2015-12-26T10:40:49.947Z","1.0.4":"2018-10-14T22:41:45.511Z"},"homepage":"https://github.com/mcollina/throughv#readme","keywords":["bulk","through","writev"],"repository":{"type":"git","url":"git+https://github.com/mcollina/throughv.git"},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"bugs":{"url":"https://github.com/mcollina/throughv/issues"},"license":"MIT","readmeFilename":"README.md"}