1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-08 17:40:23 +08:00

finish backend login

This commit is contained in:
源文雨
2023-03-17 18:29:02 +08:00
parent 5889f0e30a
commit cd571e9e25
12 changed files with 844 additions and 279 deletions

25
backend/utils/file.go Normal file
View File

@@ -0,0 +1,25 @@
package utils
import "os"
// IsExist 文件/路径存在
func IsExist(path string) bool {
_, err := os.Stat(path)
return err == nil || os.IsExist(err)
}
// IsNotExist 文件/路径不存在
func IsNotExist(path string) bool {
_, err := os.Stat(path)
return err != nil && os.IsNotExist(err)
}
// FileSize 获取文件大小
func FileSize(path string) (n int64) {
stat, err := os.Stat(path)
if err != nil {
return
}
n = stat.Size()
return
}