SwiftyMimeTypes 2.1.0

SwiftyMimeTypes 2.1.0

测试已测试
语言语言 SwiftSwift
许可证 未知
发布上次发布2018年4月
SPM支持 SPM

Daniel Seither 维护。



SwiftyMimeTypes

CI Status Version License Platform

SwiftyMimeTypes 是一个 MIME 类型及文件扩展名数据库。如果您需要为给定的文件名查找合适的 MIME 类型或为给定的 MIME 查找关联的扩展名,则可使用它。

示例

SwiftyMimeTypes 是一个具有简单界面的小型库。

获取给定 MIME 类型的文件扩展名

// prints "js"
print(MimeTypes.filenameExtension(forType: "application/javascript"))

获取给定 MIME 类型的所有已知文件扩展名

// prints ["md", "markdown"]
print(MimeTypes.filenameExtensions(forType: "text/markdown"))

获取指定文件扩展名的 MIME 类型

// prints "application/javascript"
print(MimeTypes.mimeType(forExtension: "js"))

要求

Xcode 9.x 和 Swift 4.x(使用版本 1.x 或 Xcode 8 和 Swift 3 兼容的 swift3 分支)

安装

SwiftyMimeTypes 可通过 CocoaPods 获得。安装步骤简单,只需将以下行添加到您的 Podfile

pod "SwiftyMimeTypes"

Swift 包管理器(SPM)

由于目前没有方法包含资源(mime.types 文件),故尚未支持 SPM。详情请参见 bug SR-2866

作者

丹尼尔·赛特尔,[email protected]

许可证

Copyright 2016, 2017, 2018 Daniel Seither <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.