压缩文件下载
Zip file download
我有类似的东西:
function DownLoadZip(response){
console.log(response.zipFile); // result of console log - example.zip
res.writeHead(200, {
'Content-Type': 'application/zip',
'Content-Length': stat.size
});
};
问:如何给客户完成的zip文件。此文件附带响应。也许我忘记了一些 headers 或者那是别的东西。有任何想法吗?
感谢您的关注,祝您有愉快的一天!
如果 response.zipFile
是一个路径:
fs.createReadStream(response.zipFile).pipe(res);
如果 response
是一个流:
response.pipe(res);
也许对某人有帮助!
我忘了类型:
res.send();
我有类似的东西:
function DownLoadZip(response){
console.log(response.zipFile); // result of console log - example.zip
res.writeHead(200, {
'Content-Type': 'application/zip',
'Content-Length': stat.size
});
};
问:如何给客户完成的zip文件。此文件附带响应。也许我忘记了一些 headers 或者那是别的东西。有任何想法吗? 感谢您的关注,祝您有愉快的一天!
如果 response.zipFile
是一个路径:
fs.createReadStream(response.zipFile).pipe(res);
如果 response
是一个流:
response.pipe(res);
也许对某人有帮助! 我忘了类型:
res.send();