2011-09-30 97 views
11

我無法在互聯網上找到完整的MIME類型映射列表。 我想有一個列表,指向每個現有的MIME類型的文件擴展名。MIME類型的完整列表<->文件擴展名映射

所有MIME類型的列表可以在這裏找到:
http://www.iana.org/assignments/media-types

但資源不包括文件擴展名映射。

我GOOGLE了一會兒,並找不到所有MIME類型的映射列表。只列出最常見的列表。在我找到的所有列表中,例如此條目缺失:

application/vnd.openxmlformats-officedocument.wordprocessingml.document -> .docx 

有人知道資源在哪裏可以找到完整的映射嗎?

回答

10

你必須安裝apache或nginx或其他東西,然後看看mime.types文件。

# MIME type     Extensions 
# application/3gpp-ims+xml 
# application/activemessage 
application/andrew-inset   ez 
# application/applefile 
application/applixware    aw 
application/atom+xml    atom 
application/atomcat+xml    atomcat 
# application/atomicmail 
application/atomsvc+xml    atomsvc 
# application/auth-policy+xml 
... 
more, more, more over 1300 mine-types. 
+17

..或取從'mime.types'文件一個類似[http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types](http://svn.apache.org/repos/asf/httpd/httpd /trunk/docs/conf/mime.types) –

+1

但只有未被註釋掉的包括映射。另一個在該文件中留空。 –

+0

評論類型通常不支持瀏覽器,所以你沒有使用它。 – TheHorse

19

使用於爾根的mime.types鏈接和一個小的命令行魔法,可以生成列表中選擇所需很快:

wget -qO- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | egrep -v ^# | awk '{ for (i=2; i<=NF; i++) {print $i" "$1}}' | sort 
+0

npm模塊根據你的回答https://github.com/miguelmota/mime-ext –

相關問題