mirror of
https://github.com/restic/restic.git
synced 2026-06-21 16:14:18 +00:00
4d1b9cef63
Move TempFile and PreallocateFile into internal/fileio. internal/fs primarily focuses on converting between data.Node and the actual filesystem state. Extract the two methods to not pull in unnecessary dependencies.
12 lines
240 B
Go
12 lines
240 B
Go
//go:build !linux && !darwin
|
|
|
|
package fileio
|
|
|
|
import "os"
|
|
|
|
func PreallocateFile(wr *os.File, size int64) error {
|
|
// Maybe truncate can help?
|
|
// Windows: This calls SetEndOfFile which preallocates space on disk
|
|
return wr.Truncate(size)
|
|
}
|