The
zlib.gunzip() method is an inbuilt application programming interface of the Zlib module which is used to decompress a chunk of data.
Syntax:
zlib.gunzip( buffer, options, callback )
Parameters: This method accepts three parameters as mentioned above and described below:
- buffer: It can be of type Buffer, TypedArray, DataView, ArrayBuffer, and string.
- options: It is an optional parameter that holds the zlib options.
- callback: It holds the callback function.
Return Value: It returns the chunk of data after decompression.
Below examples illustrate the use of
zlib.gunzip() method in Node.js:
Example 1:
Output:
Data Decompressed...
Geek
Example 2:
Output:
Data Decompressed...
4765656b
Reference: https://nodejs.org/api/zlib.html#zlib_zlib_gunzip_buffer_options_callback