I have something like that:
function DownLoadZip(response){
console.log(response.zipFile); // result of console log - example.zip
res.writeHead(200, {
'Content-Type': 'application/zip',
'Content-Length': stat.size
});
};
Question: How can I give to client completed zip file. This file comes with response. Maybe I forgot some headers or that is something else. Any ideas? Thanks for attention and have a nice day!
In case response.zipFile
is a path: fs.createReadStream(response.zipFile).pipe(res);
If response
is a stream: response.pipe(res);
Maybe it helps somebody! I have forgotten type:
res.send();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.