Skip to content

Instantly share code, notes, and snippets.

@treeform
Created May 28, 2024 18:47
Show Gist options
  • Save treeform/2c924b79ba2bc7bb63d2f37db928f5d5 to your computer and use it in GitHub Desktop.
Save treeform/2c924b79ba2bc7bb63d2f37db928f5d5 to your computer and use it in GitHub Desktop.
proc mimeType*(filePath: string): string =
case filePath.splitFile.ext:
of ".html": "text/html"
of ".js": "text/javascript"
of ".css": "text/css"
of ".ttf": "font/ttf"
of ".png": "image/png"
of ".jpg", ".jpeg": "image/jpeg"
of ".svg": "image/svg+xml"
else: "text/plain"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment