# @types/koa-compress

> TypeScript definitions for koa-compress

Latest version **4.0.7** (published 2025-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa-compress
pnpm add @types/koa-compress
yarn add @types/koa-compress
bun add @types/koa-compress
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.7 |
| Published | 2025-10-24 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa-compress
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-compress
- npm.io page: https://npm.io/package/@types/koa-compress

## Dependencies (2)

- [@types/koa](https://npm.io/package/@types/koa.md) *
- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 4.0.7 (latest) — 2025-10-24
- 4.0.6 (ts5.1) — 2023-11-07
- 4.0.3 (ts3.7) — 2021-07-09
- 4.0.1 (ts3.2) — 2020-10-01
- 4.0.0 (ts3.0) — 2020-05-14
- 2.0.9 (ts2.7) — 2019-03-25
- 2.0.7 (ts2.0) — 2017-08-21
- 4.0.5 — 2023-10-18
- 4.0.4 — 2023-09-14
- 4.0.2 — 2021-07-06
- 2.0.8 — 2017-11-09
- 2.0.6 — 2016-12-19
- 2.0.5 — 2016-11-21
- 2.0.4 — 2016-09-19
- 2.0.3 — 2016-08-25
- … 2 more at https://npm.io/package/@types/koa-compress/versions

## README

# Installation
> `npm install --save @types/koa-compress`

# Summary
This package contains type definitions for koa-compress (https://github.com/koajs/compress).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-compress.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-compress/index.d.ts)
````ts
/* =================== USAGE ===================

    import compress = require("koa-compress");
    var Koa = require('koa');

    var app = new Koa();
    app.use(compress());

 =============================================== */
/// <reference types="node" />
/// <reference types="koa" />

import Koa = require("koa");
import * as zlib from "zlib";

/**
 * Compress middleware for Koa
 */
declare function koaCompress(options?: koaCompress.CompressOptions): Koa.Middleware;

declare namespace koaCompress {
    export interface CompressOptions {
        /**
         * An optional function that checks the response content type to decide whether to compress. By default, it uses compressible.
         */
        filter?: ((mimeType: string) => boolean) | undefined;

        /**
         * Minimum response size in bytes to compress. Default 1024 bytes or 1kb.
         */
        threshold?: number | string | undefined;

        /**
         * An optional string, which specifies what encoders to use for requests
         * without Accept-Encoding. Default: 'idenity'.
         */
        defaultEncoding?: string | undefined;

        /**
         * Options for brotli compression.
         */
        br?: zlib.BrotliOptions | false | undefined;

        /**
         * Options for gzip compression.
         */
        gzip?: zlib.ZlibOptions | false | undefined;

        /**
         * Options for deflate compression.
         */
        deflate?: zlib.ZlibOptions | false | undefined;
    }
}

export = koaCompress;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa), [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Jerry Chin](https://github.com/hellopao), and [Joel Gallant](https://github.com/joelgallant).

---
_Source: https://npm.io/package/@types/koa-compress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
