You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
370 B
22 lines
370 B
var duplexify = require('duplexify')
|
|
var http = require('http')
|
|
|
|
var request = function(opts) {
|
|
var req = http.request(opts)
|
|
var dup = duplexify()
|
|
dup.setWritable(req)
|
|
req.on('response', function(res) {
|
|
dup.setReadable(res)
|
|
})
|
|
return dup
|
|
}
|
|
|
|
var req = request({
|
|
method: 'GET',
|
|
host: 'www.google.com',
|
|
port: 80
|
|
})
|
|
|
|
req.end()
|
|
req.pipe(process.stdout)
|