国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

node.js - nodejs如何發(fā)送請(qǐng)求excel文件并下載

瀏覽:132日期:2022-06-26 11:07:45

問(wèn)題描述

問(wèn)題解答

回答1:res.download(path [, filename] [, fn]) http://expressjs.com/en/api.h...

Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.

When an error ocurrs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.

res.download(’/report-12345.pdf’);res.download(’/report-12345.pdf’, ’report.pdf’);res.download(’/report-12345.pdf’, ’report.pdf’, function(err){ if (err) { // Handle error, but keep in mind the response may be partially-sent // so check res.headersSent } else { // decrement a download credit, etc. }});

標(biāo)簽: excel
相關(guān)文章:
主站蜘蛛池模板: 无为县| 宁城县| 永济市| 忻城县| 清原| 咸阳市| 永福县| 太湖县| 剑阁县| 墨竹工卡县| 阳泉市| 宜城市| 崇仁县| 娄底市| 吉林省| 华阴市| 永福县| 太仆寺旗| 铁岭县| 朝阳市| 临沧市| 宝山区| 陇西县| 蛟河市| 绥化市| 毕节市| 乌审旗| 商都县| 阿巴嘎旗| 岱山县| 锡林浩特市| 普定县| 潜山县| 河北省| 广西| 宁波市| 读书| 鹤岗市| 丰台区| 梁河县| 云南省|