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

Method avatarInfo

src/controller/user.controller.js:20–28  ·  view source on GitHub ↗
(ctx, next)

Source from the content-addressed store, hash-verified

18 }
19
20 async avatarInfo(ctx, next) {
21 // 1.用户的头像是哪一个文件呢?
22 const { userId } = ctx.params;
23 const avatarInfo = await fileService.getAvatarByUserId(userId);
24
25 // 2.提供图像信息
26 ctx.response.set('content-type', avatarInfo.mimetype);
27 ctx.body = fs.createReadStream(`${AVATAR_PATH}/${avatarInfo.filename}`);
28 }
29}
30
31module.exports = new UserController();

Callers

nothing calls this directly

Calls 1

getAvatarByUserIdMethod · 0.80

Tested by

no test coverage detected