go-ext2mime
所属分类:开发工具
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2024-03-13 05:41:03
上 传 者:
sh-1993
说明: 包ext2mime为Go编程语言提供了一些工具,用于推断与文件扩展名相关联的MIME类型。
(Package ext2mime provides tools inferring what MIME type is associated with a file extension, for the Go programming language.)
文件列表:
LICENSE
default.go
errors.go
get.go
go.mod
init.go
mapping.go
set.go
# go-ext2mime
Package **ext2mime** provides tools inferring what MIME type is associated with a file extension, for the Go programming language.
For example:
* `.css` -> `text/css`
* `.epub` -> `application/epub+zip`,
* `.html` -> `text/html`,
* `.jpeg` -> `image/jpeg`
* `.js` -> `text/javascript`,
* `.json` -> `application/json`,
* `.md` -> `text/markdown`,
* `.png` -> `image/png`
* `.qoi` -> `image/qoi`
* etc etc etc.
## Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-ext2mime
[![GoDoc](https://godoc.org/github.com/reiver/go-ext2mime?status.svg)](https://godoc.org/github.com/reiver/go-ext2mime)
## Example
Here is a simple example:
```golang
import "github.com/reiver/go-ext2mime"
// ...
fileExtension := path.Ext(filename)
mimeType := ext2mime.Get(fileExtension)
```
You can also add you own file-extension to MIME-type mapping with:
```golang
func init() {
const fileExtension string = ".abc"
const mimeType string = "application/abc"
ext2mime.Set(fileExtension, mimeType)
}
```
## Import
To import package **ext2mime** use `import` code like the follownig:
```
import "github.com/reiver/go-ext2mime"
```
## Installation
To install package **ext2mime** do the following:
```
GOPROXY=direct go get https://github.com/reiver/go-ext2mime
```
## Author
Package **ext2mime** was written by [Charles Iliya Krempeaux](http://reiver.link)
近期下载者:
相关文件:
收藏者: