{"_id":"syncthrough","_rev":"1385926","name":"syncthrough","description":"A Transform stream that is sync, and very fast","dist-tags":{"latest":"0.5.0"},"maintainers":[{"name":"matteo.collina","email":""}],"time":{"modified":"2021-11-03T10:06:46.000Z","created":"2017-01-02T07:58:53.676Z","0.5.0":"2017-03-22T16:01:29.543Z","0.4.0":"2017-01-26T05:59:52.754Z","0.3.1":"2017-01-15T16:45:00.068Z","0.3.0":"2017-01-15T16:36:56.789Z","0.2.0":"2017-01-10T20:40:23.524Z","0.1.2":"2017-01-03T16:14:59.385Z","0.1.1":"2017-01-02T15:16:50.963Z","0.1.0":"2017-01-02T07:58:53.676Z"},"users":{"matteo.collina":true},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"versions":{"0.5.0":{"name":"syncthrough","version":"0.5.0","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && nyc tape test.js | tap-spec","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"buffer-shims":"^1.0.0","codecov":"^2.0.0","end-of-stream":"^1.1.0","fastbench":"^1.0.1","nyc":"^10.0.0","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^6.0.0","standard":"^9.0.0","tap-spec":"^4.1.1","tape":"^4.6.3","through":"^2.3.8","through2":"^2.0.3"},"dependencies":{"inherits":"^2.0.3","listenercount":"^1.0.1","process-nextick-args":"^1.0.7"},"gitHead":"e8b5d37115788fe17239a4d0fc42313d28018da1","_id":"syncthrough@0.5.0","_shasum":"9d135d389cf4589a78faaae345353fe612c8cea0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9d135d389cf4589a78faaae345353fe612c8cea0","size":6511,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.5.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/syncthrough-0.5.0.tgz_1490198487598_0.1780101985204965"},"directories":{},"publish_time":1490198489543,"_cnpm_publish_time":1490198489543,"_hasShrinkwrap":false},"0.4.0":{"name":"syncthrough","version":"0.4.0","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && nyc tape test.js | tap-spec","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"buffer-shims":"^1.0.0","codecov":"^1.0.1","end-of-stream":"^1.1.0","fastbench":"^1.0.1","nyc":"^10.0.0","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through":"^2.3.8","through2":"^2.0.3"},"dependencies":{"inherits":"^2.0.3","listenercount":"^1.0.1","process-nextick-args":"^1.0.7"},"gitHead":"ce2410100cc9cbbf9274161b6ebade011b5665ff","_id":"syncthrough@0.4.0","_shasum":"876364ac73a3ddab7ce4b2c8108876b1393dd9b0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"876364ac73a3ddab7ce4b2c8108876b1393dd9b0","size":6402,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.4.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/syncthrough-0.4.0.tgz_1485410392166_0.032313648611307144"},"directories":{},"publish_time":1485410392754,"_cnpm_publish_time":1485410392754,"_hasShrinkwrap":false},"0.3.1":{"name":"syncthrough","version":"0.3.1","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && nyc tape test.js | tap-spec","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"buffer-shims":"^1.0.0","codecov":"^1.0.1","end-of-stream":"^1.1.0","fastbench":"^1.0.1","nyc":"^10.0.0","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through2":"^2.0.3"},"dependencies":{"inherits":"^2.0.3","listenercount":"^1.0.1","process-nextick-args":"^1.0.7"},"gitHead":"36eafbedf6a8904822fb3f84633c1d88ab967782","_id":"syncthrough@0.3.1","_shasum":"740055e3e849c9b47817e63651db989a4e850511","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"740055e3e849c9b47817e63651db989a4e850511","size":6311,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.3.1.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/syncthrough-0.3.1.tgz_1484498699493_0.9382608442101628"},"directories":{},"publish_time":1484498700068,"_cnpm_publish_time":1484498700068,"_hasShrinkwrap":false},"0.3.0":{"name":"syncthrough","version":"0.3.0","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && nyc tape test.js | tap-spec","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"buffer-shims":"^1.0.0","codecov":"^1.0.1","end-of-stream":"^1.1.0","fastbench":"^1.0.1","nyc":"^10.0.0","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through2":"^2.0.3"},"dependencies":{"inherits":"^2.0.3","process-nextick-args":"^1.0.7"},"gitHead":"71e3b72acc2de884fe7cd0153f791285c9e9bdba","_id":"syncthrough@0.3.0","_shasum":"d6d54bc669f07cabc8cf131379a09f567ff17370","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"d6d54bc669f07cabc8cf131379a09f567ff17370","size":6279,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.3.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/syncthrough-0.3.0.tgz_1484498214867_0.45518214371986687"},"directories":{},"publish_time":1484498216789,"_cnpm_publish_time":1484498216789,"_hasShrinkwrap":false},"0.2.0":{"name":"syncthrough","version":"0.2.0","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && nyc tape test.js | tap-spec","coverage":"nyc report --reporter=text-lcov > coverage.lcov && codecov"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"buffer-shims":"^1.0.0","codecov":"^1.0.1","end-of-stream":"^1.1.0","fastbench":"^1.0.1","nyc":"^10.0.0","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through2":"^2.0.3"},"dependencies":{"inherits":"^2.0.3","process-nextick-args":"^1.0.7"},"gitHead":"23f3190d2a38b736d7e023820248f4c127e832fc","_id":"syncthrough@0.2.0","_shasum":"7ce5906b84a97996536e56e479ddfb51ff4c05f2","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"7ce5906b84a97996536e56e479ddfb51ff4c05f2","size":5884,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.2.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/syncthrough-0.2.0.tgz_1484080821514_0.767828255193308"},"directories":{},"publish_time":1484080823524,"_cnpm_publish_time":1484080823524,"_hasShrinkwrap":false},"0.1.2":{"name":"syncthrough","version":"0.1.2","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"end-of-stream":"^1.1.0","fastbench":"^1.0.1","inherits":"^2.0.3","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through2":"^2.0.3"},"dependencies":{"buffer-shims":"^1.0.0","inherits":"^2.0.3","process-nextick-args":"^1.0.7"},"gitHead":"7a9c9e3a9a759e0f7fbd6d057ba2f848001ee89d","_id":"syncthrough@0.1.2","_shasum":"08250bfb6ab9d53a4b27b4a3c1e4dd6f3c6b1b87","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"08250bfb6ab9d53a4b27b4a3c1e4dd6f3c6b1b87","size":5536,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.1.2.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/syncthrough-0.1.2.tgz_1483460098663_0.04458823963068426"},"directories":{},"publish_time":1483460099385,"_cnpm_publish_time":1483460099385,"_hasShrinkwrap":false},"0.1.1":{"name":"syncthrough","version":"0.1.1","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"end-of-stream":"^1.1.0","fastbench":"^1.0.1","inherits":"^2.0.3","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3","through2":"^2.0.3"},"dependencies":{"buffer-shims":"^1.0.0","inherits":"^2.0.3","process-nextick-args":"^1.0.7"},"gitHead":"961d4180eca0a18b851552533bfc7489d4b8248b","_id":"syncthrough@0.1.1","_shasum":"c224b7321defdff372ef978263c9fccb9a355d7d","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"c224b7321defdff372ef978263c9fccb9a355d7d","size":5376,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.1.1.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/syncthrough-0.1.1.tgz_1483370210370_0.21631279168650508"},"directories":{},"publish_time":1483370210963,"_cnpm_publish_time":1483370210963,"_hasShrinkwrap":false},"0.1.0":{"name":"syncthrough","version":"0.1.0","description":"A Transform stream that is sync, and very fast","main":"syncthrough.js","scripts":{"test":"standard | snazzy && tape test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mcollina/syncthrough.git"},"keywords":["streams","stream","transform","through","through2"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"homepage":"https://github.com/mcollina/syncthrough#readme","devDependencies":{"end-of-stream":"^1.1.0","inherits":"^2.0.3","pre-commit":"^1.2.2","pump":"^1.0.2","readable-stream":"^2.2.2","snazzy":"^5.0.0","standard":"^8.6.0","tap-spec":"^4.1.1","tape":"^4.6.3"},"dependencies":{"buffer-shims":"^1.0.0","inherits":"^2.0.3","process-nextick-args":"^1.0.7"},"gitHead":"2c3f4bb79b6942fdb2e7918fd702a81b0c432c7c","_id":"syncthrough@0.1.0","_shasum":"9652ca241b8214f05a7ae7e9a4cfed86c672a2b6","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9652ca241b8214f05a7ae7e9a4cfed86c672a2b6","size":4820,"noattachment":false,"key":"/syncthrough/-/syncthrough-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/syncthrough/download/syncthrough-0.1.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/syncthrough-0.1.0.tgz_1483343933095_0.8213939790148288"},"directories":{},"publish_time":1483343933676,"_cnpm_publish_time":1483343933676,"_hasShrinkwrap":false}},"readme":"# syncthrough&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/syncthrough.svg?branch=master)](https://travis-ci.org/mcollina/syncthrough)&nbsp;&nbsp;[![codecov](https://codecov.io/gh/mcollina/syncthrough/branch/master/graph/badge.svg)](https://codecov.io/gh/mcollina/syncthrough)\n\nTransform your data as it pass by, synchronously.\n\n**syncthrough** is a synchronous transform stream, similar to [Transform\nstream][transform] and [through2](https://github.com/rvagg/through2), but with a synchronous processing function.\n**syncthrough** enforces backpressure, but it maintain no internal\nbuffering, allowing much greater throughput.\nIn fact, it delivers 10x performance over a standard\n[`Transform`][transform].\n\nBecause of the [caveats](#caveats), it is best used in combination of\n[`pipe()`][pipe] or [`pump()`][pump].\n\n## Install\n\n```\nnpm i syncthrough --save\n```\n\n## Example\n\n```js\n'use strict'\n\nvar fs = require('fs')\nvar syncthrough = require('syncthrough')\n\nfs.createReadStream(__filename)\n  .pipe(syncthrough(function (chunk) {\n    // there is no callback here\n    // you can return null to end the stream\n    // returning undefined will let you skip this chunk\n    return chunk.toString().toUpperCase()\n  }))\n  .pipe(process.stdout, { end: false })\n```\n\n## API\n\n### syncthrough([transform(chunk)], [flush()])\n\nReturns a new instance of `syncthrough`, where `transform(chunk)` is the\ntransformation that will be applied to all incoming chunks.\n\nThe default `transform` function is:\n\n```js\nfunction (chunk) {\n  return chunk\n}\n```\n\nIf it returns `null`, the stream will be closed. If it returns\n`undefined`, the chunk will be skipped.\n\nThere is currently no way to split an incoming chunk into multiple\nchunks.\n\nThe `flush()` function will be called before the transform sends `end()`\non the destination.\n\n### syncthrough([transform(object)], [flush()])\n\nReturns a new instance of `syncthrough`, where `transform(object)` is the\ntransformation that will be applied to all incoming objects.\n\nSyncthrough is compatible with Streams in [Object Mode](https://nodejs.org/api/stream.html#stream_object_mode),\nthe API is exactly the same, simply expect objects instead of buffer chunks.\n\n### instance.push(chunk)\n\nPush a chunk to the destination.\n\n## Caveats\n\nThe API is the same of a streams 3 [`Transform`][transform], with some major differences:\n\n1. *backpressure is enforced*, and the instance performs no buffering,\n   e.g. when `write()` cannot be called after it returns false or it will `throw`\n   (you need to wait for a `'drain'` event).\n2. It does not inherits from any of the Streams classes, and it does not\n   have `_readableState` nor `_writableState`.\n3. it does not have a `read(n)` method, nor it emits the\n   `'readable'` event, the data is pushed whenever ready.\n\n<a name=\"acknowledgements\"></a>\n## Acknowledgements\n\nThis project was kindly sponsored by [nearForm](http://nearform.com).\n\n## License\n\nMIT\n\n[transform]: https://nodejs.org/api/stream.html#stream_class_stream_transform\n[pipe]: https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n[pump]: https://github.com/mafintosh/pump\n","_attachments":{},"homepage":"https://github.com/mcollina/syncthrough#readme","bugs":{"url":"https://github.com/mcollina/syncthrough/issues"},"license":"MIT"}