service.xpcool.com/common/tools/filex/filex.go
夏犀麟 8d5f2c65ae feat(common): 新增公共模块 common/tools 及项目上下文记忆体系
- common/tools 工具模块,10 个子功能:md5/cryptox/uuid/random/timex/convertx/strx/slicex/ip/filex(薄封装 GoFrame 内置组件)
- AGENTS.md 项目智能体说明书(架构、规范、命令、记忆体系索引)
- docs/change-log/2026-08-24.md 本次请求与变更记录
- .gitignore 排除 .workbuddy/;PROJECT_STRUCTURE.md 补充目录树
2026-08-24 17:18:10 +08:00

29 lines
754 B
Go

// Package filex provides common file system helpers on top of gfile.
package filex
import (
"github.com/gogf/gf/v2/os/gfile"
)
// Exists reports whether the file or directory at path exists.
func Exists(path string) bool {
return gfile.Exists(path)
}
// IsDir reports whether path is a directory.
func IsDir(path string) bool {
return gfile.IsDir(path)
}
// ReadString returns the full content of the file at path as a string.
// Returns an empty string when the file does not exist.
func ReadString(path string) string {
return gfile.GetContents(path)
}
// WriteString writes content to the file at path, creating intermediate
// directories if needed.
func WriteString(path, content string) error {
return gfile.PutContents(path, content)
}