//导入
const path = require('path');
const fs = require('fs');
function downLoadTemplate() {
try {
const _path = path.join(__dirname, '../static/template.doc')
const stats = fs.statSync(_path)
if (stats.isFile()) {
ctx.set({
'Content-Type': 'application/octet-stream',
'Content-Disposition': 'attachment; filename=template.doc',
'Content-Length': stats.size
});
fs.createReadStream(_path);
} else {
console.log("下载模版遇到错误")
}
} catch (ex) {
console.log("下载模版遇到错误")
}
}