request(source_url).pipe(async.series([
function() {
fs.createWriteStream(path_for_downloads + path.basename(source_url));
},
function() {
done(null);
}
]);
);
它等待未关闭的括号...
... );
...
这有效:
async.series([
function() {
fs.createWriteStream(path_for_downloads + path.basename(source_url));
},
function() {
done(null);
}
]);
答案 0 :(得分:2)
request(source_url).pipe(async.series([
function() {
fs.createWriteStream(path_for_downloads + path.basename(source_url));
},
function() {
done(null);
}
]); //close the array, close async.series call, OOPS don't want a semi there
); //close the pipe call
我认为这是你的错误。但是,这个片段还有许多其他问题。我想你想要更像的东西:
var stream = request(source_url).pipe(fs.createWriteStream(path_for_downloads + path.basename(source_url));
stream.on('end', done);
stream.on('error', done);