码迷,mamicode.com
首页 > Web开发 > 详细

nodejs-mime类型

时间:2020-01-25 18:21:19      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:pre   text   打开方式   联网   类型   互联网   plain   打开   浏览器   

mime是一个互联网标准,通过设定它就可以设定文件在浏览器的打开方式

mime使用方法:

  • 使用mime模块查询文件的MIME类型:
mime.getType(‘/path/to/file.txt‘);         // => ‘text/plain‘
mime.getType(‘file.txt‘);                  // => ‘text/plain‘
mime.getType(‘.TXT‘);                      // => ‘text/plain‘
mime.getType(‘htm‘);                       // => ‘text/html‘

 

nodejs-mime类型

标签:pre   text   打开方式   联网   类型   互联网   plain   打开   浏览器   

原文地址:https://www.cnblogs.com/Rivend/p/12233240.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!