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
+25.7k Golang : How to write CSV data to file
+13.7k Golang : Image to ASCII art example
+21.2k Golang : How to force compile or remove object files first before rebuild?
+5.4k Unix/Linux/MacOSx : How to remove an environment variable ?
+18.6k Golang : Find IP address from string
+5.6k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+16.8k Golang : Get own process identifier
+34k Golang : Proper way to set function argument default value
+17k Golang : Get number of CPU cores
+36k Golang : Get file last modified date and time
+5.9k Golang : Generate multiplication table from an integer example
+9.7k Golang : Detect number of active displays and the display's resolution