metadata.js 346 B

12345678910111213141516
  1. const storage = require('../storage');
  2. module.exports = async function(req, res) {
  3. const id = req.params.id;
  4. const meta = req.meta;
  5. try {
  6. const ttl = await storage.ttl(id);
  7. res.send({
  8. metadata: meta.metadata,
  9. finalDownload: meta.dl + 1 === meta.dlimit,
  10. ttl
  11. });
  12. } catch (e) {
  13. res.sendStatus(404);
  14. }
  15. };