Golang net/http.Dir type and Dir.Open() function example
package net/http
Golang net/http.Dir type and Dir.Open() function usage example
package main
import (
"fmt"
"net/http"
)
func main() {
var directory http.Dir
directory = "./"
file, err := directory.Open("input.txt")
if err != nil {
panic(file)
}
fileInfo, _ := file.Stat()
fmt.Println(fileInfo.Name())
fmt.Println("Size : ", fileInfo.Size())
}
Output :
input.txt
Size : 22
References :
Advertisement
Something interesting
Tutorials
+9.9k Golang : Function wrapper that takes arguments and return result example
+7.1k Golang : Gorrila mux.Vars() function example
+9.6k Golang : How to extract video or image files from html source code
+9.4k Golang : Apply Histogram Equalization to color images
+8.4k Golang : Convert word to its plural form example
+9k Golang : Build and compile multiple source files
+18.8k Golang : How to make function callback or pass value from function as parameter?
+12.4k Golang : Search and extract certain XML data example
+6k Linux/MacOSX : Search for files by filename and extension with find command
+5.2k Golang : Print instead of building pyramids
+14.9k Golang : How to check for empty array string or string?