{"id":13786655,"url":"https://github.com/aofei/mimesniffer","last_synced_at":"2025-04-13T22:12:58.706Z","repository":{"id":57480869,"uuid":"162522864","full_name":"aofei/mimesniffer","owner":"aofei","description":"A MIME type sniffer for Go.","archived":false,"fork":false,"pushed_at":"2022-08-04T09:11:36.000Z","size":36,"stargazers_count":33,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T22:12:51.406Z","etag":null,"topics":["content-type","file-format","file-signature","go","magic-number","mime","mimesniffer","sniffer","type"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/aofei/mimesniffer","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aofei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-20T03:40:20.000Z","updated_at":"2024-11-06T11:54:48.000Z","dependencies_parsed_at":"2022-09-26T17:41:24.184Z","dependency_job_id":null,"html_url":"https://github.com/aofei/mimesniffer","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fmimesniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fmimesniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fmimesniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fmimesniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aofei","download_url":"https://codeload.github.com/aofei/mimesniffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788915,"owners_count":21161728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["content-type","file-format","file-signature","go","magic-number","mime","mimesniffer","sniffer","type"],"created_at":"2024-08-03T19:01:27.250Z","updated_at":"2025-04-13T22:12:58.677Z","avatar_url":"https://github.com/aofei.png","language":"Go","funding_links":[],"categories":["公用事业公司","Utilities","工具库","Utility","工具库`可以提升效率的通用代码库和工具`"],"sub_categories":["实用程序/Miscellaneous","HTTP Clients","Utility/Miscellaneous","查询语","Fail injection"],"readme":"# MIMESniffer\n\n[![GitHub Actions](https://github.com/aofei/mimesniffer/workflows/Test/badge.svg)](https://github.com/aofei/mimesniffer)\n[![codecov](https://codecov.io/gh/aofei/mimesniffer/branch/master/graph/badge.svg)](https://codecov.io/gh/aofei/mimesniffer)\n[![Go Report Card](https://goreportcard.com/badge/github.com/aofei/mimesniffer)](https://goreportcard.com/report/github.com/aofei/mimesniffer)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/aofei/mimesniffer)](https://pkg.go.dev/github.com/aofei/mimesniffer)\n\nA MIME type sniffer for Go.\n\nMIMESniffer implements the algorithm described at\n[here](https://mimesniff.spec.whatwg.org) and uses the file signatures (aka\n[magic numbers](https://en.wikipedia.org/wiki/Magic_number_\\(programming\\)#Magic_numbers_in_files))\nlisted [here](https://www.garykessler.net/library/file_sigs.html) to determine\nthe MIME type of the given data. So it can be used as an alternative for the\n[`http.DetectContentType`](https://pkg.go.dev/net/http#DetectContentType).\n\n## Features\n\n* Extremely easy to use\n\t* Two functions\n\t\t* [`mimesniffer.Register`](https://pkg.go.dev/github.com/aofei/mimesniffer#Register)\n\t\t* [`mimesniffer.Sniff`](https://pkg.go.dev/github.com/aofei/mimesniffer#Sniff)\n* Quite fast\n* Supports a wide range of MIME types\n\t* `application/epub+zip`\n\t* `application/font-sfnt`\n\t* `application/font-woff`\n\t* `application/msword`\n\t* `application/octet-stream`\n\t* `application/ogg`\n\t* `application/pdf`\n\t* `application/postscript`\n\t* `application/rtf`\n\t* `application/vnd.ms-cab-compressed`\n\t* `application/vnd.ms-excel`\n\t* `application/vnd.ms-fontobject`\n\t* `application/vnd.ms-powerpoint`\n\t* `application/vnd.openxmlformats-officedocument.presentationml.presentation`\n\t* `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`\n\t* `application/vnd.openxmlformats-officedocument.wordprocessingml.document`\n\t* `application/wasm`\n\t* `application/x-7z-compressed`\n\t* `application/x-bzip2`\n\t* `application/x-compress`\n\t* `application/x-deb`\n\t* `application/x-executable`\n\t* `application/x-google-chrome-extension`\n\t* `application/x-gzip`\n\t* `application/x-lzip`\n\t* `application/x-msdownload`\n\t* `application/x-nintendo-nes-rom`\n\t* `application/x-rar-compressed`\n\t* `application/x-rpm`\n\t* `application/x-shockwave-flash`\n\t* `application/x-sqlite3`\n\t* `application/x-tar`\n\t* `application/x-unix-archive`\n\t* `application/x-xz`\n\t* `application/zip`\n\t* `audio/aac`\n\t* `audio/aiff`\n\t* `audio/amr`\n\t* `audio/basic`\n\t* `audio/m4a`\n\t* `audio/midi`\n\t* `audio/mpeg`\n\t* `audio/ogg`\n\t* `audio/wave`\n\t* `audio/x-flac`\n\t* `audio/x-wav`\n\t* `font/collection`\n\t* `font/otf`\n\t* `font/ttf`\n\t* `font/woff2`\n\t* `font/woff`\n\t* `image/bmp`\n\t* `image/gif`\n\t* `image/jp2`\n\t* `image/jpeg`\n\t* `image/png`\n\t* `image/tiff`\n\t* `image/vnd.adobe.photoshop`\n\t* `image/vnd.microsoft.icon`\n\t* `image/webp`\n\t* `image/x-canon-cr2`\n\t* `text/html; charset=utf-8`\n\t* `text/plain; charset=utf-16be`\n\t* `text/plain; charset=utf-16le`\n\t* `text/plain; charset=utf-8`\n\t* `text/xml; charset=utf-8`\n\t* `video/avi`\n\t* `video/mp4`\n\t* `video/mpeg`\n\t* `video/quicktime`\n\t* `video/webm`\n\t* `video/x-flv`\n\t* `video/x-m4v`\n\t* `video/x-matroska`\n\t* `video/x-ms-wmv`\n\t* `video/x-msvideo`\n* Zero third-party dependencies\n\n## Installation\n\nOpen your terminal and execute\n\n```bash\n$ go get github.com/aofei/mimesniffer\n```\n\ndone.\n\n\u003e The only requirement is the [Go](https://go.dev), at least v1.13.\n\n## Community\n\nIf you want to discuss MIMESniffer, or ask questions about it, simply post\nquestions or ideas [here](https://github.com/aofei/mimesniffer/issues).\n\n## Contributing\n\nIf you want to help build MIMESniffer, simply follow\n[this](https://github.com/aofei/mimesniffer/wiki/Contributing) to send pull requests\n[here](https://github.com/aofei/mimesniffer/pulls).\n\n## License\n\nThis project is licensed under the MIT License.\n\nLicense can be found [here](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fmimesniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faofei%2Fmimesniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fmimesniffer/lists"}