Spaces:
Paused
Paused
Download src/routes/poster.js from mikmc/random-test: direct link, hf CLI and curl.
- Browser
- Download file 594 Bytes
-
https://huggingface.co/spaces/mikmc/random-test/resolve/main/src/routes/poster.js
- Command line
-
hf download hf://spaces/mikmc/random-test/src/routes/poster.js
-
curl -L -o poster.js https://huggingface.co/spaces/mikmc/random-test/resolve/main/src/routes/poster.js
594 Bytes
| const express = require('express'); | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| const log = require('../helpers/logger'); | |
| const router = express.Router(); | |
| router.get('/poster/:filename', (req, res) => { | |
| const filePath = path.join(__dirname, '../../db/rpdbPosters', req.params.filename); | |
| fs.access(filePath, fs.constants.F_OK, (err) => { | |
| if (err) { | |
| log.error(`Poster not found: ${filePath}`); | |
| res.status(404).send('Poster not found'); | |
| } else { | |
| res.sendFile(filePath); | |
| } | |
| }); | |
| }); | |
| module.exports = router; | |