MCPcopy
hub / github.com/tinyhttp/tinyhttp / createETag

Function createETag

packages/send/src/utils.ts:5–11  ·  view source on GitHub ↗
(body: Buffer | string | Stats, encoding: BufferEncoding)

Source from the content-addressed store, hash-verified

3import { Stats } from 'fs'
4
5export const createETag = (body: Buffer | string | Stats, encoding: BufferEncoding) => {
6 if (body instanceof Stats) {
7 return eTag(body, { weak: true })
8 } else {
9 return eTag(!Buffer.isBuffer(body) ? Buffer.from(body, encoding) : body, { weak: true })
10 }
11}
12
13export function setCharset(type: string, charset: string) {
14 const parsed = parse(type)

Callers 2

sendFileFunction · 0.90
sendFunction · 0.90

Calls 1

eTagFunction · 0.90

Tested by

no test coverage detected