MCPcopy Create free account
hub / github.com/Effect-TS/effect / resolveMimeType

Function resolveMimeType

packages/effect/src/unstable/http/HttpStaticServer.ts:297–303  ·  view source on GitHub ↗
(path: Path.Path, filePath: string, mimeTypes: Record<string, string>)

Source from the content-addressed store, hash-verified

295}
296
297const resolveMimeType = (path: Path.Path, filePath: string, mimeTypes: Record<string, string>): string => {
298 const extension = path.extname(filePath).toLowerCase()
299 if (extension.length <= 1) {
300 return "application/octet-stream"
301 }
302 return mimeTypes[extension.slice(1)] ?? "application/octet-stream"
303}
304
305const parseInteger = (value: string): number | undefined => {
306 if (!/^\d+$/.test(value)) {

Callers 1

setFileHeadersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected