koa-etag

Koa ETag support middleware

MIT 16 个版本
安装
npm install koa-etag
yarn add koa-etag
pnpm add koa-etag
bun add koa-etag
README

koa-etag

NPM version Test coverage Dependency Status License Downloads

Etag support for Koa responses using etag.

Please use @koa/etag (v5+) instead. It is the same module, and this package will be deprecated in the next major release.

Installation

# npm
$ npm install koa-etag
# yarn
$ yarn add koa-etag

Example


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

版本列表
5.0.0 2025-06-05
4.0.0 2020-09-09
3.0.0 2016-02-27
2.1.2 2017-08-21
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.0.0 2013-09-14