{"id":26361457,"url":"https://github.com/snatalenko/async-parallel-pipe","last_synced_at":"2025-03-16T17:38:11.240Z","repository":{"id":282266804,"uuid":"948023799","full_name":"snatalenko/async-parallel-pipe","owner":"snatalenko","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-13T16:26:39.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T17:37:01.841Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snatalenko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T16:11:17.000Z","updated_at":"2025-03-13T16:26:43.000Z","dependencies_parsed_at":"2025-03-13T17:37:11.635Z","dependency_job_id":"32a48eae-89cb-4351-97ea-16d1452b963a","html_url":"https://github.com/snatalenko/async-parallel-pipe","commit_stats":null,"previous_names":["snatalenko/async-parallel-pipe"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snatalenko%2Fasync-parallel-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snatalenko%2Fasync-parallel-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snatalenko%2Fasync-parallel-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snatalenko%2Fasync-parallel-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snatalenko","download_url":"https://codeload.github.com/snatalenko/async-parallel-pipe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243909200,"owners_count":20367533,"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":"2025-03-16T17:37:47.438Z","updated_at":"2025-03-16T17:38:11.234Z","avatar_url":"https://github.com/snatalenko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Async Parallel Pipe\n===================\n\n[![NPM Version](https://img.shields.io/npm/v/async-parallel-pipe.svg)](https://www.npmjs.com/package/async-parallel-pipe)\n[![Audit](https://github.com/snatalenko/async-parallel-pipe/actions/workflows/audit.yml/badge.svg)](https://github.com/snatalenko/async-parallel-pipe/actions/workflows/audit.yml)\n[![Tests](https://github.com/snatalenko/async-parallel-pipe/actions/workflows/tests.yml/badge.svg)](https://github.com/snatalenko/async-parallel-pipe/actions/workflows/tests.yml)\n[![Coverage Status](https://coveralls.io/repos/github/snatalenko/async-parallel-pipe/badge.svg?branch=main)](https://coveralls.io/github/snatalenko/async-parallel-pipe?branch=main)\n[![NPM Downloads](https://img.shields.io/npm/dm/async-parallel-pipe.svg)](https://www.npmjs.com/package/async-parallel-pipe)\n\nThe function pulls input values from async iterable input, runs async action, and returns async iterable output in a same order as input was received.\n\nHere is an example that requests random numbers from random.org with not more than 2 concurrent requests at a time:\n\n```js\nconst { parallelPipe } = require('async-parallel-pipe');\nconst fetch = require('node-fetch');\n\nasync function getRandomNumber(maxValue) {\n\tconst response = await fetch(`https://www.random.org/integers/?num=1\u0026min=0\u0026max=${maxValue}\u0026col=1\u0026base=10\u0026format=plain\u0026rnd=new`);\n\tconst value = await response.text();\n\treturn value;\n}\n\n(async function main() {\n\tconst inputIterable = [1, 2, 3, 4, 5].values();\n\tconst concurrentThreads = 2;\n\n\tconst outputIterable = parallelPipe(inputIterable, concurrentThreads, getRandomNumber);\n\n\tfor await (const value of outputIterable)\n\t\tconsole.log(value);\n}());\n```\n\nSince input and output are generators, multiple parallel executions can be chained together:\n\n```js\nconst inputIterable = [1, 2, 3, 4, 5].values();\nconst multipliedIterable = parallelPipe(inputIterable, 3, el =\u003e el * 100);\nconst sumIterable = parallelPipe(multipliedIterable, 3, el =\u003e el + 2);\n\nfor await (const value of sumIterable)\n\tconsole.log(value);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnatalenko%2Fasync-parallel-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnatalenko%2Fasync-parallel-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnatalenko%2Fasync-parallel-pipe/lists"}