• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var duplexify = require('duplexify')
2var http = require('http')
3
4var request = function(opts) {
5  var req = http.request(opts)
6  var dup = duplexify()
7  dup.setWritable(req)
8  req.on('response', function(res) {
9    dup.setReadable(res)
10  })
11  return dup
12}
13
14var req = request({
15  method: 'GET',
16  host: 'www.google.com',
17  port: 80
18})
19
20req.end()
21req.pipe(process.stdout)
22