MCPcopy Index your code
hub / github.com/coderwhy/coderhub / fileInfo

Method fileInfo

src/controller/moment.controller.js:72–83  ·  view source on GitHub ↗
(ctx, next)

Source from the content-addressed store, hash-verified

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
86module.exports = new MomentController();

Callers

nothing calls this directly

Calls 1

getFileByFilenameMethod · 0.80

Tested by

no test coverage detected