You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
import multer from "multer";
|
|
|
|
const profileStorage = multer.memoryStorage({});
|
|
|
|
const videoStorage = multer.memoryStorage({})
|
|
|
|
const thumbnailStorage = multer.memoryStorage({})
|
|
|
|
export const videoUpload = multer({
|
|
storage: videoStorage,
|
|
limits: {},
|
|
fileFilter: (req, file, cb) => {
|
|
if (!file.originalname.match(/\.(webm|mkv|flv|vob|ogv|ogg|drc|gifv|mng|avi|mov|qt|wmv|yuv|mp4)$/i)) {
|
|
return cb(new Error("Not supported"));
|
|
}
|
|
cb(undefined, true);
|
|
}
|
|
})
|
|
|
|
export const thumbnailUpload = multer({
|
|
storage: thumbnailStorage,
|
|
limits: {},
|
|
fileFilter: (req, file, cb) => {
|
|
if (!file.originalname.match(/\.(png|jpeg|jpg|webp)$/i)) {
|
|
return cb(new Error("Not supported"));
|
|
}
|
|
cb(null, true);
|
|
}
|
|
})
|
|
|
|
export const profileUpload = multer({
|
|
storage: profileStorage,
|
|
limits: {},
|
|
fileFilter: (req, file, cb) => {
|
|
if (!file.originalname.match(/\.(png|jpeg|jpg|webp)$/i)) {
|
|
return cb(new Error("Not supported"));
|
|
}
|
|
cb(null, true);
|
|
}
|
|
});
|