Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SameDevice ¶
SameDevice reports whether fi1 and fi2 describe files on the same device. For example, on Unix this means that the device fields of the two underlying structures are identical; on other systems the decision may be based on the path names. SameDevice only applies to results returned by this package's Stat. It returns false in other cases.
func SameDevices ¶
SameDevices reports whether name1 and name2 are files on the same device. The function follow symlinks.
func SameFile ¶
SameFile reports whether fi1 and fi2 describe the same file. For example, on Unix this means that the device and inode fields of the two underlying structures are identical; on other systems the decision may be based on the path names. SameDevice only applies to results returned by this package's Stat. It returns false in other cases.
func SameFiles ¶
SameFiles reports whether name1 and name2 are the same file. The function follow symlinks.
func Supports ¶
func Supports(probe SupportsType) bool
Supports returns whether probe is supported by the operating system.
Types ¶
type FileInfo ¶
type FileInfo interface {
Name() string // base name of the file
Size() int64 // length in bytes for regular files; system-dependent for others
Mode() os.FileMode // file mode bits
ModTime() time.Time // last modified time
IsDir() bool // abbreviation for Mode().IsDir()
Sys() any // underlying data source
DeviceID() uint64 // device ID
FileID() uint64 // file ID
Links() uint64 // number of hard links, or 0 if unsupported
ATime() time.Time // last accessed time, or 0 if unsupported
BTime() time.Time // birth (created) time, or 0 if unsupported
CTime() time.Time // last changed time, or 0 if unsupported
MTime() time.Time // last modified time (alias)
UID() uint64 // user ID, or 0 if unsupported
GID() uint64 // group ID, or 0 if unsupported
}
A FileInfo describes a file and is returned by Stat. See https://github.com/golang/go/blob/ad7a6f81/src/io/fs/fs.go#L158
func Lstat ¶
Lstat returns a FileInfo describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link. If there is an error, it will be of type [*PathError].
On Windows, if the file is a reparse point that is a surrogate for another named entity (such as a symbolic link or mounted folder), the returned FileInfo describes the reparse point, and makes no attempt to resolve it.
type SupportsType ¶
type SupportsType uint
SupportsType defines a bitmask that identifies if the OS supports specific fields, or not.
const ( // SupportsLinks defines if the OS supports the Links() field. SupportsLinks SupportsType = 1 << iota // SupportsATime defines if the OS supports the ATime() (last accessed // time) field. SupportsATime // SupportsBTime defines if the OS supports the BTime() (birth/created // time) field. SupportsBTime // SupportsCTime defines if the OS supports the CTime() (last changed // time) field. SupportsCTime // SupportsUID defines if the OS supports the DeviceUID() field. SupportsUID // SupportsGID defines if the OS supports the DeviceGID() field. SupportsGID )