mirror of
https://github.com/HChaZZY/alist.git
synced 2025-12-24 11:07:02 +08:00
@@ -26,3 +26,16 @@ func GetFiles(dir string) ([]File, error) {
|
||||
}
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func GetFile(path string) (File, error) {
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return File{}, err
|
||||
}
|
||||
return File{
|
||||
Name: info.Name(),
|
||||
Size: info.Size(),
|
||||
Path: path,
|
||||
Modified: info.ModTime(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user