first commit

This commit is contained in:
2026-02-17 13:06:23 +08:00
commit 7cbd3d061d
349 changed files with 126558 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package baseutils
import (
"io/ioutil"
"os"
"github.com/micro/go-micro/util/log"
)
// ReadFile ReadFile
func ReadFile(filePth string) ([]byte, error) {
f, err := os.Open(filePth)
if err != nil {
return nil, err
}
defer f.Close()
return ioutil.ReadAll(f)
}
// WriteToFile WriteToFile
func WriteToFile(data []byte, fileName string) {
err := ioutil.WriteFile(fileName, data, 0666) //写入文件(字节数组)
if err != nil {
log.Info("WriteToFile failed: ", err)
}
}