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
+19.2k Golang : Populate dropdown with html/template example
+17.4k Golang : Multi threading or run two processes or more example
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+8.1k Golang : Check from web if Go application is running or not
+12.3k Golang : Display list of countries and ISO codes
+9.6k Golang : Quadratic example
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+52.6k Golang : How to get struct field and value by name
+6.6k Golang : Embedded or data bundling example
+10.9k Golang : Removes punctuation or defined delimiter from the user's input
+5.6k Javascript : How to refresh page with JQuery ?
+9.7k Golang : Find correlation coefficient example