Gunzip使用JavaScript /节点的APIstream?

我正在使用node.js与返回压缩数据的API进行一些交互。 我通过包pipe理器和维基浏览了一个好的压缩库,但是找不到一个没有被放弃/根本不工作的库。 任何想法如何可以使用javascript或节点压缩压缩的数据? (或者如何避免数据在一起?)

以下是我对评论的看法:

app.get('/', function(req, res){ // rest is a restler instance rest.get('http://api.stackoverflow.com/1.1/questions?type=jsontext', { headers: {"Accept-Encoding": 'deflate'}, //tried deflate, gzip, etc. No changes }).on('complete', function(data) { // If I do: sys.puts(data); I get an exception // Maybe I could do something like this: /* var child = exec("gunzip " + data, function(error, stdout, stderr) { console.log('stdout: ' + stdout); console.log('stderr: ' + stderr); if (error !== null) { console.log('exec error: ' + error); } }); */ }); 

});

我用这个成功:

https://github.com/waveto/node-compress

 this.get = function(options, cb){ http.get({host: 'api.stackoverflow.com', path:'/1.1/questions?' + querystring.stringify(vectorize(options || {}))}, function(res){ var body = []; var gunzip = new compress.Gunzip(); gunzip.init(); res.setEncoding('binary'); res .on('data', function(chunk){ body.push(gunzip.inflate(chunk, 'binary')); }) .on('end', function(){ console.log(res.headers); gunzip.end(); cb(null, JSON.parse(body.join(''))); }); }).on('error', function(e){ cb(e); }) }