Files
reloading-manager/backend/handlers/file.go
Ron Rise cd874f174f
Some checks failed
🧪 ✨ Unit Tests Workflow / 🧪 📜 JavaScript Tests (push) Successful in 7m5s
🧪 ✨ Unit Tests Workflow / 🧪 🐹 GolangCI-Lint (push) Failing after 7m18s
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Successful in 10m6s
A full commitment's what I'm thinking of
2025-06-10 21:28:56 -04:00

24 lines
370 B
Go

package handlers
import (
"github.com/labstack/echo/v4"
)
func ReadFile(c echo.Context, formName string) ([]byte, error) {
file, err := c.FormFile(formName)
if err != nil {
c.Logger().Error(err)
return nil, err
}
handler, err := file.Open()
if err != nil {
return nil, err
}
buf := make([]byte, file.Size)
_, _ = handler.Read(buf)
return buf, nil
}