Skip to content

Instantly share code, notes, and snippets.

@ddotx
Forked from theburningmonk/parallel.js
Created August 5, 2023 11:39
Show Gist options
  • Save ddotx/ea95a63796b0bf8a7f7c6d7c37a95222 to your computer and use it in GitHub Desktop.
Save ddotx/ea95a63796b0bf8a7f7c6d7c37a95222 to your computer and use it in GitHub Desktop.
const http = require('axios')
module.exports.handler = async (urls) => {
const promises = urls.map(async url => {
return (await http.get(url)).data.length
})
const counts = await Promise.all(promises)
return counts.reduce((x, acc) => x + acc, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment