mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 23:03:43 +00:00
13 lines
249 B
Go
13 lines
249 B
Go
package file_allocate
|
|
|
|
import "os"
|
|
|
|
type PreFileAllocator struct {
|
|
}
|
|
|
|
func (p *PreFileAllocator) Allocate(name string, size int64) (file *os.File, err error) {
|
|
err = os.Truncate(name, size)
|
|
file, err = os.OpenFile(name, os.O_RDWR, 0644)
|
|
return
|
|
}
|