{"id":18749025,"url":"https://github.com/timeforaninja/node-n-parallel","last_synced_at":"2025-09-04T15:44:45.727Z","repository":{"id":61488331,"uuid":"551927109","full_name":"TimeForANinja/node-n-parallel","owner":"TimeForANinja","description":"async array-map with support for n parallel workers","archived":false,"fork":false,"pushed_at":"2023-07-20T00:03:31.000Z","size":299,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T09:47:05.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/TimeForANinja.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-15T12:11:46.000Z","updated_at":"2022-10-15T18:47:35.000Z","dependencies_parsed_at":"2025-05-20T10:10:00.923Z","dependency_job_id":"76aae540-c006-4775-8e25-d90ca4983b78","html_url":"https://github.com/TimeForANinja/node-n-parallel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/TimeForANinja/node-n-parallel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeForANinja%2Fnode-n-parallel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeForANinja%2Fnode-n-parallel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeForANinja%2Fnode-n-parallel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeForANinja%2Fnode-n-parallel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimeForANinja","download_url":"https://codeload.github.com/TimeForANinja/node-n-parallel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimeForANinja%2Fnode-n-parallel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273632900,"owners_count":25140771,"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-04T02:00:08.968Z","response_time":61,"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":[],"created_at":"2024-11-07T17:05:50.597Z","updated_at":"2025-09-04T15:44:45.692Z","avatar_url":"https://github.com/TimeForANinja.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-n-parallel\n\nA small library to allow you easy access to an async array-map that uses a user-defined amount of workers instead of doing all jobs in sequence or parallel. This is e.g. usefull when fetching huge amounts of web requests and optimising for both time performance and not ddos-ing your target.\n\n\n![Depfu](https://img.shields.io/depfu/timeforaninja/node-n-parallel)\n[![codecov](https://codecov.io/gh/timeforaninja/n-parallel/branch/master/graph/badge.svg)](https://codecov.io/gh/timeforaninja/n-parallel)\n\n# Usage\n\nRequest a bunch of Websites\n\n```js\nconst nparallel = require('n-parallel');\n\nconst pages = await nparallel(\n    // Input data\n    ['website1.com', 'website2.com', 'website3.con'],\n    // The Map-Function is identical to the default \u003carray\u003e.map\n    async(url, idx, array) =\u003e await fetch(url),\n    // Number of Workers\n    2,\n);\n```\n\nBy-default we also expand the Array prototype\n\n```js\nrequire('n-parallel');\n\nconst pages = ['website1.com', 'website2.com', 'website3.con'].nmap(\n    // The Map-Function is identical to the default \u003carray\u003e.map\n    async(url, idx, array) =\u003e await fetch(url),\n    // Number of Workers\n    2,\n)\n```\n\n# API\n\n### nparallel(data, mapFunc, numWorkers)\n\n* `data` - An array of input data to map.\n* `mapFunc` - An async function used to map a single `data`-Element to a single output data object.\n* `numWorkers`- An integer describing how many workers should work on mapping.\n\nnparallel returns a Promise that resolves to the objects created by the `mapFunc`.\n\n\n# Install\n```bash\nnpm install miniget\n```\n\n\n# Tests\nTests are written with [mocha](https://mochajs.org)\n\n```bash\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimeforaninja%2Fnode-n-parallel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimeforaninja%2Fnode-n-parallel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimeforaninja%2Fnode-n-parallel/lists"}