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
+10.2k Golang : How to profile or log time spend on execution?
+6.1k Java : Human readable password generator
+19.9k Golang : Measure http.Get() execution time
+8.2k Golang : Get final or effective URL with Request.URL example
+18.8k Golang : Delete duplicate items from a slice/array
+10.1k Golang : Print how to use flag for your application example
+26.8k Golang : Convert file content into array of bytes
+36.3k Golang : Convert(cast) int64 to string
+9.2k Golang : Generate Codabar
+11.1k Golang : How to determine a prime number?
+5.3k Javascript : Change page title to get viewer attention
+5.6k Swift : Get substring with rangeOfString() function example