javascript - CasperJS download and save file to specific location -


i'm beginner programmer , i'm trying download , temporarily save file using 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'); }); 

i've tried opening file in photo viewer, , reads 'photo viewer not support file format'

from documentation:

istead of fs.write, use:

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

hope helps.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -