CasperJS 下载文件并将其保存到特定位置

CasperJS download and save file to specific location

我是一名初级程序员,我正在尝试使用 casperjs 下载并临时保存文件。

casper.start("http://www.google.fr/", function() {

  var path = 'C:/WINDOWS/TEMP/logo.png';
  fs.write(path, this.download("http://www.google.fr/images/srpr/logo3w.png"), 'w');
});

我试过在照片查看器中打开文件,它显示 'photo viewer does not support the file format'

来自文档:

我不使用 fs.write,而是使用:

this.download("http://www.google.fr/images/srpr/logo3w.png", path);

希望对您有所帮助。