Created
July 30, 2018 12:22
-
-
Save claytonbez/7e161412b1992d29d78db11dcc437e2d to your computer and use it in GitHub Desktop.
Using the request module to download a file.
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("file.jpg"); | |
var request = http.get("http://i3.ytimg.com/vi/J---aiyznGQ/mqdefault.jpg", function(response) { | |
response.pipe(file); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment