github.com/MetalBlockchain/metalgo@v1.11.9/utils/storage/storage_unix.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 //go:build !windows 5 // +build !windows 6 7 package storage 8 9 import "syscall" 10 11 func AvailableBytes(storagePath string) (uint64, error) { 12 var stat syscall.Statfs_t 13 err := syscall.Statfs(storagePath, &stat) 14 if err != nil { 15 return 0, err 16 } 17 avail := stat.Bavail * uint64(stat.Bsize) 18 return avail, nil 19 }