import * as etag from "https://deno.land/x/etag@0.2.0/mod.ts";
🏷️ etag
Deno-friendly utilities for encoding, decoding, and handling ETags in HTTP requests and responses. Plays well with server frameworks like Oak.
Usage
import etag from "https://deno.land/x/etag@0.1.1/mod.ts";
etag(`<svg xmlns="http://www.w3.org/2000/svg"><!-- ... --></svg>`);
etag.encode(
entity: string | FileInfo | ArrayBuffer | Uint8Array | BodyInit,
options?: boolean | { weak?: boolean }
): string;
For more examples and documentation, refer to the module homepage at deno.land/x/etag.
Prior Art
Inspired by both the Oak framework's etag.ts module, and the OG jshttp/etag package of the Node ecosystem.
Functions
Attempt to decode an etag into the relevant file info. This is experimental, and by design is only compatible with ETags that were either 1) generated using this module, or 2) generated with a similar library that uses the same API to generate its tags. | |
Calculate an ETag value for an entity. If the entity is | |
Create middleware that will attempt to decode the response.body into
something that can be used to generate an | |
A helper function that takes the value from the | |
A helper function that takes the value from the | |
A helper function that takes the value from the |
Interfaces
Properties unique to the decoded statTag interface. StatTags are generated
for objects that exhibit characteristics of the | |