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

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

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

瀏覽:85日期: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. }});

標(biāo)簽: excel
相關(guān)文章:
主站蜘蛛池模板: 宁夏| 乌鲁木齐市| 西城区| 宝兴县| 绩溪县| 洮南市| 临沂市| 大悟县| 万全县| 农安县| 玉环县| 云霄县| 青阳县| 灵宝市| 丰县| 泸定县| 灵璧县| 隆尧县| 湘阴县| 梅河口市| 平凉市| 江永县| 永德县| 台中市| 房山区| 永年县| 武穴市| 明光市| 泰宁县| 达州市| 山东省| 台南市| 塘沽区| 晋城| 新邵县| 芜湖市| 江城| 禹城市| 大埔区| 韶关市| 广河县|