Function
resolveMimeType
(path: Path.Path, filePath: string, mimeTypes: Record<string, string>)
Source from the content-addressed store, hash-verified
| 295 | } |
| 296 | |
| 297 | const 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 | |
| 305 | const parseInteger = (value: string): number | undefined => { |
| 306 | if (!/^\d+$/.test(value)) { |
Tested by
no test coverage detected