15 lines
308 B
Go
15 lines
308 B
Go
//go:build !linux
|
|
|
|
package httpdl
|
|
|
|
import "os"
|
|
|
|
// allocate is the portable fallback: fallocate is Linux-specific, so on other
|
|
// platforms prealloc/falloc degrade to a plain truncate.
|
|
func allocate(f *os.File, mode string, size int64) error {
|
|
if mode == "none" {
|
|
return nil
|
|
}
|
|
return f.Truncate(size)
|
|
}
|