# @koa/etag

> Koa ETag support middleware

Latest version **5.0.2** (published 2026-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @koa/etag
pnpm add @koa/etag
yarn add @koa/etag
bun add @koa/etag
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.2 |
| Published | 2026-01-02 |
| First published | 2025-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 115 |
| Maintainers | niftylettuce, fengmk2, dead_horse, jongleberry, juliangruber, aaron, titanism, 3imed-jaberi, ljharb |
| Keywords | koa, middleware, cache, caching, etag, file, static, sendfile |

## Links

- npm: https://www.npmjs.com/package/@koa/etag
- Repository: https://github.com/koajs/etag
- Homepage: https://github.com/koajs/etag#readme
- Issues: https://github.com/koajs/etag/issues
- npm.io page: https://npm.io/package/@koa/etag

## Dependencies (2)

- [etag](https://npm.io/package/etag.md) ^1.8.1
- [@types/etag](https://npm.io/package/@types/etag.md) ^1.8.3

## 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

- 5.0.2 (latest) — 2026-01-02
- 5.0.1 — 2025-06-05
- 5.0.0 — 2025-06-05

## README

# @koa/etag

[![NPM version][npm-image]][npm-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

Etag support for Koa responses using [etag](https://github.com/jshttp/etag).

## Installation

```bash
# npm
$ npm install @koa/etag
# yarn
$ yarn add @koa/etag
```

## Example

```js

const Koa = require('koa');
const etag = require('@koa/etag');
const conditional = require('koa-conditional-get');
const compress = require('koa-compress');

const app = new Koa();

// must be used before `conditional` and `etag`
app.use(compress());

// etag works together with conditional-get
app.use(conditional());
app.use(etag());

app.use(function (ctx) {
  ctx.body = 'Hello World';
});

app.listen(3000);

console.log('listening on port 3000');
```

## License

[MIT](LICENSE)

[npm-image]: https://img.shields.io/npm/v/koa-etag.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@koa/etag
[github-tag]: http://img.shields.io/github/tag/koajs/etag.svg?style=flat-square
[github-url]: https://github.com/koajs/etag/tags
[coveralls-image]: https://img.shields.io/coveralls/koajs/etag.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/koajs/etag?branch=master
[david-image]: http://img.shields.io/david/koajs/etag.svg?style=flat-square
[david-url]: https://david-dm.org/koajs/etag
[license-image]: http://img.shields.io/npm/l/koa-etag.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/koa-etag.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/koa-etag
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
[gittip-url]: https://www.gittip.com/jonathanong/

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