BinaryBirds / swift-mime

A MIME type library written for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swift-mime

The swift-mime library can convert file extensions into possible MIME types.

Install command line utility

You can use the command line utility to convert file extensions into file MIME types on the fly.

$ git clone https://github.com/BinaryBirds/swift-mime.git && cd swift-mime
$ make install

$ mime txt 
$ # => text/plain

Library usage

You can use the Swift Package Manager as usual:

.package(url: "https://github.com/binarybirds/swift-mime", from: "1.0.0"),

.product(name: "MIME", package: "swift-mime"),

⚠️ Don't forget to add "MIME" to your target as a dependency!

import MIME

let mime = MIME()
let result = mime.getType(for: "txt")

print(result) // => text/plain

Useful resources

About

A MIME type library written for Swift

License:MIT License


Languages

Language:Swift 99.8%Language:Makefile 0.2%