{"id":15483406,"url":"https://github.com/hackergrrl/collect-transform-stream","last_synced_at":"2025-09-16T04:13:24.307Z","repository":{"id":57203168,"uuid":"86090973","full_name":"hackergrrl/collect-transform-stream","owner":"hackergrrl","description":"create a transform stream that runs a function over all collected elements","archived":false,"fork":false,"pushed_at":"2017-03-24T17:19:58.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T05:39:14.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackergrrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-24T16:53:48.000Z","updated_at":"2017-03-24T23:00:11.000Z","dependencies_parsed_at":"2022-08-31T23:21:44.292Z","dependency_job_id":null,"html_url":"https://github.com/hackergrrl/collect-transform-stream","commit_stats":null,"previous_names":["noffle/collect-transform-stream"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fcollect-transform-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fcollect-transform-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fcollect-transform-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fcollect-transform-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackergrrl","download_url":"https://codeload.github.com/hackergrrl/collect-transform-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247385703,"owners_count":20930600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T05:15:07.338Z","updated_at":"2025-09-16T04:13:19.258Z","avatar_url":"https://github.com/hackergrrl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# collect-transform-stream\n\n\u003e create a transform stream that runs a function over all collected elements\n\nSometimes you end up in a situation where you have a stream pipeline like\n\n```js\npump(source, transform, destination)\n```\n\nbut you have another transform function that needs to process all elements in\nthe stream before passing them on, e.g. filtering duplicates from an unordered\nstream:\n\n```js\npump(source, collectAndFilter, transform, destination)\n```\n\n`collect-transform-stream` is a tiny module that provides this.\n\n## Usage\n\n```js\nvar uniq = require('uniq')\nvar from = require('from2')\nvar collect = require('concat-stream')\nvar collectTransform = require('collect-transform-stream')\n\nvar source = from.obj(new Array(500).fill(0).map(function () {\n  return Math.floor(Math.random() * 10)\n}))\n\nvar dedupe = collectTransform(function (nums) {\n  return uniq(nums)\n})\n\nvar dest = collect({encoding:'object'}, console.log)\n\nsource.pipe(dedupe).pipe(dest)\n```\n\noutputs\n\n```\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n```\n\n## API\n\n```js\nvar collect = require('collect-transform-stream')\n```\n\n### collect(fn[, cb])\n\nCreate a Transform stream that runs the function `fn` on all incoming objects at\nonce, then pipes elements individually onward to the next stream in the\npipeline.\n\nUse `return result` to use synchronously; call `cb(err, result)` to use\nasynchronously.\n\n## Install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```\n$ npm install collect-transform-stream\n```\n\n## License\n\nISC\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fcollect-transform-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackergrrl%2Fcollect-transform-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fcollect-transform-stream/lists"}