# koa-etag

> Koa ETag support middleware

Latest version **5.0.0** (published 2025-06-05) · 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 50/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2025-06-05 |
| First published | 2013-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 115 |
| Maintainers | coderhaoxin, niftylettuce, aaron, juliangruber, eivifj, dead_horse, tjholowaychuk, jongleberry, fengmk2, 3imed-jaberi, titanism |
| 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.0 (latest) — 2025-06-05
- 2.1.2 (v2) — 2017-08-21
- 3.0.0 (next) — 2016-02-27
- 4.0.0 — 2020-09-09
- 2.1.1 — 2016-02-27
- 2.1.0 — 2015-10-27
- 2.0.0 — 2014-08-30
- 1.3.1 — 2014-07-23
- 1.3.0 — 2014-06-18
- 1.2.5 — 2014-06-17
- 1.2.4 — 2014-05-04
- 1.2.3 — 2014-02-27
- 1.2.2 — 2013-12-27
- 1.2.1 — 2013-12-22
- 1.1.0 — 2013-09-14
- … 1 more at https://npm.io/package/koa-etag/versions

## 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).

> __Please use @koa/etag (v5+) instead. It is the same module, and this package will be deprecated in the next major release.__

## 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._
