Skip to content

Instantly share code, notes, and snippets.

@oxUnd
Created May 30, 2014 06:07
Show Gist options
  • Save oxUnd/800d1bf21a754c0f8eb0 to your computer and use it in GitHub Desktop.
Save oxUnd/800d1bf21a754c0f8eb0 to your computer and use it in GitHub Desktop.
like `asyncMap`
var asyncMap = require('slide').asyncMap;
var http = require('http');
asyncMap(
[
"http://www.baidu.com",
"http://zhidao.baidu.com"
] ,
function (url, cb) {
console.log(url);
http.get(url, function (r) {
var d = '';
r.on('data', function(c) {d+=c.toString();});
r.on('end', function() {
cb(null, d);
});
});
},
function (er, r) {
console.log(r);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment