Skip to main content

@std/http@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function calculate
calculate(
entity: Entity,
options?: ETagOptions
): Promise<string | undefined>

Calculate an ETag for an entity. When the entity is a specific set of data it will be fingerprinted as a "strong" tag, otherwise if it is just file information, it will be calculated as a weak tag.

import { calculate } from "@std/http/etag";
import { assert } from "@std/assert/assert"

const body = "hello deno!";

const etag = await calculate(body);
assert(etag);

const res = new Response(body, { headers: { etag } });

Parameters

optional
options: ETagOptions

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/http

Import symbol

import { calculate } from "@std/http";
or

Import directly with a jsr specifier

import { calculate } from "jsr:@std/http";