# @tinyhttp/etag

> entity tag module

Latest version **2.1.2** (published 2024-06-26) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2024-06-26 |
| First published | 2020-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12.20.0 |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2903 |
| Author | v1rtl |
| Keywords | tinyhttp, node.js, web framework, web, backend, etag |

## Links

- npm: https://www.npmjs.com/package/@tinyhttp/etag
- Repository: https://github.com/tinyhttp/tinyhttp
- Homepage: https://tinyhttp.v1rtl.site
- Issues: https://github.com/tinyhttp/tinyhttp/issues
- npm.io page: https://npm.io/package/@tinyhttp/etag

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2024-06-26
- 0.2.11 (pnpm-temp) — 2020-08-17
- 2.1.1 — 2024-01-06
- 2.1.0 — 2023-05-23
- 2.0.7 — 2023-05-14
- 2.0.6 — 2023-01-11
- 2.0.5 — 2022-09-15
- 2.0.4 — 2022-06-05
- 2.0.3 — 2022-03-04
- 2.0.2 — 2021-09-23
- 2.0.1 — 2021-09-07
- 2.0.0 — 2021-08-22
- 1.3.0 — 2021-04-26
- 1.2.3 — 2021-04-14
- 1.2.2 — 2021-04-02
- … 54 more at https://npm.io/package/@tinyhttp/etag/versions

## README

# @tinyhttp/etag

[![npm (scoped)](https://img.shields.io/npm/v/@tinyhttp/etag?style=flat-square)](https://npmjs.com/package/@tinyhttp/etag) [![npm](https://img.shields.io/npm/dt/@tinyhttp/etag?style=flat-square)](https://npmjs.com/package/@tinyhttp/etag) [![](https://img.shields.io/badge/website-visit-hotpink?style=flat-square)](https://tinyhttp.v1rtl.site/mw/etag)

> A rewrite of [etag](https://www.npmjs.com/package/etag) module.

This module generates HTTP ETags (as defined in RFC 7232) for use in HTTP responses.

## Install

```sh
pnpm i @tinyhttp/etag
```

## API

```ts
import { eTag } from '@tinyhttp/etag'
```

`eTag(entity, [options])`

Generate a strong ETag for the given entity. This should be the complete body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By default, a strong ETag is generated except for `fs.Stats`, which will generate a weak ETag (this can be overwritten by options.weak).

```ts
res.setHeader('ETag', eTag(body))
```

### Options

`eTag` accepts these properties in the options object.

#### `weak`

Specifies if the generated ETag will include the weak validator mark (that is, the leading `W/`). The actual entity tag is the same. The default value is `false`, unless the entity is `fs.Stats`, in which case it is `true`.

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