🎨 数据统计

This commit is contained in:
Liang Ding 2022-11-10 18:45:41 +08:00
parent 70490f3e16
commit 953ce38ab7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 51 additions and 12 deletions

View file

@ -209,6 +209,19 @@ func SizeOfDirectory(path string) (size int64, err error) {
return
}
func CeilSize(size int64) int64 {
if 100*1024*1024 > size {
return 100 * 1024 * 1024
}
for i := int64(1); i < 40; i++ {
if 1024*1024*200*i > size {
return 1024 * 1024 * int64(i)
}
}
return 1024*1024*200*40 + 1
}
func IsReservedFilename(baseName string) bool {
return "assets" == baseName || "templates" == baseName || "widgets" == baseName || "emojis" == baseName || ".siyuan" == baseName || strings.HasPrefix(baseName, ".")
}