The
zlib.unzipSync() method is an inbuilt application programming interface of the Zlib module which is used to decompress a chunk of data with Unzip.
Syntax:
zlib.unzipSync( buffer, options )
Parameters: This method accepts two 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.
Return Value: It returns the chunk of data with Unzip.
Below examples illustrate the use of
zlib.unzipSync() method in Node.js:
Example 1:
Output:
TmlkaGlTaW5naA==
Example 2:
Output:
4e6964686953696e6768
Reference: https://nodejs.org/api/zlib.html#zlib_zlib_unzipsync_buffer_options