数据上报
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
624 B

package dbHelper
import (
"io"
"log"
"os"
"strings"
)
type FileSaveHelper struct {
Directory string
FilenameExtension string
}
func (the *FileSaveHelper) Initial() {
}
func (the *FileSaveHelper) Save(filePath, fileContent string) {
File, errC := os.Create(filePath)
defer File.Close()
if errC != nil {
log.Printf("创建文件失败 path=%s,err=%s", filePath, errC.Error())
}
_, err := io.Copy(File, strings.NewReader(fileContent))
if err != nil {
log.Printf("文件写入失败 path=%s,err=%s", filePath, err.Error())
}
log.Printf("[%v]存储文件 长度=%d ", filePath, len(fileContent))
}