4 ms·
When I first got into promises, they were annoying for certain tasks. Something as simple as download a list of 1000 files was hard to do since you didn't want
by tonyle 10y ago
When I first got into promises, they were annoying for certain tasks.
Something as simple as download a list of 1000 files was hard to do since you didn't want all the calls to fire off at once.
After a long journey with various techniques, I found out Bluebird map had a concurrency parameter.
return Promise.map(arrayOfUrlsToDownload,downloadAndParseFunction,{concurrency:1})
One line for all your basic scraping/parsing needs.
- DonPellegrino 10y agoThere's also [Bottleneck](https://github.com/SGrondin/bottleneck https://github.com/SGrondin/bottleneck) for more fine grained concurrency.