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
+11k Golang : Create S3 bucket with official aws-sdk-go package
+16.1k Golang : Generate universally unique identifier(UUID) example
+20.5k nginx: [emerg] unknown directive "passenger_enabled"
+87.8k Golang : How to convert character to ASCII and back
+22.9k Golang : Test file read write permission example
+12.3k Golang : Print UTF-8 fonts on image example
+5.2k Golang : Calculate half life decay example
+5.4k Unix/Linux : How to archive and compress entire directory ?
+7.7k Golang : Test if an input is an Armstrong number example
+13k Golang : Calculate elapsed years or months since a date
+17.4k Golang : Check if IP address is version 4 or 6
+7.9k Golang : Get today's weekday name and calculate target day distance example