I have below code in python
urllib.urlretrieve(URL, basePath +ldnumber +".pdf")
I think what above code do is download data from given url and save it as second parameter "basePath + str(ldnumber)+".pdf".
I have written below code in node js to achieve same functionality:
var file = fs.createWriteStream(basePath +ldnumber +".pdf");
var request = http.get(URL, function(response)
{
response.pipe(file);
});
But above code is just create a file for given basepath and not what I require to achieve.
Is there any way to download a file and save it on given destination path in node js.
I am sure there must be some proper way but I am running little out of time so I am posting this question here till I find an answer to this.