internet-programming/lab3/node_modules/memorystream/test/example.js

19 lines
364 B
JavaScript
Raw Normal View History

2023-11-02 02:38:40 +04:00
var http = require('http'),
MemoryStream = require('../index'),
util = require('util');
var options = {
host: 'google.com'
};
var memStream = new MemoryStream(null,{
readable : false
});
var req = http.request(options, function(res) {
util.pump(res, memStream);
res.on('end',function(){
console.log(memStream.toString());
});
});
req.end();