久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

node.js - nodejs如何發送請求excel文件并下載

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

問題描述

問題解答

回答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. }});

標簽: excel
相關文章:
主站蜘蛛池模板: 福海县| 肃宁县| 搜索| 连城县| 上思县| 嘉峪关市| 沛县| 平舆县| 扎赉特旗| 平顶山市| 潢川县| 梓潼县| 泸定县| 九寨沟县| 济南市| 宜宾县| 龙江县| 鲁甸县| 武山县| 维西| 荃湾区| 射阳县| 临泽县| 准格尔旗| 马龙县| 裕民县| 塔城市| 循化| 墨江| 正定县| 蒙山县| 五寨县| 芦溪县| 四平市| 青田县| 岗巴县| 灵武市| 陕西省| 石屏县| 扎囊县| 小金县|