{"id":13724832,"url":"https://github.com/mcollina/hwp","last_synced_at":"2025-04-14T12:32:43.613Z","repository":{"id":37078050,"uuid":"394898297","full_name":"mcollina/hwp","owner":"mcollina","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-21T19:35:00.000Z","size":202,"stargazers_count":61,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T01:50:04.177Z","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/mcollina.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2021-08-11T07:17:04.000Z","updated_at":"2025-02-28T09:56:06.000Z","dependencies_parsed_at":"2024-02-03T20:49:36.550Z","dependency_job_id":null,"html_url":"https://github.com/mcollina/hwp","commit_stats":{"total_commits":41,"total_committers":4,"mean_commits":10.25,"dds":"0.29268292682926833","last_synced_commit":"b13d1e48f3ed656cd7b90e48b9db721cdac5c922"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollina%2Fhwp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollina%2Fhwp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollina%2Fhwp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollina%2Fhwp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcollina","download_url":"https://codeload.github.com/mcollina/hwp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650504,"owners_count":21139677,"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-08-03T01:02:04.156Z","updated_at":"2025-04-14T12:32:43.559Z","avatar_url":"https://github.com/mcollina.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# hwp\n\nConsume Async Interators with a highwatermark, i.e. in batches.\nThis allow for multiple processing happening in parallel instead of one at a time.\n\nThe default highwatermark is `16`.\n\n## Install\n\n```js\nnpm i hwp\n```\n\n## Usage\n\n```js\nimport { forEach, map, mapIterator, mapper } from 'hwp'\nimport { pipeline } from 'stream/promises'\n\nconst expected = ['a', 'b', 'c']\n\nasync function * something () {\n  const toSend = [...expected]\n  yield * toSend\n}\n\nawait forEach(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}, 16)\n\nconst res = mapIterator(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}, 16)\n\nfor await (const item of res) {\n  console.log(item)\n}\n\nconsole.log(await map(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}), 16)\n\nawait pipeline(\n  something(),\n  mapper((item, { signal }) =\u003e {\n    return someAsyncFunction(item, { signal })\n  }, 16),\n  async function (source) {\n    for await (const item of source) {\n      console.log(item)\n    }\n  }\n)\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcollina%2Fhwp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcollina%2Fhwp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcollina%2Fhwp/lists"}