express.js Check if partial range download finished

181 Views Asked by At

I am using res.download in express.js on my server to give a file for download. If I support partial range in my server callback function of res.download will be called several times. How can I know when download is completely finished?

res.download(filePath, fileName, function(){
// Error handling 
if(req.headers.range)
{
// downloading with range support 
// here will be called several times
}
}) 
1

There are 1 best solutions below

0
Shahin Shemshian On BEST ANSWER

I figured out there is no way to acknowledge that as every portion of file will be downloaded separately and raise its own finish method. So client would call another api to let the server know the download is completed.