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

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

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

瀏覽:105日期: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
相關文章:
主站蜘蛛池模板: 申扎县| 简阳市| 蒙山县| 鄄城县| 凌云县| 彭水| 洞口县| 博白县| 美姑县| 和田市| 乃东县| 阿坝县| 都昌县| 嘉善县| 牟定县| 清远市| 潞城市| 永平县| 将乐县| 麦盖提县| 琼中| 高阳县| 台北县| 自治县| 固原市| 井研县| 綦江县| 漳浦县| 滁州市| 牙克石市| 廉江市| 漳浦县| 武川县| 赫章县| 聂荣县| 娄烦县| 壤塘县| 甘谷县| 鄄城县| 南岸区| 龙陵县|