Socket
Socket
Sign inDemoInstall

@tinyhttp/etag

Package Overview
Dependencies
0
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tinyhttp/etag

entity tag module


Version published
Weekly downloads
82K
increased by4.45%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@tinyhttp/etag

npm (scoped) npm

A rewrite of etag module.

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

Install

pnpm i @tinyhttp/etag

API

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, Buffers, 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).

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.

Keywords

FAQs

Last updated on 06 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc