# 🧾 contenty
[](https://hex.pm/packages/contenty)
[](https://hexdocs.pm/contenty/)
A tiny Gleam library for parsing and inspecting `HTTP Content-Type` headers.
## ✨ Features
- Parses Content-Type strings into a structured, opaque ContentType value
- Handles parameters like charset, boundary, version, etc.
- Ignores malformed parameters safely
- Case-insensitive, whitespace-tolerant, and RFC-aware
- No dependencies beyond the Gleam standard library
## Installation
```sh
gleam add contenty
```
```gleam
import contenty
import gleam/result
import gleam/dict
pub fn main() {
let content_type = contenty.parse("text/html; charset=utf-8")
contenty.mime(content_type)
// "text/html"
contenty.mime_type(content_type)
// "text"
contenty.mime_subtype(content_type)
// "html"
contenty.param(content_type, "charset")
// Ok("utf-8")
contenty.params(content_type)
// dict.from_list([#("charset", "utf-8")])
}
```
Further documentation can be found at <https://hexdocs.pm/contenty>.
## Development
```sh
gleam test # Run the tests
```