os.FileInfo
The Go interface describing a file, returned by os.Stat and f.Stat, with methods such as Name, Size and Mode.
In more detail
Size gives the length in bytes and Mode the file type and permission bits. It describes the file at the moment you asked; it does not stay up to date.
Example
fmt.Printf("%s: %d bytes, mode %s\n", info.Name(), info.Size(), info.Mode())Related terms
- stat — The operating system call, and matching command, that reports a file's details such as size, mode and modification time without opening it.
- file permissions — Rules on each file saying which user and group own it and who may read, write or run it.
- os.Open — The Go function that opens a file for reading and returns an *os.File you can stream from and must close.
Taught in
- Files and the os Package — Concurrent Systems Programming with Go