Last active
May 13, 2016 21:30
-
-
Save goodbabies/6dd7c537f30101b77c0b9755176f7619 to your computer and use it in GitHub Desktop.
ページそのもののダウンロード
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 url = "http://www.kaasan.info/";//ダウンロードURL | |
var savepath = "./test.html"; | |
var http = require('http'); //モジュール | |
var fs = require('fs'); //モジュール | |
var outfile = fs.createWriteStream(savepath); | |
http.get(url, function(res) { | |
res.pipe(outfile); | |
res.on('end', function () { | |
outfile.close(); | |
console.log("test");//ダウンロード成功時、コールバック | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment