如果我使用此代码:
async.eachLimit(body.photos.photo, 10, function(photo) {
var flickr_getphoto_path = ".....";
request.get({url: flickr_host_url + flickr_getphoto_path, json: true}, function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log("SIZES LENGTH: " + body.sizes.size.length);
var source_url = body.sizes.size[body.sizes.size.length - 1].source;
request(source_url).pipe(fs.createWriteStream(path_for_downloads + path.basename(source_url)));
}
});
}
处理在 10 个请求后停止(即在第一个周期之后)。应该有10个周期。
有人知道为什么它不能正常工作吗?