Documentation
¶
Overview ¶
Package formats defines the canonical format registry used for routing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Format ¶
type Format struct {
ID string // canonical id: "md", "docx", "mp4"
Category Category
Extensions []string // includes leading dot: ".md", ".markdown"
MimeTypes []string
Text bool // true for text-based formats (safe to pipe via stdin)
}
Format describes a single file format.
func AllByCategory ¶
AllByCategory returns formats filtered by category.
func ByExtension ¶
ID returns the canonical format id for the given extension (without dot). Returns empty string if not found.
func DetectFile ¶
DetectFile detects the format of a file by magic bytes then extension.
func DetectReader ¶
DetectReader detects the format from a reader (reads first 512 bytes). For generic text/plain MIME type, extension-based detection takes priority because many text-based formats (md, rst, toml, yaml, etc.) share the same MIME.
Click to show internal directories.
Click to hide internal directories.