MCPcopy
hub / github.com/labstack/echo / serveFile

Function serveFile

middleware/static.go:314–321  ·  view source on GitHub ↗
(c *echo.Context, file fs.File, info os.FileInfo)

Source from the content-addressed store, hash-verified

312}
313
314func serveFile(c *echo.Context, file fs.File, info os.FileInfo) error {
315 ff, ok := file.(io.ReadSeeker)
316 if !ok {
317 return errors.New("file does not implement io.ReadSeeker")
318 }
319 http.ServeContent(c.Response(), c.Request(), info.Name(), info.ModTime(), ff)
320 return nil
321}
322
323func listDir(t *template.Template, pathInFs string, filesystem fs.FS, res http.ResponseWriter) error {
324 files, err := fs.ReadDir(filesystem, pathInFs)

Callers 1

ToMiddlewareMethod · 0.85

Calls 2

ResponseMethod · 0.80
RequestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…