Golang os.TempDir() function example
package os
Golang os.TempDir() function usage example. Use this function to find out the directory to store your temporary files such as uploaded files.
package main
import (
"fmt"
"os"
)
func main() {
tmp := os.TempDir()
fmt.Println("The default directory use for temporary files on this server is : ", tmp)
}
Sample output :
The default directory use for temporary files on this server is : /tmp
Reference :
Advertisement
Something interesting
Tutorials
+14.3k Golang : rune literal not terminated error
+7.1k Golang : Gomobile init produce "iphoneos" cannot be located error
+18.1k Golang : Clearing slice
+10.8k Golang : Sort and reverse sort a slice of runes
+6.4k Golang : Example of custom handler for Gorilla's Path usage.
+74.4k Golang : How to return HTTP status code?
+11.8k Golang : Pass database connection to function called from another package and HTTP Handler
+17.4k Golang : Logging with logrus
+28.1k Golang : How to create new XML file ?
+13.5k Golang : How to shuffle elements in array or slice?
+6.5k Golang : Create zip/ePub file without compression(use Store algorithm)