VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-zlib-brotlicompress-method/

⇱ Node.js zlib.brotliCompress() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js zlib.brotliCompress() Method

Last Updated : 12 Oct, 2021
The zlib.brotliCompress() method is an inbuilt application programming interface of the Zlib module which is used to compresses a chunk of data. Syntax:
zlib.brotliCompress( 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 compression. Below examples illustrate the use of zlib.brotliCompress() method in Node.js: Example 1: Output:
Gw8A+CUAqhBDSpVv9iA=
Example 2: Output:
1b0f00f82500aa10434a956ff620
Reference: https://nodejs.org/api/zlib.html#zlib_zlib_brotlicompress_buffer_options_callback
Comment

Explore