fix(platform): support Windows storage and native filesystem boundaries
This commit is contained in:
1 parent
3726423338
commit
e239fff253
24 files changed
+355
-51
No files matched your search
@@ -0,0 +1,14 @@
|
||||
//go:build !windows
|
||||
|
||||
package fileutil
|
||||
|
||||
import "syscall"
|
||||
|
||||
// AvailableBytes returns disk space available to the current user.
|
||||
func AvailableBytes(dir string) (uint64, error) {
|
||||
var stat syscall.Statfs_t
|
||||
if err := syscall.Statfs(dir, &stat); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return stat.Bavail * uint64(stat.Bsize), nil
|
||||
}
|
||||
Reference in new issue
Block a user