# @keyvhq/compress

> Adds compression bindings for your Keyv instance, saving as much space as you can.

Latest version **2.2.10** (published 2026-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @keyvhq/compress
pnpm add @keyvhq/compress
yarn add @keyvhq/compress
bun add @keyvhq/compress
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.10 |
| Published | 2026-10-28 |
| First published | 2021-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 18 |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 447 |
| Author | microlink.io |
| Maintainers | kikobeats, jytesh |
| Keywords | brotli, cache, compress, compression, decompress, deserialize, key, keyv, serialize, store, ttl, value |

## Links

- npm: https://www.npmjs.com/package/@keyvhq/compress
- Repository: https://github.com/microlinkhq/keyvhq
- Homepage: https://keyvhq.js.org
- Issues: https://github.com/microlinkhq/keyvhq/issues
- npm.io page: https://npm.io/package/@keyvhq/compress

## Dependencies (1)

- [compress-brotli](https://npm.io/package/compress-brotli.md) ~1.3.13

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.2.10 (latest) — 2026-10-28
- 2.2.8 — 2026-10-28
- 2.2.7 — 2026-08-03
- 2.2.4 — 2026-06-09
- 2.2.0 — 2026-03-03
- 2.1.15 — 2026-02-04
- 2.1.14 — 2026-02-04
- 2.1.13 — 2026-02-04
- 2.1.11 — 2025-09-24
- 2.1.7 — 2025-02-20
- 2.1.5 — 2024-07-30
- 2.1.1 — 2024-04-23
- 2.0.3 — 2023-06-20
- 2.0.0 — 2023-04-22
- 2.0.0-beta.0 — 2023-04-17
- … 8 more at https://npm.io/package/@keyvhq/compress/versions

## README

# @keyvhq/compress [<img width="100" align="right" src="https://keyvhq.js.org/media/logo-sunset.svg" alt="keyv">](https://github.com/microlinkhq/keyvhq)

> Adds compression bindings for your Keyv instance.

## Install

```bash
$ npm install @keyvhq/compress --save
```

## Usage

All you need to do is to wrap your [keyv](https://keyvhq.js.org) instance:

```js
const KeyvRedis = require('@keyvhq/redis')
const Keyv = require('@keyvhq/core')

const store = new KeyvRedis({
  uri: 'redis://user:pass@localhost:6379',
  maxRetriesPerRequest: 1
})

const keyv = new Keyv({ store })
```

Using `@keyvhq/compress` at the top level:

```js
const KeyvCompress = require('@keyvhq/compress')
const keyv = KeyvCompress(new Keyv({ store }))
```

Additionally, it can accept [compress-brotli#options](https://github.com/Kikobeats/compress-brotli#compressbrotlioptions) as second argument:

```js
const keyv = KeyvCompress(
  new Keyv({ store }),
  {
    serialize: v8.serialize,
    deserialize: v8.deserialize
  }
)
```

## License

**@keyvhq/memoize** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/microlinkhq/keyvhq/blob/master/LICENSE.md) License.<br/>
Maintained by [Microlink](https://microlink.io) with help from [contributors](https://github.com/microlinkhq/keyvhq/contributors).

> [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)

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