【发布时间】:2012-03-10 00:08:04
【问题描述】:
我正在尝试编写一个脚本,该脚本将访问localhost 上的脚本并在 node.js 脚本中解析它。这是我到目前为止得到的:
var http = require('http');
var options = {
host:'127.0.0.1',
port:'80',
path:'/index.php'
}
var a = http.get(options, function(res){
res.on('data', function(chunk){
console.log(chunk);
});
//console.log(res);
});
但这就是它返回的全部内容:
<Buffer 7b 22 61 77 65 73 6f 6d 65 22 3a 22 79 65 61 68 21 22 7d>
我知道这是某种流,但我不知道如何处理它。
【问题讨论】: