+const videosDownloadValidator = [
+ isValidVideoIdParam('id'),
+
+ async (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ if (areValidationErrors(req, res)) return
+ if (!await doesVideoExist(req.params.id, res, 'all')) return
+
+ const video = getVideoWithAttributes(res)
+
+ if (!await checkCanAccessVideoStaticFiles({ req, res, video, paramId: req.params.id })) return
+
+ return next()
+ }
+]
+