Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kessler/node-async-map-limit
like Promise.all() but with limit on concurrency
https://github.com/kessler/node-async-map-limit
async-await node node-module nodejs promise
Last synced: 2 months ago
JSON representation
like Promise.all() but with limit on concurrency
- Host: GitHub
- URL: https://github.com/kessler/node-async-map-limit
- Owner: kessler
- Created: 2019-08-09T17:45:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-02T17:23:53.000Z (4 months ago)
- Last Synced: 2024-10-08T23:21:04.519Z (3 months ago)
- Topics: async-await, node, node-module, nodejs, promise
- Language: JavaScript
- Size: 67.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @kessler/async-map-limit
A `Promise.all()` based implementation for doing async map with limit on concurrency.
`impl.js` contains my experiments with various methods to do it.
`bench` compares them using two different benchmark modules
```js
const map = require('@kessler/async-map-limit')main()
async function main() {
// process the array, 2 items at a time
const result = await map([1, 2, 3, 4, 5, 6], asyncMapper, 2)
}function asyncMapper(value) {
return new Promise((resolve) => {
setImmediate(() => resolve(value))
})
}```