I need to compress a buffer in Node.js with zlib at the extreme compression level. The outputted header should be 78 DA. Unless I’m missing something, the Node.js documentation doesn’t really describe how to use the zlib.Deflate class. It doesn’t accept any parameters.
Share
Use
zlib.createGzip/createDeflateto get an instance of the compressor you need, with options in an object.If you want to do this all in-memory:
Of course, if you’re dealing with large amounts of data, stream the output to a file rather than buffering everything in memory.