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

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

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

瀏覽:113日期: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
相關文章:
主站蜘蛛池模板: 江津市| 新竹市| 大安市| 襄樊市| 偃师市| 铅山县| 凌云县| 任丘市| 奉新县| 林芝县| 灵寿县| 凤城市| 廊坊市| 平安县| 宽甸| 绥德县| 彭阳县| 荥经县| 凤山县| 萝北县| 青龙| 宁德市| 寿宁县| 临高县| 兴城市| 德化县| 馆陶县| 崇仁县| 鹤壁市| 泸定县| 平谷区| 诏安县| 紫阳县| 扬州市| 鞍山市| 太谷县| 唐海县| 泾源县| 江陵县| 密山市| 浦北县|