Download internal/syncer/util.go from a3216/gcli2api: direct link, hf CLI and curl.
- Browser
- Download file 415 Bytes
-
https://huggingface.co/spaces/a3216/gcli2api/resolve/main/internal/syncer/util.go
- Command line
-
hf download hf://spaces/a3216/gcli2api/internal/syncer/util.go
-
curl -L -o util.go https://huggingface.co/spaces/a3216/gcli2api/resolve/main/internal/syncer/util.go
415 Bytes
| package syncer | |
| import ( | |
| "fmt" | |
| "os" | |
| "strings" | |
| ) | |
| // readTrimmedFile 读一个文本文件并去掉首尾空白(token 文件常用)。 | |
| func readTrimmedFile(fp string) (string, error) { | |
| raw, err := os.ReadFile(fp) | |
| if err != nil { | |
| return "", fmt.Errorf("读取 %s 失败: %w", fp, err) | |
| } | |
| s := strings.TrimSpace(string(raw)) | |
| if s == "" { | |
| return "", fmt.Errorf("%s 内容为空", fp) | |
| } | |
| return s, nil | |
| } | |