var async = require("async"); var request = require('superagent'); var urls = [ "https://www.npmjs.com/package/async", "https://caolan.github.io/async/", "https://www.baidu.com/", "https://www.tslang.cn/", "http://www.jtthink.com/" ] async.mapLimit(urls, 2, async function(value, key) { const response = await fetchs(value) return response }, (err, results) => { if (err) throw err // results is now an array of the response bodies console.log(results) }) async function fetchs(url){ return new Promise(function(resolve,reject){ request .get(url) .end((err, res) => { resolve(res.text) }); }) }