Go · Function
os.ReadFile
os.ReadFile reads a named file completely and returns its contents as []byte. It returns an error when the read fails.
Last updated
- Since
- Go 1.16
Syntax
func ReadFile(name string) ([]byte, error)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
os.WriteFileos.Openos.PathErrorio.EOF