mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-08-21 05:21:17 -04:00
Add notes for os.Stat
(Hugo 0.47) (#557)
This commit is contained in:
parent
e49f65bb3c
commit
af14497c68
33
content/en/functions/os.Stat.md
Normal file
33
content/en/functions/os.Stat.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
title: os.Stat
|
||||||
|
description: Gets a file information of a given path.
|
||||||
|
godocref:
|
||||||
|
date: 2018-08-07
|
||||||
|
publishdate: 2018-08-07
|
||||||
|
lastmod: 2018-08-07
|
||||||
|
categories: [functions]
|
||||||
|
menu:
|
||||||
|
docs:
|
||||||
|
parent: "functions"
|
||||||
|
keywords: [files]
|
||||||
|
signature: ["os.Stat PATH"]
|
||||||
|
workson: []
|
||||||
|
hugoversion:
|
||||||
|
relatedfuncs: [readDir]
|
||||||
|
deprecated: false
|
||||||
|
aliases: []
|
||||||
|
---
|
||||||
|
|
||||||
|
If your current project working directory has a single file named `README.txt` (30 bytes):
|
||||||
|
```
|
||||||
|
{{ $stat := os.Stat "README.txt" }}
|
||||||
|
{{ $stat.Name }} → "README.txt"
|
||||||
|
{{ $stat.Size }} → 30
|
||||||
|
```
|
||||||
|
|
||||||
|
Function [`os.Stat`][Stat] returns [`os.FileInfo`][osfileinfo].
|
||||||
|
For further information of `os.FileInfo`, see [golang page][osfileinfo].
|
||||||
|
|
||||||
|
|
||||||
|
[Stat]: /functions/os.Stat/
|
||||||
|
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
|
@ -2838,6 +2838,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"os": {
|
"os": {
|
||||||
|
"Stat": {
|
||||||
|
"Description": "Stat returns a file infomation under the given path.",
|
||||||
|
"Args": [
|
||||||
|
"i"
|
||||||
|
],
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": [
|
||||||
|
[
|
||||||
|
"{{ (os.Stat \"foo.txt\").Name }}",
|
||||||
|
"foo.txt"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
"FileExists": {
|
"FileExists": {
|
||||||
"Description": "FileExists checks whether a file exists under the given path.",
|
"Description": "FileExists checks whether a file exists under the given path.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user