Skip to content

Instantly share code, notes, and snippets.

@kostasx
Created October 6, 2014 09:37
Show Gist options
  • Save kostasx/c03ae460676c2bb77570 to your computer and use it in GitHub Desktop.
Save kostasx/c03ae460676c2bb77570 to your computer and use it in GitHub Desktop.
Node.js - Get File using HTTP
var http = require('http');
var fs = require('fs');
var file = fs.createWriteStream("image.jpg");
var request = http.get("http://domain.com/custom.jpg", function(res) {
res.pipe(file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment