2018-04-29 22:00:41 +02:00
|
|
|
const logger = require('winston');
|
|
|
|
|
|
|
|
const serveFile = ({ filePath, fileType }, res) => {
|
|
|
|
logger.verbose(`serving file: ${filePath}`);
|
|
|
|
const sendFileOptions = {
|
|
|
|
headers: {
|
|
|
|
'X-Content-Type-Options': 'nosniff',
|
|
|
|
'Content-Type' : fileType || 'image/jpeg',
|
|
|
|
},
|
|
|
|
};
|
2018-05-07 20:03:30 +02:00
|
|
|
res.status(200).sendFile(filePath, sendFileOptions);
|
2018-04-29 22:00:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = serveFile;
|