<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] > https://github.com/gabriel-vasile/mimetype ## 概述 * 檢測文件真是類型,**不會因為修改后綴名而變化** * 快速、精確的 MIME 類型和文件擴展名檢測 * [支持的 MIME 類型](https://github.com/gabriel-vasile/mimetype/blob/master/supported_mimes.md)的長列表[](https://github.com/gabriel-vasile/mimetype/blob/master/supported_mimes.md) * 可以[擴展](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-Extend)其他文件格式 * 通用文件格式優先 * [文本文件與二進制文件的區別](https://pkg.go.dev/github.com/gabriel-vasile/mimetype#example-package-TextVsBinary) * 并發使用安全 ## 示例 ### hello world ``` mtype := mimetype.Detect([]byte) // OR mtype, err := mimetype.DetectReader(io.Reader) // OR mtype, err := mimetype.DetectFile("/path/to/file") fmt.Println(mtype.String(), mtype.Extension()) ``` ### 設置白名單 ``` package main import ( "fmt" "github.com/gabriel-vasile/mimetype" ) func main() { testBytes := []byte("This random text has a MIME type of text/plain; charset=utf-8.") allowed := []string{"text/plain", "application/zip", "application/pdf"} mtype := mimetype.Detect(testBytes) if mimetype.EqualsAny(mtype.String(), allowed...) { fmt.Printf("%s is allowed\n", mtype) } else { fmt.Printf("%s is now allowed\n", mtype) } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看