IF Commons GitHub

governance/mime

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-serve-governance FR-004

The content types by extension: a small typed table the server reads and never grows by itself. What it does not name is application/octet-stream, and a text that is not a name is that too.

import { contentTypeOf } from "./mime.ts";
contentTypeOf("report.pdf"); // "application/pdf"
contentTypeOf("noextension"); // "application/octet-stream"

Source: commons/anyfs-serve/src/governance/mime.ts

2 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

CONTENT_TYPESconst
const CONTENT_TYPES: Readonly<Record<string, string>>

The extensions the server knows, lower case, without the dot.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

contentTypeOffunction
function contentTypeOf(name: string): string

The content type of a name: by its last extension, in lower case.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.