How to add MIME type with Express

后端 未结 3 1285
别跟我提以往
别跟我提以往 2021-01-18 10:52

I\'m trying to get Firefox to play a video tag. Normally, I would just add this to an .htaccess file on Apache:

AddType video/ogg .ogv
AddType video/mp4 .mp4         


        
3条回答
  •  时光取名叫无心
    2021-01-18 11:11

    For express 4.x, good documentation on mime-type can be found in https://github.com/broofa/node-mime.

    For example, Safari browser would show the content of csv instead of downloading the csv with download here.

    You can get around this by adding the following

    express.static.mime.define({'application/octet-stream': ['csv']})
    

提交回复
热议问题