Created
June 10, 2014 05:45
-
-
Save meteormatt/c2984134dcec1a1fd1b1 to your computer and use it in GitHub Desktop.
测试Request的返回结果.
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
/** | |
* Created by meteor on 2014/6/10. | |
*/ | |
var request = require('request'); | |
var fs = require('fs'); | |
var r = request.get('http://www.google.com.hk'); | |
r.pipe(fs.createWriteStream('google.txt')); | |
r.on('response', function (r) { | |
console.log(r.statusCode); | |
}) | |
r.on('error', function (error) { | |
console.log(error); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment