sequence
Blob binary file download function (background return file stream download and export function encapsulation, call example), involving files with different suffixes, here is the article
// type 表示默认保存类型为图片png格式
window.URL.createObjectURL(new Blob([res], {
type : 'image/png'}))
Blob configuration relation correspondence table:
suffix | file type | type |
---|---|---|
.xls | Microsoft Excel | application/vnd.ms-excel |
.xlsx | Microsoft Excel (OpenXML) | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.csv | CSV | text/csv |
.doc | Microsoft Word | application/msword |
.docx | Microsoft Word (OpenXML) | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
application/pdf | ||
.ppt | Microsoft PowerPoint | application/vnd.ms-powerpoint |
.pptx | Microsoft PowerPoint (OpenXML) | application/vnd.openxmlformats-officedocument.presentationml.presentation |
.png | Portable Network Graphics (PNG) | image/png |
.gif | GIF | image/gif |
.jpeg | jpeg images | image/jpeg |
.jpg | jpeg images | image/jpeg |
.mp3 | MP3 audio | audio/mpeg |
.aac | AAC audio | audio/aac |
.html | Hypertext Markup Language (HTML) | text/html |
.css | CSS | text/css |
.js | JavaScript | text/javascript |
.json | JSON format | application/json |
abv | AbiWord document | application/x-abiword |
.arc | Archive Documentation (multiple files embedded) | application/x-freearc |
.avi | AVI: Audio Video Interleave | video/x-msvideo |
.azw | Amazon Kindle eBook format | application/vnd.amazon.ebook |
.bin | any type of binary data | application/octet-stream |
.bmp | Windows OS/2 bitmap graphics | image/bmp |
.bz | BZip archive | application/x-bzip |
.bz2 | BZip2 archive | application/x-bzip2 |
.csh | C-Shell script | application/x-csh |
.eot | MS embedded OpenType fonts | application/vnd.ms-fontobject |
.epub | Electronic Publication (EPUB) | application/epub+zip |
.htm | Hypertext Markup Language (HTML) | text/html |
.ico | Icon format | image/vnd.microsoft.icon |
.ics | iCalendar format | text/calendar |
.jar | Java Archive (JAR) | application/java-archive |
.jsonld | JSON-LD format | application/ld+json |
.mid | Musical Instrument Digital Interface (MIDI) | audio/midi audio/x-midi |
.midi | Musical Instrument Digital Interface (MIDI) | audio/midi audio/x-midi |
.mjs | JavaScript modules | text/javascript |
.mpeg | MPEG video | video/mpeg |
.mpkg | apple installer package | application/vnd.apple.installer+xml |
.odp | OpenDocument presentation document | application/vnd.oasis.opendocument.presentation |
.ods | OpenDocument spreadsheet file | application/vnd.oasis.opendocument.spreadsheet |
.odt | OpenDocument text document | application/vnd.oasis.opendocument.text |
.oga | OGG audio | audio/ogg |
.ogv | OGG video | video/ogg |
.ogx | OGG | application/ogg |
.otf | OpenType 字体 | font/otf |
.rar | RAR 存档 | application/x-rar-compressed |
.rtf | 富文本格式 (RTF) | application/rtf |
.sh | Bourne shell 脚本 | application/x-sh |
.svg | 可缩放矢量图形 (SVG) | image/svg+xml |
.swf | 小型web格式 (SWF) or Adobe Flash document | application/x-shockwave-flash |
.tar | Tape 归档(TAR) | application/x-tar |
.tif | 标记图像文件格式 (TIFF) | image/tiff |
.tiff | Tagged Image File Format (TIFF) | image/tiff |
.ttf | rueType 字体 | font/ttf |
.txt | Text | text/plain |
.vsd | Microsoft Visio | application/vnd.visio |
.wav | 波形音频格式 | audio/wav |
.weba | WEBM 音频 | audio/webm |
.webm | EBM 视频 | video/webm |
.webp | WEBP 图片 | image/webp |
.woff | 网页开放字体格式 (WOFF) | font/woff |
.woff2 | 网页开放字体格式 (WOFF) | font/woff2 |
.xhtml | XHTML | application/xhtml+xml |
.xml | XML | application/xml(普通用户不可读)、text/xml(普通用户可读) |
.xul | XUL | application/vnd.mozilla.xul+xml |
.zip | ZIP | application/zip |
.3gp | 3GPP audio/video 容器 | video/3gpp、audio/3gpp(不含视频) |
.3g2 | 3GPP2 audio/video 容器 | video/3gpp2、audio/3gpp2(不含视频) |
.7z | 7-zip | application/x-7z-compressed |
了解更多文档