Skip to content

Instantly share code, notes, and snippets.

@meteormatt
Created June 10, 2014 05:45
Show Gist options
  • Save meteormatt/c2984134dcec1a1fd1b1 to your computer and use it in GitHub Desktop.
Save meteormatt/c2984134dcec1a1fd1b1 to your computer and use it in GitHub Desktop.
测试Request的返回结果.
/**
* 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