(ctx, next)
| 70 | } |
| 71 | |
| 72 | async fileInfo(ctx, next) { |
| 73 | let { filename } = ctx.params; |
| 74 | const fileInfo = await fileService.getFileByFilename(filename); |
| 75 | const { type } = ctx.query; |
| 76 | const types = ["small", "middle", "large"]; |
| 77 | if (types.some(item => item === type)) { |
| 78 | filename = filename + '-' + type; |
| 79 | } |
| 80 | |
| 81 | ctx.response.set('content-type', fileInfo.mimetype); |
| 82 | ctx.body = fs.createReadStream(`${PICTURE_PATH}/${filename}`); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | module.exports = new MomentController(); |
nothing calls this directly
no test coverage detected