MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / ReadFileByLine

Method ReadFileByLine

agent/app/api/v2/file.go:988–1006  ·  view source on GitHub ↗

@Tags File @Summary Read file by Line @Param type path string true "type" @Param request body request.FileReadByLineReq true "request" @Success 200 {object} response.FileLineContent @Security ApiKeyAuth @Security Timestamp @Router /files/read/{type} [post]

(c *gin.Context)

Source from the content-addressed store, hash-verified

986// @Security Timestamp
987// @Router /files/read/{type} [post]
988func (b *BaseApi) ReadFileByLine(c *gin.Context) {
989 var req request.FileReadByLineReq
990 if err := helper.CheckBindAndValidate(&req, c); err != nil {
991 return
992 }
993 if readType := strings.TrimSpace(c.Param("type")); readType != "" {
994 req.Type = readType
995 }
996 res, err := fileService.ReadLogByLine(req)
997 if err != nil {
998 helper.InternalServer(c, err)
999 return
1000 }
1001 if res.TotalLines > 100 {
1002 helper.SuccessWithDataGzipped(c, res)
1003 } else {
1004 helper.SuccessWithData(c, res)
1005 }
1006}
1007
1008// @Tags File
1009// @Summary Batch change file mode and owner

Callers 3

ReadLogByLineMethod · 0.80
ReadByLineMethod · 0.80
GetWebsiteLogMethod · 0.80

Calls 1

ReadLogByLineMethod · 0.65

Tested by

no test coverage detected