标签:else adf getdir sync pos pre syn timeout type
downloadfile:function(req,res){ var path= req.query.filename; setTimeout(function(){ var filename = path.split(‘/file‘)[1].substr(1,path.split(‘/file‘)[1].length) var filePath =config.targetDir+ filename; var stats = fs.statSync(filePath); if(stats.isFile()){ res.set({ ‘Content-Type‘: ‘application/octet-stream‘, ‘Content-Disposition‘: ‘attachment; filename=‘+filename, ‘Content-Length‘: stats.size }); fs.createReadStream(filePath).pipe(res); } else { res.end(404); } },1000) },
标签:else adf getdir sync pos pre syn timeout type
原文地址:https://www.cnblogs.com/czq-0214/p/9139456.html