MCPcopy
hub / github.com/tinyhttp/tinyhttp / eTag

Function eTag

packages/etag/src/index.ts:27–39  ·  view source on GitHub ↗
(entity: string | Buffer | Stats, options?: { weak: boolean })

Source from the content-addressed store, hash-verified

25}
26
27export const eTag = (entity: string | Buffer | Stats, options?: { weak: boolean }) => {
28 if (entity == null) {
29 throw new TypeError('argument entity is required')
30 }
31
32 const weak = options?.weak || entity instanceof Stats
33
34 // generate entity tag
35
36 const tag = entity instanceof Stats ? statTag(entity) : entityTag(entity)
37
38 return weak ? 'W/' + tag : tag
39}

Callers 3

createIconFunction · 0.90
createETagFunction · 0.90
etag.test.tsFile · 0.90

Calls 2

statTagFunction · 0.85
entityTagFunction · 0.85

Tested by

no test coverage detected