SkillAgentSearch skills...

MimeType

Get MIME type string from the extension of a file name

Install / Use

/learn @onevcat/MimeType
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MimeType

Get mime type from a file path or url extension. Like "text/html" for "/var/www/public/index.html" or "image/png" for "/home/user/cat.png".

Installation

Add the url of this repo to your Package.swift:

import PackageDescription

let package = Package(
    name: "YourAwesomeSoftware",
    dependencies: [
        .Package(url: "https://github.com/onevcat/MimeType.git", 
                 majorVersion: 1)
    ]
)

Then run swift build whenever you get prepared.

You could know more information on how to use Swift Package Manager in Apple's official page.

Usage

let path = "/var/www/public/index.html"
let mime = MimeType(path: path).value
// "text/html"

let url = URL(fileURLWithPath: "/home/user/cat.png")
let anotherMime = MimeType(url: url).value
// "image/png"

License

MIT. See the LICENSE file.

Related Skills

View on GitHub
GitHub Stars42
CategoryDevelopment
Updated9mo ago
Forks10

Languages

Swift

Security Score

82/100

Audited on Jun 30, 2025

No findings