# BrotliHttpCompressor<!-- -->

Compresses request bodies using brotli.

Built on the `node:zlib` module, so it works wherever the client runs on Node.js.

### Implements

* [HttpCompressor](https://docs.apify.com/api/client/js/reference/interface/HttpCompressor.md)

```
import { ApifyClient, BrotliHttpCompressor } from 'apify-client';



const client = new ApifyClient({ token: 'my-token', compression: new BrotliHttpCompressor({ quality: 11 }) });
```

## Index[](#Index)

### Constructors

* [constructor](#constructor)

### Properties

* [contentEncoding](#contentEncoding)

### Methods

* [compress](#compress)

## Constructors<!-- -->[](#Constructors)

### [](#constructor)[](https://github.com/apify/apify-client-js/blob/af7590882995a0bde27cc341c79f21d08bec1e56/src/http_compressors/brotli.ts#L41)constructor

* **new BrotliHttpCompressor**(options): [BrotliHttpCompressor](https://docs.apify.com/api/client/js/reference/class/BrotliHttpCompressor.md)

- ***

  #### Parameters

  * ##### options: [BrotliHttpCompressorOptions](https://docs.apify.com/api/client/js/reference/interface/BrotliHttpCompressorOptions.md) = <!-- -->{}

    Compressor options.

  #### Returns [BrotliHttpCompressor](https://docs.apify.com/api/client/js/reference/class/BrotliHttpCompressor.md)

  Throws - If `quality` is out of the valid range.

## Properties<!-- -->[](#Properties)

### [](#contentEncoding)[](https://github.com/apify/apify-client-js/blob/af7590882995a0bde27cc341c79f21d08bec1e56/src/http_compressors/brotli.ts#L33)readonlycontentEncoding

contentEncoding: br =

<!-- -->

'br'

Implementation of HttpCompressor.contentEncoding

Value sent in the `Content-Encoding` header, for example `gzip` or `br`.

## Methods<!-- -->[](#Methods)

### [](#compress)[](https://github.com/apify/apify-client-js/blob/af7590882995a0bde27cc341c79f21d08bec1e56/src/http_compressors/brotli.ts#L46)compress

* **compress**(data): Promise\<Buffer\<ArrayBufferLike>>

- Implementation of HttpCompressor.compress

  Compresses a request body.

  ***

  #### Parameters

  * ##### data: Buffer\<ArrayBufferLike>

    The raw bytes to compress.

  #### Returns Promise\<Buffer\<ArrayBufferLike>>

  The compressed bytes.
