{"id":13454509,"url":"https://github.com/almost/through2-concurrent","last_synced_at":"2025-04-05T21:09:29.960Z","repository":{"id":21711109,"uuid":"25032615","full_name":"almost/through2-concurrent","owner":"almost","description":"Simple Node.JS stream (streams2) Transform that runs the transform functions concurrently (with a set max concurrency)","archived":false,"fork":false,"pushed_at":"2020-08-11T20:24:18.000Z","size":26,"stargazers_count":74,"open_issues_count":4,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T20:07:31.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/almost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-10T11:27:14.000Z","updated_at":"2022-10-03T17:28:33.000Z","dependencies_parsed_at":"2022-08-17T18:40:55.908Z","dependency_job_id":null,"html_url":"https://github.com/almost/through2-concurrent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almost%2Fthrough2-concurrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almost%2Fthrough2-concurrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almost%2Fthrough2-concurrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almost%2Fthrough2-concurrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almost","download_url":"https://codeload.github.com/almost/through2-concurrent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399878,"owners_count":20932880,"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-07-31T08:00:54.835Z","updated_at":"2025-04-05T21:09:29.919Z","avatar_url":"https://github.com/almost.png","language":"JavaScript","readme":"through2-concurrent\n===================\n\n[![NPM](https://nodei.co/npm/through2-concurrent.png?downloads\u0026downloadRank)](https://nodei.co/npm/through2-concurrent/)\n\nA simple way to create a Node.JS Transform stream which processes in\nparallel. You can limit the concurrency (default is 16) and order is\n*not* preserved (so chunks/objects can end up in a different order to\nthe order they started in if the transform functions take different\namounts of time).\n\nBuilt using [through2](https://github.com/rvagg/through2) and has the\nsame API with the addition of a `maxConcurrency` option.\n\nNon-`objectMode` streams are supported for completeness but I'm not\nsure they'd be useful for anything.\n\nWritten by Thomas Parslow\n([almostobsolete.net](http://almostobsolete.net) and\n[tomparslow.co.uk](http://tomparslow.co.uk)) as part of Active Inbox\n([activeinboxhq.com](http://activeinboxhq.com/)).\n\n[![Build Status](https://travis-ci.org/almost/through2-concurrent.svg)](https://travis-ci.org/almost/through2-concurrent)\n\n\nInstall\n-------\n\n```bash\nnpm install --save through2-concurrent\n```\n\nExamples\n--------\n\nProcess lines from a CSV in parallel. The order the results end up in\nthe `all` variable is not deterministic.\n\n```javascript\nvar through2Concurrent = require('through2-concurrent');\n\nvar all = [];\n\nfs.createReadStream('data.csv')\n  .pipe(csv2())\n  .pipe(through2Concurrent.obj(\n    {maxConcurrency: 10},\n    function (chunk, enc, callback) {\n      var self = this;\n      someThingAsync(chunk, function (newChunk) {\n        self.push(newChunk);\n        callback();\n      });\n  }))\n  .on('data', function (data) {\n    all.push(data)\n  })\n  .on('end', function () {\n    doSomethingSpecial(all)\n  })\n```\n\n\nContributing\n------------\n\nFixed or improved stuff? Great! Send me a pull request [through GitHub](http://github.com/almost/through2-concurrent)\nor get in touch on Twitter [@almostobsolete][#tom-twitter] or email at tom@almostobsolete.net\n\n[#tom]: http://www.almostobsolete.net\n[#tom-twitter]: https://twitter.com/almostobsolete\n","funding_links":[],"categories":["Packages","Repository","包","Modules","目录","Streams"],"sub_categories":["Streams","文件流","流处理","流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmost%2Fthrough2-concurrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmost%2Fthrough2-concurrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmost%2Fthrough2-concurrent/lists"}