joyent/node — pull request #1930 by mattrobenolt (2011-10-24 16:45:13+00:00)
Title: Adding some helper methods to 'zlib' library.

My proposal is to add a few convenience methods for compressing/decompressing basic strings. My justification is that a common pattern is to gzip a string, then base64 encode it for more compact storage or transmitting over the internet. I found this process extremely tedious and repetitive to deal with the streams and buffers required to work with the zlib library.

This little ounce of convenience allows code such as:
```javascript
var zlib = require('zlib');
zlib.deflate('.................................', function(buffer) {
var as_base64 = buffer.toString('base64');
console.log('compressed: ', as_base64);

var new_buffer = new Buffer(as_base64, 'base64');
zlib.inflate(new_buffer, function(original) {
console.log('original: ', original);
});
});
```