Please help I don't know what's happening. 
I'm connecting to Gnip stream api which emits json messages using gzip. But 
when I try to unzip incoming data, I get an empty buffer!

This is the code that makes the request. Basically it's the same as the 
example given in http://nodejs.org/docs/latest/api/zlib.html#zlib.Unzip

var options = {
host : 'stream.gnip.com',
port : 443,
method : 'get',
path : '/track/prod.json',
headers : {
'Authorization' : self._basicAuth(self.options.username, 
self.options.password),
'User-Agent' : self.options.userAgent,
'Accept-Encoding' : 'gzip,deflate'
}
};

self._req = https.request(options, function(res) {
self.emit('ready');
res.on('data', function(chunk) {
console.log(chunk.toString()) // this prints a lot of strange stuff
zlib.unzip(chunk, function(err, res) {
console.log(res.toString()) // empty!
if (err) self.emit('error', err);
else self.parser.receive(res);
});
});
res.on('end', function() {
self.emit('end');
});
});
self._req.on('error', function(e) {
self.emit('error', e);
self.end();
});
self._req.end();

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to