express icon indicating copy to clipboard operation
express copied to clipboard

response.download question

Open pyrostrex opened this issue 15 years ago • 5 comments

Is there a way to prune the file while downloading? Coz, I think, whenever I prune the data that is currently being downloaded, the server crash. I wanted to do an expiration date for one file. For example, one file can only be accessed for x hours before getting deleted.

pyrostrex avatar Feb 09 '11 12:02 pyrostrex

so mid download you want to stop? what kind of service is this? if someone was downloading before wouldnt you want it to finish?

tj avatar Feb 09 '11 17:02 tj

Even if I wanted them to finish it first before it is deleted, How can I detect if they already finish their download. I'm building a system that can download from file hosting. So, I don't want to store the files too long. Thats why my service must have an expiration time.

pyrostrex avatar Feb 10 '11 03:02 pyrostrex

maybe i should return the stream, so you can listen on events

tj avatar Feb 10 '11 16:02 tj

Fixed res.download() callback, passing stream. Closed by 07eb66c205a583a13ddbcf4f74d6802a2b1dec5e

should be able to figure something out with this. at very least use redis or something with INCR/DECR to keep a count on active downloads

tj avatar Feb 10 '11 16:02 tj

Thanks for this. I really appreciate it :)

pyrostrex avatar Feb 10 '11 17:02 pyrostrex