使用场景
元数据是用来描述对象属性的一组键值对,可用来管理对象。在媒体存储中,用户可控制修改的元数据描述如下表:
名称 | 说明 |
---|---|
Cache-Control | 指定请求或者响应对象时网页需要遵守的缓存行为。 • 用于请求:max-stale[=]、min-fresh=、only-if-cached • 用于响应:public、private、must-revalidate、proxy-revalidate、s-maxage= • 可用于请求与响应:no-cache、no-store、no-transform、max-age=、cache-extension |
Content-Disposition | 指定对象的默认文件名。 如果设置对象Content-Disposition的值为“attachment;filename="test.png"”,当访问该对象时,会以文件名为"test.png"显示该对象。 |
Content-Encoding | 指定对象的编码类型。如: gzip、compress、deflate、identity、exi、br、peerdist、bzip2 |
Content-Language | 指定对象的内容语言。如: zh-CN(中国)、en-GB(英国)、en-US(美国)、fr-FR(法国)、de-DE(德国) |
Content-Length | 指定对象的大小。该值是指所有内容编码的大小, 例如,对对象进行了gzip压缩, Content-Length指的是对象压缩后的大小而并非原始大小。 |
Content-Type | 指定对象的文件类型。 详情请见本文中的【对象元数据Content-Type】内容。 |
Expires | 指定对象的缓存过期时间。 |
对象元数据Content-Type
使用控制台上传的对象,媒体存储会自动根据对象的文件扩展名来匹配Content-Type的值。如您需要修改Content-Type,可以通过修改对象的文件扩展名来实现。
说明:使用API上传对象时,需要指定Content-Type值。
下表列举了常见的Content-Type类型:
文件扩展名 | Content-Type | 文件扩展名 | Content-Type |
---|---|---|---|
.*( 二进制流,不知道下载文件类型) | application/octet-stream | .a11 | application/x-a11 |
.acp | audio/x-mei-aac | .ai | application/postscript |
.aif | audio/aiff | .aifc | audio/aiff |
.aiff | audio/aiff | .anv | application/x-anv |
.asa | text/asa | .asf | video/x-ms-asf |
.asp | text/asp | .asx | video/x-ms-asf |
.au | audio/basic | .avi | video/avi |
.awf | application/vnd.adobe.workflow | .biz | text/xml |
.bmp | application/x-bmp | .bot | application/x-bot |
.c4t | application/x-c4t | .class | java/* |
.cal | application/x-cals | .cmp | application/x-cmp |
.cdf | application/x-netcdf | .cot | application/x-cot |
.cml | text/xml | .crt | application/x-x509-ca-cert |
.cmx | application/x-cmx | .css | text/css |
.crl | application/pkix-crl | .dbf | application/x-dbf |
.csi | application/x-csi | .dbx | application/x-dbx |
.cut | application/x-cut | .dcx | application/x-dcx |
.dbm | application/x-dbm | .dgn | application/x-dgn |
.dcd | text/xml | .dll | application/x-msdownload |
.der | application/x-x509-ca-cert | .dot | application/msword |
.dib | application/x-dib | .dtd | text/xml |
.doc | application/msword | .dwf | application/x-dwf |
.drw | application/x-drw | .dxb | application/x-dxb |
.dwf | Model/vnd.dwf | .edn | application/vnd.adobe.edn |
.ent | text/xml | .exe | application/x-msdownload |
.eps | application/x-ps | .fdf | application/vnd.fdf |
.etd | application/x-ebx | .fo | text/xml |
.fax | image/fax | .g4 | application/x-g4 |
.fif | application/fractals | . | application/x- |
.frm | application/x-frm | .gl2 | application/x-gl2 |
.gbr | application/x-gbr | .hgl | application/x-hgl |
.gif | image/gif | .hpg | application/x-hpgl |
.gp4 | application/x-gp4 | .hqx | application/mac-binhex40 |
.hmr | application/x-hmr | .hta | application/hta |
.hpl | application/x-hpl | .htm | text/html |
.hrf | application/x-hrf | .htt | text/webviewhtml |
.htc | text/x-component | .iii | application/x-iphone |
.html | text/html | .ins | application/x-internet-signup |
.htx | text/html | .IVF | video/x-ivf |
.ico | image/x-icon | .jfif | image/jpeg |
.img | application/x-img | .jpe | application/x-jpe |
.isp | application/x-internet-signup | .jpg | image/jpeg |
.java | java/* | .js | text/javascript |
.jpe | image/jpeg | .la1 | audio/x-liquid-file |
.jpeg | image/jpeg | .latex | application/x-latex |
.jpg | application/x-jpg | .lbm | application/x-lbm |
.jsp | text/html | .ls | application/x-javascript |
.lar | application/x-laplayer-reg | .m1v | video/x-mpeg |
.lavs | audio/x-liquid-secure | .m3u | audio/mpegurl |
.lmsff | audio/x-la-lms | .mac | application/x-mac |
.ltr | application/x-ltr | .math | text/xml |
.m2v | video/x-mpeg | .mdb | application/x-mdb |
.m4e | video/mpeg4 | .mht | message/rfc822 |
.man | application/x-troff-man | .mi | application/x-mi |
.mdb | application/msaccess | .midi | audio/mid |
.mfp | application/x-shockwave-flash | .mml | text/xml |
.mhtml | message/rfc822 | .mns | audio/x-musicnet-stream |
.mid | audio/mid | .movie | video/x-sgi-movie |
.mil | application/x-mil | .mp2 | audio/mp2 |
.mnd | audio/x-musicnet-download | .mp3 | audio/mp3 |
.mocha | application/x-javascript | .mpa | video/x-mpg |
.mp1 | audio/mp1 | .mpe | video/x-mpeg |
.mp2v | video/mpeg | .mpg | video/mpg |
.mp4 | video/mp4 | .mpp | application/vnd.ms-project |
.mpd | application/vnd.ms-project | .mpt | application/vnd.ms-project |
.mpeg | video/mpg | .mpv2 | video/mpeg |
.mpga | audio/rn-mpeg | .mpx | application/vnd.ms-project |
.mps | video/x-mpeg | .mxp | application/x-mmxp |
.mpv | video/mpg | .nrf | application/x-nrf |
.mpw | application/vnd.ms-project | .odc | text/x-ms-odc |
.mtx | text/xml | .pl | application/x-perl |
.net | image/pnetvue | .pls | audio/scpls |
.nws | message/rfc822 | .png | image/png |
.out | application/x-out | .pot | application/vnd.ms-powerpoint |
.pc5 | application/x-pc5 | .ppm | application/x-ppm |
.pcl | application/x-pcl | .ppt | application/vnd.ms-powerpoint |
application/pdf | .pr | application/x-pr | |
.pdx | application/vnd.adobe.pdx | .prn | application/x-prn |
.pgl | application/x-pgl | .ps | application/x-ps |
.pko | application/vnd.ms-pki.pko | .ptn | application/x-ptn |
.plg | text/html | .r3t | text/vnd.rn-realtext3d |
.plt | application/x-plt | .ram | audio/x-pn-realaudio |
.png | application/x-png | .rat | application/rat-file |
.ppa | application/vnd.ms-powerpoint | .rec | application/vnd.rn-recording |
.pps | application/vnd.ms-powerpoint | .rgb | application/x-rgb |
.ppt | application/x-ppt | .rjt | application/vnd.rn-realsystem-rjt |
.prf | application/pics-rules | .rle | application/x-rle |
.prt | application/x-prt | .rmf | application/vnd.adobe.rmf |
.ps | application/postscript | .rmj | application/vnd.rn-realsystem-rmj |
.pwz | application/vnd.ms-powerpoint | .rmp | application/vnd.rn-rn_music_package |
.ra | audio/vnd.rn-realaudio | .rmvb | application/vnd.rn-realmedia-vbr |
.ras | application/x-ras | .rnx | application/vnd.rn-realplayer |
.rdf | text/xml | .rpm | audio/x-pn-realaudio-plugin |
.red | application/x-red | .rt | text/vnd.rn-realtext |
.rjs | application/vnd.rn-realsystem-rjs | .rtf | application/x-rtf |
.rlc | application/x-rlc | .sam | application/x-sam |
.rm | application/vnd.rn-realmedia | .sdp | application/sdp |
.rmi | audio/mid | .sit | application/x-stuffit |
.rmm | audio/x-pn-realaudio | .sld | application/x-sld |
.rms | application/vnd.rn-realmedia-secure | .smi | application/smil |
.rmx | application/vnd.rn-realsystem-rmx | .smk | application/x-smk |
.rp | image/vnd.rn-realpix | .sol | text/plain |
.rsml | application/vnd.rn-rsml | .spc | application/x-pkcs7-certificates |
.rtf | application/msword | .spp | text/xml |
.rv | video/vnd.rn-realvideo | .sst | application/vnd.ms-pki.certstore |
.sat | application/x-sat | .stm | text/html |
.sdw | application/x-sdw | .svg | text/svg+xml |
.slb | application/x-slb | .tld | text/xml |
.slk | drawing/x-slk | .torrent | application/x-bittorrent |
.smil | application/smil | .txt | text/plain |
.snd | audio/basic | .uls | text/iuls |
.sor | text/plain | .vda | application/x-vda |
.sty | application/x-sty | .vml | text/xml |
.swf | application/x-shockwave-flash | .vsd | application/vnd.visio |
.tg4 | application/x-tg4 | .vss | application/vnd.visio |
.tif | image/tiff | .vst | application/x-vst |
.tiff | image/tiff | .vsx | application/vnd.visio |
.top | drawing/x-top | .vxml | text/xml |
.tsd | text/xml | .wax | audio/x-ms-wax |
.uin | application/x-icq | .wb2 | application/x-wb2 |
.vcf | text/x-vcard | .wbmp | image/vnd.wap.wbmp |
.vdx | application/vnd.visio | .wk3 | application/x-wk3 |
.vpg | application/x-vpeg005 | .wkq | application/x-wkq |
.vsd | application/x-vsd | .wm | video/x-ms-wm |
.vst | application/vnd.visio | .wmd | application/x-ms-wmd |
.vsw | application/vnd.visio | .wml | text/vnd.wap.wml |
.vtx | application/vnd.visio | .wmx | video/x-ms-wmx |
.wav | audio/wav | .wp6 | application/x-wp6 |
.wb1 | application/x-wb1 | .wpg | application/x-wpg |
.wb3 | application/x-wb3 | .wq1 | application/x-wq1 |
.wiz | application/msword | .wri | application/x-wri |
.wk4 | application/x-wk4 | .ws | application/x-ws |
.wks | application/x-wks | .wsc | text/scriptlet |
.wma | audio/x-ms-wma | .wvx | video/x-ms-wvx |
.wmf | application/x-wmf | .xdr | text/xml |
.wmv | video/x-ms-wmv | .xfdf | application/vnd.adobe.xfdf |
.wmz | application/x-ms-wmz | .xls | application/vnd.ms-excel |
.wsdl | text/xml | .xlw | application/x-xlw |
.xdp | application/vnd.adobe.xdp | .xpl | audio/scpls |
.xfd | application/vnd.adobe.xfd | .xql | text/xml |
.xhtml | text/html | .xsd | text/xml |
.xls | application/x-xls | .xslt | text/xml |
.xml | text/xml | .x_b | application/x-x_b |
.xq | text/xml | .sisx | application/vnd.symbian.install |
.xquery | text/xml | .ipa | application/vnd.iphone |
.xsl | text/xml | .xap | application/x-silverlight-app |
.xwd | application/x-xwd | .rar | application/x-rar-compressed |
.sis | application/vnd.symbian.install | .x_t | application/x-x_t |
.apk | application/vnd.android.package-archive | .zip | application/zip |
自定义元数据
当用户需要自定义管理对象时,可以使用自定义元数据。媒体存储为用户提供了以“x-amz-meta-”开头的消息头来加入自定义元数据中,当用户查询此对象时,该自定义元数据将会携带在返回的响应头中。
自定义元数据的key值不区分大小写,媒体存储统一转为小写进行存储。value值区分大小写。
示例:
PUT /test HTTP/1.1
Host: bucket01.ctyunxs.1cn
x-amz-meta-TEST: Test Meta
HEAD /test HTTP/1.1
Host: bucket01.ctyunxs.1cn
x-amz-meta-test: Test Meta
自定义元数据key-value对都必须符合US-ASCII。
使用方式
媒体存储支持通过控制台、API、SDK方式配置对象自定义元数据。
支持的使用方式 | 参考文档 |
---|---|
控制台 | 可参考:上传对象时在设置对象属性页配置元数据。 |
SDK | 媒体存储支持多种语言SDK,请从SDK概览页面选择进入对应的开发指南查阅。 |