aplr / Mime

Mime type parser for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mime

Build Documentation

The Mime package provides you with a simple interface for parsing urls and file extensions to their appropriate mime types.

Installation

Mime is available via the Swift Package Manager which is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system and automates the process of downloading, compiling, and linking dependencies.

Once you have your Swift package set up, adding Mime as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(
        url: "https://github.com/aplr/Mime.git",
        .upToNextMajor(from: "1.0.0")
    )
]

Usage

import Mime

let url = URL(string: "file:///tmp/vienna.png")!

guard let mime = Mime(url: url) else { return }

print(mime.mime) // image/png
print(mime.ext)  // png

Documentation

Documentation is available here and provides a comprehensive documentation of the library's public interface.

License

Mime is licensed under the MIT License.

About

Mime type parser for Swift

License:MIT License


Languages

Language:Swift 95.5%Language:Shell 4.5%