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
+6.3k Golang : Extract sub-strings
+29.4k Golang : JQuery AJAX post data to server and send data back to client example
+18.8k Golang : How to make function callback or pass value from function as parameter?
+17.4k Golang : Get future or past hours, minutes or seconds
+20.7k Android Studio : AlertDialog and EditText to get user string input example
+5.1k Swift : Convert (cast) Float to Int or Int32 value
+43.2k Golang : Convert []byte to image
+11.4k Golang : Concatenate (combine) buffer data example
+22.9k Golang : Test file read write permission example
+7k Golang : Takes a plural word and makes it singular
+11.9k Golang : Convert(cast) bigint to string
+5.4k Golang : What is StructTag and how to get StructTag's value?