first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
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)
});
})
}