use actual file size in dl progress. detect cancelled stream

This commit is contained in:
Danny Coates 2018-07-23 15:12:58 -07:00
parent 2afe79c941
commit 5483dc2506
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
6 changed files with 35 additions and 30 deletions

View file

@ -4,12 +4,10 @@ module.exports = async function(req, res) {
const id = req.params.id;
const meta = req.meta;
try {
const size = await storage.length(id);
const ttl = await storage.ttl(id);
res.send({
metadata: meta.metadata,
finalDownload: meta.dl + 1 === meta.dlimit,
size,
ttl
});
} catch (e) {