對象元數據
更新時間 2024-08-20 11:36:37
最近更新時間: 2024-08-20 11:36:37
分享文章
本章節主要介紹媒體存儲對象元數據。
使用場景
元數據是用來描述對象屬性的一組鍵值對,可用來管理對象。在媒體存儲中,用戶可控制修改的元數據描述如下表:
| 名稱 | 說明 |
|---|---|
| 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概覽頁面選擇進入對應的開發指南查閱。 |