# GzipHttpCompressor<!-- -->

Compresses request bodies using gzip.

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, GzipHttpCompressor } from 'apify-client';



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

## 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/gzip.ts#L41)constructor

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

- ***

  #### Parameters

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

    Compressor options.

  #### Returns [GzipHttpCompressor](https://docs.apify.com/api/client/js/reference/class/GzipHttpCompressor.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/gzip.ts#L33)readonlycontentEncoding

contentEncoding: gzip =

<!-- -->

'gzip'

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/gzip.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.
