InternetProgramming/Lab3/node_modules/memorystream/test/example.js
2023-12-15 14:42:22 +04:00

19 lines
364 B
JavaScript

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();