{"id":16146572,"url":"https://github.com/voxpelli/buffered-async-iterable","last_synced_at":"2025-09-13T01:31:48.817Z","repository":{"id":170760046,"uuid":"508328525","full_name":"voxpelli/buffered-async-iterable","owner":"voxpelli","description":"Buffered parallel processing of async iterables / generators","archived":false,"fork":false,"pushed_at":"2025-06-01T03:07:33.000Z","size":115,"stargazers_count":11,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-23T19:36:03.288Z","etag":null,"topics":["async-generator","async-generators","async-iterable","async-iterables","async-iterator","async-iterators","buffering"],"latest_commit_sha":null,"homepage":"","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/voxpelli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null},"funding":{"github":["voxpelli"]}},"created_at":"2022-06-28T14:15:38.000Z","updated_at":"2025-06-13T20:21:35.000Z","dependencies_parsed_at":"2023-12-26T03:19:39.590Z","dependency_job_id":"9d24bd50-2949-4329-927b-d65b54de0363","html_url":"https://github.com/voxpelli/buffered-async-iterable","commit_stats":null,"previous_names":["voxpelli/buffered-async-iterable"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/voxpelli/buffered-async-iterable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fbuffered-async-iterable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fbuffered-async-iterable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fbuffered-async-iterable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fbuffered-async-iterable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpelli","download_url":"https://codeload.github.com/voxpelli/buffered-async-iterable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fbuffered-async-iterable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274907094,"owners_count":25371814,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async-generator","async-generators","async-iterable","async-iterables","async-iterator","async-iterators","buffering"],"created_at":"2024-10-10T00:20:38.948Z","updated_at":"2025-09-13T01:31:48.478Z","avatar_url":"https://github.com/voxpelli.png","language":"JavaScript","funding_links":["https://github.com/sponsors/voxpelli"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg\n    src=\"buffered-async-iterable.svg\"\n    width=\"650\"\n    height=\"auto\"\n  /\u003e\n\u003c/div\u003e\n\n\nBuffered parallel processing of async iterables / generators.\n\n[![npm version](https://img.shields.io/npm/v/buffered-async-iterable.svg?style=flat)](https://www.npmjs.com/package/buffered-async-iterable)\n[![npm downloads](https://img.shields.io/npm/dm/buffered-async-iterable.svg?style=flat)](https://www.npmjs.com/package/buffered-async-iterable)\n[![Module type: ESM](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![Types in JS](https://img.shields.io/badge/types_in_js-yes-brightgreen)](https://github.com/voxpelli/types-in-js)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-7fffff?style=flat\u0026labelColor=ff80ff)](https://github.com/neostandard/neostandard)\n[![Follow @voxpelli@mastodon.social](https://img.shields.io/mastodon/follow/109247025527949675?domain=https%3A%2F%2Fmastodon.social\u0026style=social)](https://mastodon.social/@voxpelli)\n\n\n## Usage\n\n### Simple\n\n```javascript\nimport { bufferedAsyncMap } from 'buffered-async-iterable';\n\nasync function * asyncGenerator() {\n  yield ...\n}\n\nconst mappedIterator = bufferedAsyncMap(asyncGenerator(), async (item) =\u003e {\n  // Apply additional async lookup / processing\n});\n\nfor await (const item of mappedIterator) {\n  // Consume the buffered async iterable\n}\n```\n\n### Array input\n\n```javascript\nimport { bufferedAsyncMap } from 'buffered-async-iterable';\n\nconst mappedIterator = bufferedAsyncMap(['foo'], async (item) =\u003e {\n  // Apply additional async lookup / processing\n});\n\nfor await (const item of mappedIterator) {\n  // Consume the buffered async iterable\n}\n```\n\n### Async generator result\n\n```javascript\nimport { bufferedAsyncMap } from 'buffered-async-iterable';\n\nconst mappedIterator = bufferedAsyncMap(['foo'], async function * (item) {\n  // Apply additional async lookup / processing\n  yield ...\n  yield * ...\n});\n\nfor await (const item of mappedIterator) {\n  // Consume the buffered async iterable\n}\n```\n\n## API\n\n### bufferedAsyncMap()\n\nIterates and applies the `callback` to up to `bufferSize` items from `input` yielding values as they resolve.\n\n#### Syntax\n\n`bufferedAsyncMap(input, callback[, { bufferSize=6, ordered=false }]) =\u003e AsyncIterableIterator`\n\n#### Arguments\n\n* `input` – either an async iterable, an ordinare iterable or an array\n* `callback(item)` – should be either an async generator or an ordinary async function. Items from async generators are buffered in the main buffer and the buffer is refilled by the one that has least items in the current buffer (`input` is considered equal to sub iterators in this regard when refilling the buffer)\n\n#### Options\n\n* `bufferSize` – _optional_ – defaults to `6`, sets the max amount of simultanoeus items that processed at once in the buffer.\n* `ordered` – _optional_ – defaults to `false`, when `true` the result will be returned in order instead of unordered\n\n### mergeIterables()\n\nMerges all given (async) iterables in parallel, returning the values as they resolve\n\n#### Syntax\n\n`mergeIterables(input[, { bufferSize=6 }]) =\u003e AsyncIterableIterator`\n\n#### Arguments\n\n* `input` – an array of async iterables, ordinare iterables and/or arrays\n\n#### Options\n\n* `bufferSize` – _optional_ – defaults to `6`, sets the max amount of simultanoeus items that processed at once in the buffer.\n\n## Similar modules\n\n* [`hwp`](https://github.com/mcollina/hwp) – similar module by [@mcollina](https://github.com/mcollina)\n\n\u003c!-- ## See also\n\n* [Announcement blog post](#)\n* [Announcement tweet](#) --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fbuffered-async-iterable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpelli%2Fbuffered-async-iterable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fbuffered-async-iterable/lists"}