public
anonymous / gist:333511
Created

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
var fs = require("fs");
var http = require("http");
 
var client = http.createClient(80, "google.com");
var request = client.request("GET", "/", {"host": "google.com"});
var file = fs.createWriteStream("google.html",
{ flags: "w",
mode: 0644 });
 
request.addListener("response", function(response) {
response.addListener("data", function(chunk) {
file.write(chunk);
});
response.addListener("end", function() {
file.close();
});
});
request.close();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.