地球上所有 MimeType 的列表,映射到文件扩展名?

发布于 2024-08-11 08:05:45 字数 1539 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

等风来 2024-08-18 08:05:45

http://www.iana.org/assignments/media-types/ 列出了“官方”哑剧类型,但这并不妨碍任何人制作自己的哑剧类型,但不向 IANA 注册。

http://www.iana.org/assignments/media-types/ lists the "official" mime-types, but it doesn't prevent anyone making their own an not registering it with IANA.

我是有多爱你 2024-08-18 08:05:45

Here's the most up-to-date mime.types maintained by the Apache HTTPD community:
http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/conf/mime.types?view=annotate

新一帅帅 2024-08-18 08:05:45

IANA 列出了官方的。 包含我认为有用的文件扩展名的列表是一个包含在 Debian 和 Debian 中的 /etc/mime.types 中。乌班图。

Apache Web 服务器项目还维护一个列表.

IANA lists the official ones. A list which includes file extensions which I find useful is the one included as /etc/mime.types in Debian & Ubuntu.

The Apache web server project also maintains a list.

a√萤火虫的光℡ 2024-08-18 08:05:45

我从许多网站和列表中收集了 MIME 类型和文件扩展名,结果如下: https ://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.txt

我还创建了一个 JSON 文件:https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json

如果缺少或不正确,请告诉我

I collected MIME types and file extensions from many sites and lists, and here's the result: https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.txt

I also created a JSON file: https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json

Please tell me if something is missing or incorrect

无言温柔 2024-08-18 08:05:45

iana 正在跟踪官方消息,但当然人们可以随时声明他们的消息自己的...

换句话说,您能否获得地球上的完整列表是值得怀疑的。

还要考虑 NPAPI 插件的情况,这些插件声明 MIME 类型只是为了易于访问......并且由于某种原因,这些 MIME 类型可能对您不感兴趣。

iana is tracking the official ones but of course folks can always declare their own...

In other words, it is doubtful you'll ever get the full list on the Planet.

Also consider the case of NPAPI plugins which declare MIME-types just to be be easily accessible... and these MIME-types might be not interesting to you for a reason or another.

七分※倦醒 2024-08-18 08:05:45

如果您使用 Java,则可以使用 Apache Tika,这是一个用于处理文件类型的强大库。有了它,您可以轻松获得与几行 mime 类型相关的首选扩展名:

TikaConfig config = TikaConfig.getDefaultConfig();
MimeType mimeType = config.getMimeRepository().forName("image/png"); //Generally your textual mime type
String extension = mimeType.getExtension();
// this would return the extension with the dot. For "image/png" returns ".png"

这样您就不必费力下载和解析具有关联的文件,我发现它非常舒服。这就是我完成这个技巧的方法。

If your are using Java you could use Apache Tika, which is a powerful library for dealing with file types. With it you can easily get the preferred extension related to a mime type with a couple of rows:

TikaConfig config = TikaConfig.getDefaultConfig();
MimeType mimeType = config.getMimeRepository().forName("image/png"); //Generally your textual mime type
String extension = mimeType.getExtension();
// this would return the extension with the dot. For "image/png" returns ".png"

In this way you don't have to mess with downloading and parsing a file with the associations, I find it very comfortable. This is the way I've done the trick.

装迷糊 2024-08-18 08:05:45

您可以在 https://drive.google.com/open 上找到一个很好的 Mime 类型表?id=0By00BwrZ8886VUg3ak9faG5mTU0
更新日期:2017 年 2 月 27 日。
我确信它能满足您所有需要的哑剧类型。

There is a good Mime Type Table you can find on https://drive.google.com/open?id=0By00BwrZ8886VUg3ak9faG5mTU0
Which is updated 27-02-2017.
I am sure that meet your all needful mime type.

断肠人 2024-08-18 08:05:45

Gourley 和 Totty(O'Reilly,封面上有一只松鼠)的经典著作《HTTP: The Definitive Guide》附录 D 中有一张很好的表格。截至目前看来,它是完整且最新的这本书是写成的(2002 年)。那是很久以前的事了,但您会在那里找到所有旧的最爱以及晦涩的“仅限公司”的内容。

ISBN 1-56592-509-2,http://oreilly.com/catalog/9781565925090/

There's a good table in the classic book "HTTP: The Definitive Guide" by Gourley and Totty (O'Reilly, with a squirrel on the cover) in Appendix D. It appears to be complete and up-to-date as of the time the book was written (in 2002). That was a long time ago, but you'll find all the old favorites there as well as obscure "company-only" ones.

ISBN 1-56592-509-2, http://oreilly.com/catalog/9781565925090/

白龙吟 2024-08-18 08:05:45

这是一个易于查看的完整列表:

http://www.webmaster-toolkit .com/mime-types.shtml

Here is a full list that is easy on the eyes:

http://www.webmaster-toolkit.com/mime-types.shtml

时光匆匆的小流年 2024-08-18 08:05:45

用户 Paul Tarjan 在评论中说道:

stdicon.com 上有一个非常好的列表:stdicon.com/mimetypes

该网站不再可用,但最新的存档是 https://web .archive.org/web/20161015175648/http://www.stdicon.com/mimetypes

请注意,该网站没有提到“application/x-zip-compressed”(这并不是因为转义斜杠)所以它并不完美。

User Paul Tarjan said in a comment:

There is a pretty good list on stdicon.com : stdicon.com/mimetypes

This website is no longer available, but the most recent archive is https://web.archive.org/web/20161015175648/http://www.stdicon.com/mimetypes

Note that this site doesn't mention "application/x-zip-compressed" (and it's not because of the escaping of slashes either) so it's not perfect.

翻身的咸鱼 2024-08-18 08:05:45

我从 Apache mime 中获取了该列表。类型(截至 2017 年 9 月 29 日周五 15:10:29 UTC),并编写了一个脚本将其转换为 json 映射。 json 对于 stackoverflow 答案来说太大了。您可以此处 mimes.json 找到它。

生成映射的脚本:

# mime_to_json.py
# get the mime.types from
# http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

import sys
import re
import json

mapping = {}
with open(sys.argv[1], "r") as handle:
    for line in handle:
        line = line.strip()
        if line[0] == "#":
            continue
        parts = re.split("\s+", line)
        mime = parts[0]
        del parts[0]
        for ext in parts:
            mapping[ext] = mime

print(json.dumps(mapping, indent=4, sort_keys=True))

I took the list from Apache mime.types as of Fri Sep 29 15:10:29 2017 UTC and wrote a script to convert it to a json mapping. The json is too big for stackoverflow answer. You can find it here mimes.json.

script to generate the mapping:

# mime_to_json.py
# get the mime.types from
# http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup

import sys
import re
import json

mapping = {}
with open(sys.argv[1], "r") as handle:
    for line in handle:
        line = line.strip()
        if line[0] == "#":
            continue
        parts = re.split("\s+", line)
        mime = parts[0]
        del parts[0]
        for ext in parts:
            mapping[ext] = mime

print(json.dumps(mapping, indent=4, sort_keys=True))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文