1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 21:22:35 +01:00
send/server/routes/metadata.js

19 lines
401 B
JavaScript
Raw Normal View History

const storage = require('../storage');
module.exports = async function(req, res) {
const id = req.params.id;
2018-02-06 23:31:18 +01:00
const meta = req.meta;
try {
const size = await storage.length(id);
const ttl = await storage.ttl(id);
res.send({
metadata: meta.metadata,
2018-02-06 23:31:18 +01:00
finalDownload: meta.dl + 1 === meta.dlimit,
size,
ttl
});
} catch (e) {
res.sendStatus(404);
}
};