I am using node.js to do some interactions with an API that returns gzipped data. I browsed through the package manager and the wiki for a good compression library but couldn't find one that hadn't been abandoned / didn't work at all. Any idea how I can either deflate the compressed data using javascript or node? (Or how to avoid the data all together?)
Here is what I have with comments:
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);
}
});
*/
});
});