Etag.ts
Etag.ts overview
Section titled “Etag.ts overview”HTTP entity tag values and metadata-based generator layers.
ETags are validators for a specific representation of a resource. Servers put
them in ETag response headers so clients and intermediaries can revalidate
cached content with If-None-Match, or protect writes with preconditions such
as If-Match.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”converting
Section titled “converting”toString
Section titled “toString”Formats an Etag as an HTTP header value, including quotes and the W/ prefix for weak tags.
Signature
declare const toString: (self: Etag) => stringSince v4.0.0
layers
Section titled “layers”Layer that provides a Generator which produces strong ETags from file size
and modification time metadata.
When to use
Use when you need the Generator service to produce strong ETags and file
size plus modification time reliably change for every byte-level change.
Gotchas
This layer marks metadata-derived tags as strong. If the underlying storage can update file contents without changing the recorded size or modification time, those tags can stop representing byte-for-byte identity.
See
layerWeakfor weak metadata-derived ETags when byte-for-byte identity is not requiredGeneratorfor the service provided by this layer
Signature
declare const layer: Layer.Layer<Generator, never, never>Since v4.0.0
layerWeak
Section titled “layerWeak”Layer that provides a Generator which produces weak ETags from file size and modification time metadata.
Signature
declare const layerWeak: Layer.Layer<Generator, never, never>Since v4.0.0
models
Section titled “models”Etag (type alias)
Section titled “Etag (type alias)”Represents an HTTP entity tag, either weak or strong.
Signature
type Etag = Weak | StrongSince v4.0.0
Generator (class)
Section titled “Generator (class)”Service for generating ETags from filesystem file information or Web File-like metadata.
Signature
declare class GeneratorSince v4.0.0
Strong (interface)
Section titled “Strong (interface)”Strong HTTP entity tag.
Details
The value is the raw tag value without the surrounding quotes.
Signature
export interface Strong { readonly _tag: "Strong" readonly value: string}Since v4.0.0
Weak (interface)
Section titled “Weak (interface)”Weak HTTP entity tag.
Details
The value is the raw tag value without the surrounding quotes or W/ prefix.
Signature
export interface Weak { readonly _tag: "Weak" readonly value: string}Since v4.0.0