Created
October 6, 2014 09:37
-
-
Save kostasx/c03ae460676c2bb77570 to your computer and use it in GitHub Desktop.
Node.js - Get File using HTTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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