1 Star 1 Fork 0

Breeze / bzv2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
read.go 609 Bytes
一键复制 编辑 原始数据 按行查看 历史
Breeze 提交于 2023-08-20 01:17 . A:gin.test
package bzfile
import (
"fmt"
"gitee.com/breezeHub/bzv2/pkg/data/bzbyte"
"os"
"strings"
)
func ReadStringTrim(filePath string) (string, error) {
s, err := ReadString(filePath)
return strings.TrimSpace(s), err
}
func ReadString(filePath string) (string, error) {
bytes, err := ReadBytes(filePath)
return bzbyte.ToStr(bytes), err
}
func ReadBytes(filePath string) ([]byte, error) {
if !IsExist(filePath) {
return nil, fmt.Errorf("%s not exists", filePath)
}
if !IsFile(filePath) {
return nil, fmt.Errorf("%s not file", filePath)
}
bytes, err := os.ReadFile(filePath)
return bytes, err
}
Go
1
https://gitee.com/breezeHub/bzv2.git
git@gitee.com:breezeHub/bzv2.git
breezeHub
bzv2
bzv2
v0.0.5

搜索帮助