Files
lixen 664cf9654e
test / test (push) Canceled after 0s
test / e2e (push) Canceled after 0s
v0.16.0 import PGN, delete games, two-layout web client
2026-10-19 21:02:39 -04:00

27 lines
471 B
Go

//go:build !js && !wasm
package command
import (
"fmt"
"os"
)
const maxImportFile = 64 << 10
// readImportFile reads a PGN file for import.
func readImportFile(path string) (string, error) {
info, err := os.Stat(path)
if err != nil {
return "", err
}
if info.Size() > maxImportFile {
return "", fmt.Errorf("%s is larger than %d bytes", path, maxImportFile)
}
data, err := os.ReadFile(path)
if err != nil {
return "", err
}
return string(data), nil
}