decompressing gzip http response with node-red

Developer from somewhere

Add zlib in settings.js, if you don’t already have it:

functionGlobalContext: {
   zlib: require('zlib'),
   ...
}
     

Then create a new function node with the following code:

var buffer = new Buffer(msg.payload);
msg.payload = global.get('zlib').gunzipSync(buffer).toString();
return msg;

This won’t yield the best performance, but it works in my case. Most likely, if could be done better by using the callback version of gunzip, and then using send to pass the msg to the next node.