Compression using zlib

0.0% Acceptance

In this lab, you will learn how to compress a string using the zlib library, which is a built-in Node.js module. Many web applications require compressing and decompressing data. zlib is a powerful and frequently used compression library in Node.js for this purpose.

In this lab, you will be provided with a string that needs to be compressed using zlib's gzip() method. You need to create a function called compressString that takes a string as input, compresses it using the gzip method, and returns the compressed data as a promise.


  1. Import the zlib module
  2. Create a compressString function
  3. Use the gzip method inside compressString
  4. Return compressed data as a promise
  5. Export the compressString function