FTP: add support for AVBL command

This commit is contained in:
Nicola Murino
2020-12-25 11:14:08 +01:00
parent 1dce1eff48
commit 2a95d031ea
12 changed files with 153 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/eikenb/pipeat"
"github.com/rs/xid"
"github.com/shirou/gopsutil/v3/disk"
"github.com/drakkan/sftpgo/logger"
"github.com/drakkan/sftpgo/utils"
@@ -477,3 +478,12 @@ func (fs *OsFs) GetMimeType(name string) (string, error) {
func (*OsFs) Close() error {
return nil
}
// GetAvailableDiskSize return the available size for the specified path
func (*OsFs) GetAvailableDiskSize(dirName string) (int64, error) {
usage, err := disk.Usage(dirName)
if err != nil {
return 0, err
}
return int64(usage.Free), nil
}