Gopher

os

Os is Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

os.FileExists  

(i any) → bool

FileExists checks whether a file exists under the given path.

Aliases: fileExists

Examples

{{ fileExists "foo.txt" }}
false

os.Getenv  

(key any) → string

Getenv retrieves the value of the environment variable named by the key. It returns the value, which will be empty if the variable is not present.

Aliases: getenv

os.ReadDir  

(i any) → _os.FileInfo

ReadDir lists the directory contents relative to the configured WorkingDir.

Aliases: readDir

Examples

{{ range (readDir "files") }}{{ .Name }}{{ end }}
README.txt

os.ReadFile  

(i any) → string

ReadFile reads the file named by filename relative to the configured WorkingDir. It returns the contents as a string. There is an upper size limit set at 1 megabytes.

Aliases: readFile

Examples

{{ readFile "files/README.txt" }}
Hugo Rocks!

os.Stat  

(i any) → FileInfo

Stat returns the os.FileInfo structure describing file.