request({method: "GET", "rejectUnauthorized": false, "url": url, "headers" : {"Content-Type": "application/json", function(err,data,body) { }).pipe( fs.createWriteStream('file.html'));