When working with large systems or moving large amounts of data around, it is extremely helpful to be able to compress/decompress the data. Node.js provides an excellent library in the Zlib
module that allows you to compress and decompress data in buffers very easily and efficiently.
You need to keep in mind that compressing data takes CPU cycles, so you should be certain of the benefits of compressing data before you incur the compression/decompression cost. Zlib
supports these compression methods:
gzip/gunzip: Standard gzip
compression.
deflate/inflate: Standard deflate compression algorithm, based on Huffman coding.
deflateRaw/inflateRaw: Deflate compression algorithm on a raw buffer.