Documentation ¶
Overview ¶
Package file provides a version of os.OpenFile, the handles of which can be renamed and deleted under Windows.
Index ¶
- Constants
- Variables
- func Create(name string) (*os.File, error)
- func FindUnusedDriveLetter() (driveLetter uint8)
- func IsReserved(path string) error
- func Open(name string) (*os.File, error)
- func PreAllocate(size int64, out *os.File) (err error)
- func SetSparse(out *os.File) error
- func UNCPath(l string) string
Constants ¶
const PreallocateImplemented = true
PreallocateImplemented is a constant indicating whether the implementation of Preallocate actually does anything.
const SetSparseImplemented = false
SetSparseImplemented is a constant indicating whether the implementation of SetSparse actually does anything.
Variables ¶
var ErrDiskFull = errors.New("preallocate: file too big for remaining disk space")
ErrDiskFull is returned from PreAllocate when it detects disk full
var OpenFile = os.OpenFile
OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc.) and perm (before umask), if applicable. If successful, methods on the returned File can be used for I/O. If there is an error, it will be of type *PathError.
Under both Unix and Windows this will allow open files to be renamed and or deleted.
Functions ¶
func Create ¶
Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.
func FindUnusedDriveLetter ¶ added in v1.54.0
func FindUnusedDriveLetter() (driveLetter uint8)
FindUnusedDriveLetter does nothing except on Windows.
func IsReserved ¶ added in v1.56.0
IsReserved checks if path contains a reserved name
func Open ¶
Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.
func PreAllocate ¶ added in v1.52.0
PreAllocate the file for performance reasons
Types ¶
This section is empty.