Skip to content

Instantly share code, notes, and snippets.

@telekosmos
Created February 17, 2015 10:04
Show Gist options
  • Save telekosmos/e84ae2ccb28297e49312 to your computer and use it in GitHub Desktop.
Save telekosmos/e84ae2ccb28297e49312 to your computer and use it in GitHub Desktop.
Node.js downlaoder
var https = require('https');
var fs = require('fs');
var options = {
hostname : 'wordpress.org',
port : 443,
path : '/latest.zip',
method : 'GET'
};
var file = fs.createWriteStream("wp_latest.zip");
var req = https.request(options, function(res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function(d) {
file.write(d);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment