@ende/http/etag

ende add jsr:@ende/http

Version 2026.10.15 on JSR.

Provides functions for dealing with and matching ETags, including eTag to calculate an etag for a given entity, ifMatch for validating if an ETag matches against a If-Match header and ifNoneMatch for validating an Etag against an If-None-Match header.

See further information on the ETag header on MDN.

Exports

  • eTag — Calculate an ETag for string or `Uint8Array` entities. This returns a strong tag of the form `"<ascii chars>"`, which guarantees the byte-for-byte equality of the resource.
  • ETagOptions — Options for eTag.
  • FileInfo — Just the part of Ende.FileInfo that is required to calculate an `ETag`, so partial or user generated file information can be passed.
  • ifMatch — A helper function that takes the value from the `If-Match` header and a calculated etag for the target. By using strong comparison, return `true` if the values match, otherwise `false`.
  • ifNoneMatch — A helper function that takes the value from the `If-None-Match` header and a calculated etag for the target entity and returns `false` if the etag for the entity matches the supplied value, otherwise `true`.